To build an extremely reliable, Wi-Fi-controlled, and aesthetically pleasing Automated Humidifier Controller using the ESP8266, eliminating the common problems of relay chattering and sensor failure through smart safety logic.
| Feature | Impact | Status |
|---|---|---|
| 🌐 Offline Dominance | Full dashboard control without any active internet connection (zero dependency on Google APIs). | ✅ DONE |
| 🛡️ Fail-Safe Logic | Critical sensor errors automatically force the humidifier OFF, preventing accidental flooding or burnout. | ✅ DONE |
| 🧠 Intelligent Stability | Uses Hysteresis to stabilize switching behavior, maximizing relay life. | ✅ DONE |
| 🎨 Hyper-Responsive UI | Fast, dark-mode, mobile-friendly dashboard served instantly from the ESP8266's memory. | ✅ DONE |
| Component | Role | Pins Used (NodeMCU) |
|---|---|---|
| Microcontroller | ESP8266 | Wi-Fi Station/AP Mode, Web Server |
| Sensor | DHT22 | D2 (GPIO4): Humidity & Temp Data |
| Actuator | 1-Channel Relay | D1 (GPIO5): Humidifier Control (Active-LOW) |
| Output Device | Humidifier | Generates mist (Ultrasonic/USB Mist Maker) |
The device attempts to connect to your home Wi-Fi first (STA Mode). If credentials are not set or connection fails, it falls back to a self-created Access Point (AP).
| Mode | Network Name | Access IP | Access Requirement |
|---|---|---|---|
| STA Mode (Home Wi-Fi) | Your Router's SSID | 192.168.x.xxx |
Device must be on the same network. |
| AP Mode (Direct Link) | BDC_2.0 (Pass: ahmhabib01) |
192.168.4.1 |
No Internet Required. Connect directly to this network. |
Carefully connect the components as detailed below:
| Component Pin | ESP8266 Pin (GPIO) | Notes |
|---|---|---|
| DHT22 VCC | 3.3V | Power for the sensor. |
| DHT22 GND | GND | Ground connection. |
| DHT22 Data | D2 (GPIO4) | Sensor Data Input. |
| Relay VCC | VIN (5V) / VCC | Relay Coil Power Supply. |
| Relay GND | GND | Relay Ground. |
| Relay IN | D1 (GPIO5) | Control Signal from ESP. (Active-LOW Logic) |
|Humidifier Power (+) | Connect to Relay NO (Normally Open) terminal|
|Power Source (+) | Connect to Relay COM (Common) terminal|
|Humidifier Ground (-) | Connect directly to Power Source Ground (-)|
⚠️ Safety Note: Connect the humidifier's power line to the relay's Common (COM) and Normally Open (NO) terminals. Never connect high voltage while the ESP8266 is powered on.
- Open Arduino IDE and go to File > Preferences.
- Add the following URL to "Additional Boards Manager URLs":
http://arduino.esp8266.com/stable/package_esp8266com_index.json - Go to Tools > Board > Boards Manager... and search for
esp8266. Install the latest package. - Go to Sketch > Include Library > Manage Libraries... and install the following:
DHT sensor libraryby AdafruitAdafruit Unified Sensor
- Download and open humidity.ino with Arduino IDE
- Optional: Update the Wi-Fi credentials for STA Mode (if using your home network):
const char* ssid = "YOUR_HOME_WIFI_NAME"; const char* password = "YOUR_WIFI_PASSWORD";
- Select the correct board (e.g., NodeMCU 1.0) and Port under Tools.
- Click the Upload button (Right Arrow icon).
- Wait for the
Done uploading.message.
- Open the Serial Monitor (115200 Baud) and wait for the "IP Address" to be printed.
- Open a web browser (on a device connected to the relevant Wi-Fi network) and enter the IP address.
| Mode | Network Name | Access IP | Access Requirement |
|---|---|---|---|
| STA Mode (Home Wi-Fi) | Your Router's SSID | 192.168.x.xxx (Dynamic IP) |
Device must be on the same home network. |
| AP Mode (Direct Link) | BDC_2.0 (Pass: ahmhabib01) |
192.168.4.1 (Static IP) |
Connect directly to the BDC_2.0 network. |
💡 Tip: If the dashboard doesn't load in AP Mode, ensure your phone's Mobile Data is temporarily turned OFF.
Humidity Automation uses a
- Target (e.g., 65%): The ideal max humidity.
-
Humidifier ON: Only when Humidity
$\le$ $60%$ ($\text{Target} - 5%$ ). -
Humidifier OFF: Only when Humidity
$\ge$ $65%$ ($\text{Target}$ ).
- Developed By AHSAN HABIB
- CEO and ADMIN of BANGLADESH CYBER 2.0








