ESP32-Based Automated Plant Watering System with Environmental Monitoring
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 power a 5V mini water pump and a 40mm 12V fan. The system status is displayed on a 1.3" OLED display module. The circuit is powered by a 12V battery, and the ESP32 is interfaced with various components through its GPIO pins.
Component List
- Battery 12V: Provides the power source for the circuit.
- SparkFun Soil Moisture Sensor: Measures the moisture level in the soil.
- ESP32 (30 pin): Acts as the central microcontroller unit to process sensor data and control peripherals.
- USB Cable: Used to program the ESP32 and provide a serial communication interface.
- 5V Mini Water Pump: Pumps water when activated by the relay.
- 2-Channel Relay: Controls the power to the water pump and the fan.
- 1.3" OLED Display Module: Displays sensor readings and system status.
- 40mm Fan 12V: Provides air circulation when activated by the relay.
- DHT11 Humidity and Temperature Sensor: Measures ambient humidity and temperature.
Wiring Details
Battery 12V
+to 40mm Fan 12V+12V-to 40mm Fan 12V-12V, ESP32GND
SparkFun Soil Moisture Sensor
VCCto ESP323V3GNDto ESP32GNDSIGto ESP32D34
ESP32 (30 pin)
GNDto 40mm Fan 12V-12V, DHT11 SensorGND, SparkFun Soil Moisture SensorGND, 2-Channel RelayGND, 1.3" OLED Display ModuleGND, 5V Mini Water Pumpnegative pinVinto 40mm Fan 12V+12V3V3to DHT11 SensorVDD, SparkFun Soil Moisture SensorVCC, 2-Channel RelayVCC, 1.3" OLED Display ModuleVCCD34to SparkFun Soil Moisture SensorSIGD32to 1.3" OLED Display ModuleCLKD33to 1.3" OLED Display ModuleMOSID25to 1.3" OLED Display ModuleRESD27to 1.3" OLED Display ModuleDCD14to 1.3" OLED Display ModuleCSD23to 2-Channel RelayIN1D22to 2-Channel RelayIN2D15to DHT11 SensorDATA
5V Mini Water Pump
positive pinto 2-Channel RelayNOnegative pinto ESP32GND
2-Channel Relay
NC(Not Connected)COM(Common connection for relay switches)NOto 5V Mini Water Pumppositive pinVCCto ESP323V3IN1to ESP32D23IN2to ESP32D22GNDto ESP32GND
1.3" OLED Display Module
CSto ESP32D14GNDto ESP32GNDVCCto ESP323V3CLKto ESP32D32MOSIto ESP32D33RESto ESP32D25DCto ESP32D27
40mm Fan 12V
+12Vto Battery 12V+-12Vto ESP32GND
DHT11 Humidity and Temperature Sensor
VDDto ESP323V3DATAto ESP32D15GNDto ESP32GND
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 provided code for the microcontrollers is a template and does not contain any functional code. It needs to be implemented according to the circuit's requirements.