Arduino
Individual Sensor Tests (Humidity)
Goals for Humidity Sensor Test
The
goal of the test with the HIH-4030 humidity sensor is to ensure that arduino
works with the humidity sensor individually.
This will involve connecting the sensor to the arduino correctly,
writing the proper sketch for the arduino and collecting and examining the
output data to ensure it is correct.
Testing Procedure
To
begin the test, we first examined the Humidity sensor, which can be seen below,
courtesy of www.sparkfun.com.
Figure
1-Photo of Humidity Sensor
As one
can see from the photo, the sensor has three openings for connections. These include the 5V, OUT and GND
openings. The 5V opening accepts 5V from
a power source. The OUT opening outputs
a voltage that corresponds to the sensor readings. Finally, the GND opening completes the
circuit by traveling to ground. We
connected the sensor to the arduino using wires and a breadboard. Below is a schematic of how the sensor is
connected to an arduino. Note that the
humidity sensor does not require a connection to a certain analog pin for
output and can be connected to any of them successfully. Also, the arduino shown in the image is not
the arduino nano, but the connections are exactly the same for our model of
arduino.
Figure
2-Simple Arduino/Sensor Circuit
For our
sketch supplied to the arduino, we used analog pin 4, but as stated previous,
and of the analog pins will work properly with the sensor, given the proper
code. The sketch written for the arduino
and humidity sensor is shown below.
float val
= 0;
float RH =
0;
float
my_room_temperature = 20; //in degrees C !
float
max_voltage = 5;
void
setup()
{
Serial.begin(9600);
}
void
loop()
{
val = analogRead(4);
delay(500);
Serial.println(val);
//
my_room_temperature = 23
; // If you have temperature reading, put it
here (centigrade!)
max_voltage
= (5-(0.006706*my_room_temperature)) ;
//
The max voltage value drops down
0.006705882 for each degree C over 0C.
The
voltage at 0C is 3.27 (corrected for zero percent voltage)
RH = (val/1023)*100;
Serial.println(RH);
delay(500);
}
Testing Results
Upon
running the sketch and observing the serial monitor, we observed the following
data. The first number listed is the
output voltage which corresponds to a certain percentage of relative
humidity. Each pair of numbers is
reported every half second.
Output Value- 340.00
Relative Humidity- 33.24
Output Value- 339.00
Relative Humidity- 33.14
Output Value- 341.00
Relative Humidity- 33.33
Output Value- 340.00
Relative Humidity- 33.24
Output Value- 334.00
Relative Humidity- 32.65
Output Value- 336.00
Relative Humidity- 32.84
Output Value- 336.00
Relative Humidity- 32.84
Output Value- 332.00
Relative Humidity- 32.45
Output Value- 335.00
Relative Humidity- 32.75
Output Value- 336.00
Relative Humidity- 32.84
The
output seen above was for the first 5 seconds the humidity sensor was
operational. As one can see, the sensor
output is consistent and giving a stable output. Next we breathed on the sensor. This should increase the humidity reading, as
the air coming from inside a body should contain more water vapor.
Output Value- 391.00
Relative Humidity- 38.22
Output Value- 410.00
Relative Humidity- 40.08
Output Value- 410.00
Relative Humidity- 40.08
Output Value- 412.00
Relative Humidity- 40.27
Output Value- 391.00
Relative Humidity- 38.22
Output Value- 380.00
Relative Humidity- 37.15
Output Value- 373.00
Relative Humidity- 36.46
Output Value- 367.00
Relative Humidity- 35.87
Output Value- 357.00
Relative Humidity- 34.90
Output Value- 356.00
Relative Humidity- 34.80
Output Value- 349.00
Relative Humidity- 34.12
Output Value- 345.00
Relative Humidity- 33.72
Output Value- 339.00
Relative Humidity- 33.14
Output Value- 339.00
Relative Humidity- 33.14
Output Value- 335.00
Relative Humidity- 32.75
Output Value- 336.00
Relative Humidity- 32.84
As one
can see, the relative humidity increased after we breathed on the sensor. After a period of time, as shown, the
humidity sensor dropped back down to range of values that it had previous had
before it was exhaled on.
Recommendations on Test Results
With
the individual testing complete, the sensors need to be tested simultaneous to
work with the arduino controller.
Getting the data logger operational is the following step, which will
allow us to record all the data that comes from each of the sensors. The sensor may also need some calibrations in its calculations.
No comments:
Post a Comment