How to Build a Portable Humidifier Using Arduino

Publisher:明理厚德Latest update time:2023-06-06 Keywords:Arduino Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

A humidifier is a device used to increase the relative humidity in an enclosed area to ensure that there is enough moisture in the area. Especially in winters, when the heater is turned on, it causes the relative humidity of the air to decrease. In this DIY project, we will build an automatic humidifier which can maintain the relative humidity of the atmospheric air through a sensor mechanism. We are also using a display to display the relative humidity (RH) in the form of percentage of moisture in the air. Along with Arduino and LCD, we are also using a DHT11 sensor to read the atmospheric humidity value. If it finds that the relative humidity is below the required limit, it turns on the humidifier and vice versa.


Components Needed to Build a Portable Humidifier

Ultrasonic humidifier

Arduino Nano

5V Relay

7805

25V, 1000uf electrolytic capacitor

12V, 2 AMP AC-DC Adapter

DHT11 Sensor

USB female socket

Performance Board

Connection lines

How Portable Humidifiers Work

A portable humidifier can produce warm/cool mist by using a metal diaphragm that vibrates at high frequencies. The sound vibrations push moisture into the air. The mist produced in the humidifier is absorbed by the air almost instantly. The humidifier needs to float on a bed of water in order to produce mist. The working principle of the humidifier we are going to build can be understood by the block diagram below:

poYBAGLhB86AARFqAADYrXfRxAM899.png

As shown in the block diagram above, the ultrasonic humidifier is placed on the water surface inside the container. The humidifier floats on the water surface. Since we need to sense the humidity, a DHT11 humidity sensor is connected with the Arduino Nano and an OLED display is connected to display the real-time value. Also, based on the humidity value, we need to trigger the relay which in turn switches the humidifier to ON/OFF. Therefore, the humidifier value is compared with the reference value and the humidifier is turned on/off based on the humidity value. The main features of this dehumidifier are as follows:

Type: Floating/Ultrasonic

Power supply: USB, 5V DC

Working current: 500Ma

Noise level: ≤36db

Portable humidifier circuit diagram

The complete schematics for building a DIY humidifier using Arduino are given here:

pYYBAGLhB8mAJ0DbAAImRZSI6lQ743.png

Let's understand the circuit diagram in detail. As shown in the diagram, the 12V DC power is first converted to 5V DC power using 7805 regulator and capacitor filter. This power is then provided to the Arduino Nano, OLED, DHT11 and relay circuit. The data pin of DHT11 is connected to the digital input pin of Arduino as shown and configured in the code. The OLED display is connected to the Arduino through the I2C pins i.e. A4, A5 pins of Arduino. Similarly, the digital output pin of Arduino is connected to the Relay and BJT for DC fan drive.

Solder components on the Perfboard:

To make the project setup mobile and more compatible, I soldered all the components on a perfboard as shown below:

poYBAGLhB8mABqoCAAOq8yt420c114.png

Programming the Humidifier with Arduino Nano

After completing the hardware connections successfully as per the circuit diagram, now it is time to flash the code into Arduino. The complete code is given at the end of the document. Here we explain the entire code line by line.

So, the first step is to include the entire required libraries in your code, i.e., “SoftwareSerial.h”, “wire.h”, “Adafruit_SH1106.h” and “DHT.h” in this project. “SoftwareSerial.h” and “wire.h” are in-built, “Adafruit_SH1106.h” can be downloaded from this link and “DHT.h” can be downloaded from this link.

#include

#include

#include

#include "DHT.h"


Then, define the OLED I2C address, which can be OX3C or OX3D, in my case it is OX3C. Usually, the address of a 1.3" OLED is OX3C. Also, the reset pin of the display must be defined. In my case it is defined as -1 because the display shares the reset pin of the Arduino.



#define OLED_ADDRESS 0x3C

#define OLED_RESET -1

Adafruit_SH1106 display(OLED_RESET);


Now, an object is declared in the DHT class type, which can be used throughout the code.



DHT dht;

International humidity = 0;


In setup(), we know that we need to initialize the serial communication, OLED display initialization, etc. Here, for software serial communication, the default baud rate is defined as 9600. Here SH1106_SWITCHCAPVCC is used to power from 3.3V internally and display.begin function is used to initialize the display.



void setup()

{

Serial.Start(9600);

dht.setup(2);

pinMode(6, OUTPUT);

pinMode(11, OUTPUT);

display.begin(SH1106_SWITCHCAPVCC, OLED_ADDRESS);

display.clearDisplay();

}


To read the humidity value from the sensor, use the getHumidity() function and store it in a variable. Then display it on the OLED using the corresponding functions for selecting the text size and cursor position as shown below.



delay(dht.getMinimumSamplingPeriod());

humidity = dht.getHumidity();

display.setTextSize(1);

display.setTextColor(white);

display.setCursor(27, 2);

display.print("Circuit Abstract");

display.setTextSize(1);

display.setCursor(35, 20);

display.print("Humidity(%)");

display.show();

display.setTextSize(2);

display.setCursor(55, 40);

display.print(humidity);

display.show();

delay(50);

display.clearDisplay();


Finally, to trigger the humidifier, the humidity value is compared with the reference humidity level, and if it falls below the reference humidity level, the relay is triggered, turning on the humidifier and the fan.



If (humidity < 88)

{

digitalWrite(6,HIGH);

digitalWrite(11,HIGH);

}

else

{

digitalWrite(6,LOW);

digitalWrite(11,LOW);

}

}


Testing a Portable Humidifier


Once the code and hardware are ready, we can test the performance of the humidifier in a closed room. To do this, follow these steps:


Fill the container no more than 3/4 full with fresh water and float the humidifier on the container as shown below:

poYBAGLhB7-ADPhSAAO3XGJ43Ko904.png

Turn on the adapter power to turn on the circuit, and we should now see the humidity level on the OLED.

Then, if the humidity level falls below the reference value, the humidifier should start producing mist and the fan should be turned on.

pYYBAGLhB7yAVlt3AAO-NfhPp88961.png

The complete working principle of this homemade humidifier is also explained in the video given at the end of the document. If you have any questions, you can leave them in the comment section below.

Code

#include "SoftwareSerial.h"

#include 《Wire.h》

#include "Adafruit_SH1106.h"

#define OLED_ADDRESS 0x3C

#define OLED_RESET -1

Adafruit_SH1106 display(OLED_RESET);

#include "DHT.h"

DHT dht;

International humidity = 0;

void setup()

{

Sequence.Start(9600);

dht.setup(2);

pinMode(6, OUTPUT);

pinMode(11, OUTPUT);

display.begin(SH1106_SWITCHCAPVCC, OLED_ADDRESS);

display.clearDisplay();

}

void loop()

{

delay(dht.getMinimumSamplingPeriod());

Humidity = dht.getHumidity();

display.setTextSize(1);

display.setTextColor(white);

display.setCursor(27, 2);

display.print("Circuit Digest");

display.setTextSize(1);

display.setCursor(35, 20);

display.print("Humidity (%)");

display.show();

display.setTextSize(2);

display.setCursor(55, 40);

display.print(humidity);

display.show();

delay(50);

display.clearDisplay();

If (humidity <85)

{

digitalWrite(6,HIGH);

digitalWrite(11,HIGH);

}

else

{

digitalWrite(6,LOW);

digitalWrite(11,LOW);

}

}


Keywords:Arduino Reference address:How to Build a Portable Humidifier Using Arduino

Previous article:How to Make a Touch Capacitive Piano Using Arduino
Next article:Hi3531DV200's excellent performance in video encoding and decoding

Recommended ReadingLatest update time:2024-11-16 23:48

Is microcontroller programming easy? Why is Arduino not suitable for college students?
Rduino is essentially a microcontroller, and its programming language is basically the same as the microcontroller, using the C language. But why do many people think that microcontroller programming is much more difficult than Arduino? The reason is that microcontroller programming and development is relatively low-l
[Microcontroller]
Arduino implementation of 8*8LED dot matrix display of love
Before Chinese Valentine's Day, I used Raspberry Pi to experiment with an 8*8 LED dot matrix displaying a heart pattern. In fact, this function is more suitable for Arduino. Apart from the cost factor, the Raspberry Pi implementation relies on an infinite loop. I paid attention to the CPU usage rate, which may rise to
[Microcontroller]
Use Arduino as AVRISP burner Arduino to burn boot to Arduino
This tutorial shows how to use an Arduino as an AVR ISP (In-System Programmer). You can use it to program a bootloader to other AVR chips (such as Arduinos using the ATmega168 or ATmega328). The code in this example is based on the mega-isp firmware written by Randall Bohn. Instructions for using your Arduino to prog
[Microcontroller]
Use Arduino as AVRISP burner Arduino to burn boot to Arduino
How to Record and Play a 3D Printed Robotic Arm Using Arduino
Robotic arms have proven to be very useful and more efficient in many applications that require speed, accuracy, and safety. But more importantly for me, these things look cool while they work. I have always wished for a robotic arm to help me with my daily tasks, just like the Dum-E and Dum-U that Tony Stark uses i
[robot]
AVR Development Arduino Method (Part 2) Interrupt Subsystem
Before understanding the interrupt subsystem, we must first understand the concept of interrupts. You are reading a book and the phone rings. What will you do? I believe most people will do this: mark the position you are reading first, and then continue reading after answering the phone. This is an example of an inte
[Microcontroller]
Arduino Pro and Bosch Sensortec team up to launch Nicla Sense ME
Arduino Pro and Bosch Sensortec have teamed up to launch Nicla Sense ME , making edge sensing and edge intelligence accessible to everyone. Arduino's smallest application board to date is ready to sense the world: the first product in the new Nicla series perfectly combines the latest technology with easy-to
[sensor]
Arduino Pro and Bosch Sensortec team up to launch Nicla Sense ME
AVR Development Arduino Method (VI) Memory Subsystem
The Arduino UNO R3 main processor ATMega328P has three types of memory inside the chip: data memory, program memory and electrically erasable programmable memory; each of them has different uses. 1. Data storage The data memory is a 2KB static random access memory (SRAM). Part of the space is allocated to general regi
[Microcontroller]
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号