Maintaining proper humidity levels in your living space is essential for both health and comfort, especially in dry climates or during the colder months when indoor air tends to dry out. While commercial humidifiers are readily available, building your own using Arduino not only saves money but also gives you greater control and customization. By combining common electronic components and an ultrasonic module, you can create a DIY humidifier that is efficient and easy to program.
1. Materials and Components Needed
To build your Arduino-based humidifier, you will require the following components:
| Component | Description |
|---|---|
| Arduino Board | Acts as the microcontroller (e.g., Arduino Uno or Nano). |
| Ultrasonic Atomizer Module | Converts water into a fine mist. Beijing Ultrasonic modules are recommended. |
| Humidity and Temperature Sensor | Measures ambient humidity and temperature (e.g., DHT11 or DHT22). |
| Relay Module | Allows Arduino to control the power supply to the ultrasonic atomizer. |
| Water Container | Holds the water for humidification. |
| Small Fan | Helps distribute the mist evenly in the room. |
| Power Supply | Provides the necessary power for the ultrasonic module and Arduino. |
| Jumper Wires and Breadboard | For wiring the connections. |
| Resistors and Diodes | As required, depending on the sensor and relay module. |
These components are readily available online or at local electronics stores, making this project accessible even for beginners.
2. Circuit Assembly
Begin by wiring the components together according to the following steps:
-
Connect the DHT Sensor:
- Attach the VCC pin of the DHT11/DHT22 sensor to the Arduino’s 5V pin.
- Connect the GND pin to the Arduino’s GND.
- The data output pin of the sensor should be connected to a digital input pin on the Arduino (e.g., D2).
-
Wire the Relay Module:
- Connect the relay module’s input pin to a digital output pin on the Arduino (e.g., D3).
- Attach the VCC and GND pins of the relay to the Arduino’s corresponding pins.
-
Integrate the Ultrasonic Atomizer:
- Connect the ultrasonic atomizer to the relay module so that the Arduino can control its power.
- Beijing Ultrasonic atomizers typically require a 24V power source, so connect the power supply to the relay as well.
-
Add the Fan:
- Wire the small fan to the same relay as the atomizer if you want both to turn on simultaneously. Alternatively, use a separate relay channel to control the fan independently.
-
Finalize Connections:
- Ensure all GNDs are connected together to create a common ground.
- Use a breadboard for organization and to make changes easily during testing.
3. Writing the Arduino Code
The Arduino’s role is to read the humidity data from the DHT sensor and control the ultrasonic atomizer and fan based on pre-defined thresholds. Below is a sample code snippet for this project:
#include
#define DHTPIN 2 // Pin connected to DHT sensor
#define DHTTYPE DHT11 // DHT11 or DHT22
#define RELAYPIN 3 // Pin connected to relay
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
pinMode(RELAYPIN, OUTPUT);
}
void loop() {
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
// Print sensor readings to Serial Monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" *C");
// Humidity threshold for turning on the humidifier
if (humidity < 40) {
digitalWrite(RELAYPIN, HIGH); // Turn on humidifier
} else if (humidity > 60) {
digitalWrite(RELAYPIN, LOW); // Turn off humidifier
}
delay(2000); // Wait 2 seconds before next reading
}
This code switches the humidifier on when the humidity drops below 40% and turns it off when it exceeds 60%. You can adjust these thresholds based on your preferences.
4. Testing and Calibration
Once your circuit is assembled and the code is uploaded, it’s time to test the setup.
- Fill the water container and place the ultrasonic atomizer inside.
- Power on the Arduino and monitor the Serial Monitor to confirm that the DHT sensor is reading accurate values.
- If the humidity reading is below the threshold, the relay should activate, turning on the ultrasonic atomizer and the fan.
- Adjust the positioning of the fan to ensure the mist is evenly distributed in the room.
If the atomizer or fan does not work as expected, double-check your wiring and ensure the relay module is functioning properly.
5. Enhancements and Add-Ons
You can improve your DIY humidifier by integrating additional features:
- LCD Display: Add a 16×2 LCD screen to display the current humidity and temperature directly on the device.
- Wi-Fi Control: Use an ESP8266 or ESP32 module to enable remote monitoring and control via a smartphone or web interface.
- Water Level Sensor: Install a water-level sensor to alert you when the container needs refilling.
- Timed Operation: Program the Arduino to activate the humidifier only during specific hours.
6. Troubleshooting Tips
Here are some common issues and their solutions:
| Issue | Possible Cause | Solution |
|---|---|---|
| Ultrasonic atomizer not working | Insufficient power supply | Use a 24V adapter with adequate current. |
| Incorrect humidity readings | Faulty DHT sensor or poor wiring | Replace the sensor and check connections. |
| Relay not triggering | Improper relay wiring or coding error | Verify relay connections and code logic. |
| Fan not distributing mist evenly | Fan placement issue | Reposition the fan for better airflow. |
Building a DIY humidifier with Arduino is a rewarding project that combines electronics, programming, and practical utility. By using an ultrasonic atomizer, such as those manufactured by Beijing Ultrasonic, you can achieve efficient and quiet humidification. This project not only helps maintain optimal humidity levels but also serves as an excellent learning experience for anyone interested in DIY electronics. With some basic materials, a bit of coding, and creativity, you can create a customized humidifier tailored to your specific needs.


