ESP32-Based Environmental Monitoring System with DHT22 Sensor and Relay Control
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary of the Circuit
The circuit in question appears to be a sensor and control system utilizing an ESP32 Wroom microcontroller as the central processing unit. The ESP32 is interfaced with a DHT22 temperature and humidity sensor, a 5V relay for controlling external loads, and an OLED display for user interface and data display. The ESP32 Wroom provides power to the DHT22 and OLED display, and it controls the relay through one of its GPIO pins. The OLED display is connected to the ESP32 via I2C communication protocol, using dedicated SCL and SDA pins on the microcontroller.
Component List
DHT22
- Description: A temperature and humidity sensor with a digital output.
- Pins:
+,Out,-
Relay 5v
- Description: An electromechanical switch that can be controlled with a low voltage signal to switch higher power loads.
- Pins:
Normally Open,Common,Normally Closed,VCC,IN,GND
Oled
- Description: An organic light-emitting diode display for visual output.
- Pins:
VCC,GND,SCL,SDA
ESP32 Wroom
- Description: A powerful microcontroller with Wi-Fi and Bluetooth capabilities, suitable for a wide range of applications.
- Pins: Multiple GPIOs,
3V3,GND,5V,Reset, and dedicated pins for serial communication and I2C.
Wiring Details
DHT22
+connected to ESP32 Wroom3V3Outconnected to ESP32 WroomGPIO32-connected to ESP32 WroomGND
Relay 5v
VCCconnected to ESP32 Wroom5VINconnected to ESP32 WroomGPIO33GNDconnected to ESP32 WroomGND
Oled
VCCconnected to ESP32 Wroom5VGNDconnected to ESP32 WroomGNDSCLconnected to ESP32 WroomGPIO22/SCLSDAconnected to ESP32 WroomGPIO21/SDA
ESP32 Wroom
3V3provides power to DHT22GPIO32receives data from DHT22GPIO33controls Relay 5vGNDis a common ground for DHT22, Relay 5v, and Oled5Vprovides power to Relay 5v and OledGPIO22/SCLandGPIO21/SDAare used for I2C communication with Oled
Documented Code
No code has been provided for the microcontroller. To fully utilize the circuit, embedded code for the ESP32 Wroom is required to read data from the DHT22 sensor, control the relay, and display information on the OLED screen. The code would typically initialize the sensor and display, read sensor values at regular intervals, control the relay based on sensor readings or external inputs, and update the display with the current status or sensor data.
Since no code is available, it is recommended to develop firmware that includes the following functionalities:
- Initialization of the DHT22 sensor and OLED display.
- Periodic reading of temperature and humidity data from the DHT22 sensor.
- Logic to control the relay based on sensor data or predefined conditions.
- Displaying the sensor data and system status on the OLED screen.
- Error handling and communication routines for robust operation.
The code should be written in a programming language compatible with the ESP32, such as C/C++ using the Arduino framework or using the Espressif IoT Development Framework (ESP-IDF).