Building a Smart Cooling System with ESP8266 and DHT11 Sensor

ESP8266 23-10-25
10 0

Tutorial plan

1- Objective of the tutorial

2- Operation of the cooling system

3- The necessary components

4- Cooling system installation

5- Program ESP8266 NodeMCU with MicroPython

 

Objective of the tutorial

The aim of this tutorial is to develop a smart cooling system using the ESP8266 NodeMCU microcontroller, a DHT11 temperature and humidity sensor, a relay module, a 5V fan, and an LCD I2C display.

The system continuously monitors the ambient temperature through the DHT11 sensor and automatically activates or deactivates the fan via the relay module to maintain optimal cooling conditions.

The measured temperature and fan status are displayed on the LCD screen in real time.

 

Operation of the cooling system

The smart cooling system operates automatically based on the temperature readings from the DHT11 sensor. The ESP8266 NodeMCU continuously collects the temperature and humidity data from the sensor and compares the measured temperature with a predefined threshold value.

1- When the temperature exceeds the threshold (for example, 30 °C), the ESP8266 sends a signal to the relay module to activate the 5V fan. The fan starts running to cool down the environment.

2- As the temperature drops below the threshold, the ESP8266 deactivates the relay, which turns off the fan to save energy.

3- Throughout the process, the LCD I2C screen displays real-time information such as the current temperature, humidity, and the fan’s status (ON or OFF).

This automatic control provides an efficient and energy-saving way to maintain a stable temperature without requiring manual intervention.

 

The necessary components

1- ESP8266 NodeMCU

It Serves as the main microcontroller that processes the temperature data from the DHT11 sensor and controls the relay and fan accordingly.

It Provides built-in Wi-Fi capability for future IoT extensions if desired.

2- DHT11 Temperature and Humidity Sensor

It Measures the ambient temperature and humidity.

It ends the measured data to the ESP8266 for decision-making.

3- Relay Module (5V)

It acts as an electronic switch that allows the ESP8266 (low-voltage logic) to control the operation of the 5V fan.

It ensures electrical isolation between the microcontroller and the fan.

4- 5V DC Fan

It is used to cool down the environment when the temperature rises above the predefined limit.

It is controlled automatically through the relay module.

5- LCD I2C Display (16x2)

It displays the current temperature, humidity, and fan status (ON/OFF).

The I2C interface reduces the number of pins required for connection with the ESP8266.

6- Breadboard

plaque d'essai

It is used for prototyping the circuit without soldering.

Allows easy insertion and connection of components.

7- Jumper Wires

Fils de connexion

They ensure electrical connections between the ESP8266, sensor, buzzer, LED, and LCD display.

 

Cooling system installation

Attaching the I2C LCD Display :

- connect the VCC pin of the display to 5V pin of the ESP8266

- connect the GND pin of the display to GND pin of the ESP8266

- connect the SDA pin of the display to D2 (GPIO4) pin of the ESP8266

- connect the SCL pin of the display to D1 (GPIO5) pin of the ESP8266

Attaching the DHT11 Sensor:

- connect the VCC(+) pin of the DHT11 Sensor to 3V pin of the ESP8266

- connect the GND(-) pin of the DHT11 to GND pin of the ESP8266

- connect the DATA pin of the DHT11 to D0 (GPIO16) of the ESP8266

Attaching the relay module:

- connect the VCC(+) pin of the relay to 3V pin of the ESP8266

- connect the GND(-) pin of the relay to GND pin of the ESP8266

- connect the DATA pin of the DHT11 to D5 (GPIO14) of the ESP8266

- connect the COM pin of the DHT11 to VIN(5V) of the ESP8266

Attaching the fan:

- Connect the red (+) wire from the fan to the ON pin of the relay.

- Connect the black wire (-) from the fan to the GND pin of the ESP8266 board.

Program ESP8266 NodeMCU with MicroPython

Ensure you have the necessary libraries installed: dht, 'i2c_lcd' and 'lcd_api' for I2C LCD Screen.

 

The Micropython program reads temperature and humidity values from the DHT11 sensor, displays them on the LCD screen, and automatically switches the fan on or off according to the set temperature limit.

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info