How to Build a Simple Arduino-Based Humidity Sensor to Solve Your Dry Air Problems
Living with dry air can be uncomfortable and even unhealthy. Low humidity can cause issues like dry skin, nosebleeds, cracked lips, and respiratory irritation. Thankfully, building a simple Arduino-based humidity sensor can help you monitor and solve indoor dry air problems.
What You'll Need
To build a basic Arduino humidity sensor, you'll need the following components:
-
Arduino board - This is the microcontroller board that will run the code and report the humidity readings. An Arduino Uno or Nano will work well.
-
DHT11 or DHT22 sensor - This digital humidity and temperature sensor is easy to connect to an Arduino and provides reliable readings. The DHT22 is more precise.
-
Breadboard - For connecting the components.
-
Jumper wires - For wiring up the circuit.
-
Resistor - A 10K resistor is usually recommended for the DHT sensors. This helps ensure clean data signals.
-
LCD screen - Optional, but useful for displaying the humidity and temperature. A 16x2 LCD is common.
Circuit Design
Building the circuit is straightforward:
-
Connect the DHT sensor to the Arduino board using 3 jumper wires. Positively to the 5V pin, negatively to GND, and the data pin to any digital I/O pin.
-
If using an LCD screen, connect it to the Arduino using a potentiometer and other required pins. Refer to LCD pinout diagrams.
-
Add a 10K pull-up resistor between the data line and 5V pin. This stabilizes readings.
-
Power the Arduino board through USB or a power supply.
Arduino Humidity Sensor Code
The DHT sensor libraries include example sketches for reading humidity and temperature data. This code can be used as a basis:
```cpp
include "DHT.h"
define DHTPIN 2 // Digital pin for sensor
define DHTTYPE DHT11 // Sensor type (DHT11/DHT22)
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
delay(2000); // Delay 2 sec between reads
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C ");
}
```
This prints the humidity and temperature readings to the Serial monitor every 2 seconds. Modify as needed for LCD display output.
Calibrating the Sensor
While DHT sensors are quite accurate out of the box, for best results it's recommended to calibrate against a known accurate device.
To calibrate:
-
Place both sensors side by side in a room and compare readings over time.
-
Take note of any constant difference (like your sensor reading 5% lower humidity consistently).
-
Add or subtract the difference in your Arduino code to offset your sensor to the accurate reading.
Proper calibration ensures your humidity data is as precise as possible.
Enclosure and Placement
For long term use, it's best to add the sensor board to a protective enclosure. A small plastic project box works well.
Drill holes to expose the DHT sensor and display, and to run power and signal cables.
Place the enclosed sensor in a central area of the home at human level to monitor indoor humidity accurately. Keep away from drafts, vents, windows and doors.
Solving Low Humidity Issues
Once your Arduino humidity monitor is setup, here are some tips to raise humidity if it drops too low indoors:
-
Use room humidifiers to effectively and safely add moisture to dry air.
-
Hang damp towels to allow evaporation.
-
Boil water on the stove or run hot showers to add temporary moisture.
-
Check that humidistat settings on furnaces/HVAC systems are configured appropriately.
-
Use hydrometers with houseplants and fish tanks.
-
Monitor humidity levels in problem rooms separately.
With the help of your Arduino-based sensor, you can take the guesswork out of diagnosing and relieving dry indoor air. Spend less time worrying and more time breathing easy.