ESP32-Based Automated Plant Watering System with OLED Display
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to monitor soil moisture levels and control a water pump and a fan based on the sensor readings. It uses an ESP32 microcontroller to read data from a SparkFun Soil Moisture Sensor and a DHT11 Humidity and Temperature Sensor. The ESP32 also controls a 2-channel relay to switch a 5V mini water pump and a 12V fan. The system status is displayed on a 1.3" OLED display module. The circuit is powered by a 12V battery.
Component List
Battery 12V
- A 12V battery provides power to the circuit.
SparkFun Soil Moisture Sensor
- Measures the moisture level in the soil.
ESP32 (30 pin)
- The main microcontroller that processes sensor data and controls other components.
USB Cable
- Used for programming the ESP32 and potentially for power supply.
5V Mini Water Pump
- Activated by the ESP32 to water the soil when moisture levels are low.
2-Channel Relay
- Controls the power to the water pump and the fan.
1.3" OLED Display Module
- Displays the sensor readings and system status.
40mm Fan 12V
- Used to circulate air or cool down the environment if needed.
DHT11 Humidity and Temperature Sensor
- Measures the ambient temperature and humidity.
Wiring Details
Battery 12V
+connected to ESP32 Vin and 40mm Fan +12V-connected to ESP32 GND, 40mm Fan -12V, and common ground net
SparkFun Soil Moisture Sensor
VCCconnected to ESP32 3V3GNDconnected to common ground netSIGconnected to ESP32 D34
ESP32 (30 pin)
GNDconnected to common ground netVinconnected to Battery 12V +D34connected to SparkFun Soil Moisture Sensor SIGD32connected to 1.3" OLED Display Module CLKD33connected to 1.3" OLED Display Module MOSID25connected to 1.3" OLED Display Module RESD27connected to 1.3" OLED Display Module DCD14connected to 1.3" OLED Display Module CSD23connected to 2-Channel Relay IN1D22connected to 2-Channel Relay IN2D15connected to DHT11 Humidity and Temperature Sensor DATA3V3connected to SparkFun Soil Moisture Sensor VCC, DHT11 VDD, 2-Channel Relay VCC, and 1.3" OLED Display Module VCC
5V Mini Water Pump
positive pinconnected to 2-Channel Relay NOnegative pinconnected to common ground net
2-Channel Relay
NCnot connectedCOMnot connectedNOconnected to 5V Mini Water Pump positive pinVCCconnected to ESP32 3V3IN1connected to ESP32 D23IN2connected to ESP32 D22GNDconnected to common ground net
1.3" OLED Display Module
CSconnected to ESP32 D14GNDconnected to common ground netVCCconnected to ESP32 3V3CLKconnected to ESP32 D32MOSIconnected to ESP32 D33RESconnected to ESP32 D25DCconnected to ESP32 D27
40mm Fan 12V
+12Vconnected to Battery 12V +-12Vconnected to common ground net
DHT11 Humidity and Temperature Sensor
VDDconnected to ESP32 3V3DATAconnected to ESP32 D15NULLnot connectedGNDconnected to common ground net
Documented Code
ESP32 Microcontroller Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
2-Channel Relay Microcontroller Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Note: The actual functionality of the microcontrollers will be defined in the code, which is not provided in detail here. The code snippets above are placeholders and need to be completed with the logic for reading sensors, controlling the relay, and updating the display.