Arduino Humidity Sensor Guide
Arduino Humidity Sensor Guide
Humidity is a physical variable present in our environment and the element of the
the earth that provides this phenomenon is water. This occurs because it
impregnates any body even the steam that is present in the
atmosphere in the form of condensation. It is generated in clouds that are not
formed by water vapor but by ice.
Initial sample
m2 = final sample heated in an oven and obtained 24 hours later
Circuit assembly
the source code is as follows.
int reading = 0; // Analog pin to which the sensor is connected
int pump = 2; //Pin to which the relay for activating the pump is connected
int sensor = 3; //Sensor power pin
void setup()
{
[Link](9600);
pinMode(pump, OUTPUT); // Set pin 2 PUMP as output.
pinMode(sensor, OUTPUT); // Sets pin 2 SENSOR as output.
}
void loop()
{
digitalWrite(sensor, HIGH); // Turn on sensor
reading = analogRead(A0);
[Link]("Humidity value:");
[Link](reading);
if (reading < 200 ) //start the reading:
if the sensor value is less than '200', then...
{
digitalWrite(pump, LOW); //... activate the pump - INVERTED LOGIC
}
else
{
digitalWrite(pump, HIGH); //...deactivates the pump - INVERTED LOGIC
}
digitalWrite(sensor, LOW); // Turns off sensor
delay(1000);