ESP32-Based Smart Irrigation System with Soil Moisture Sensor and Water Pump
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to monitor soil moisture and control a water pump based on the readings. It uses an ESP32 microcontroller to read data from a DHT22 temperature and humidity sensor and a SparkFun Soil Moisture Sensor. The ESP32 also controls a water pump. Power is supplied through a 3.7V battery pack managed by a Battery Management System (BMS) and a Buck converter to step down the voltage.
Component List
ESP32 38 PINS
- Description: A versatile microcontroller with Wi-Fi and Bluetooth capabilities.
- Pins: GND, G23, G22, TXD, RXD, G21, G19, G18, G5, G17, G16, G4, G0, G2, G15, SDI, SD0, CLK, 3V3, EN, SP, SN, G34, G35, G32, 33, G25, G26, G27, G14, G12, G13, SD2, SD3, 5V
DHT22
- Description: A temperature and humidity sensor.
- Pins: +, Out, -
SparkFun Soil Moisture Sensor
- Description: A sensor to measure soil moisture levels.
- Pins: VCC, GND, SIG
Water Pump
- Description: A small water pump for irrigation.
- Pins: positive, negative
Buck Converter
- Description: A DC-DC converter to step down voltage.
- Pins: IN+, IN-, OUT+, OUT-
Rocker Switch (SPST)
- Description: A single-pole single-throw switch.
- Pins: 1, 2
Power Jack
- Description: A jack for connecting an external power source.
- Pins: POSITIF, NEGATIF
2.1mm DC Barrel Jack
- Description: A standard DC barrel jack.
- Pins: switch, sleeve, center
3.7V Battery
- Description: A 3.7V lithium-ion battery.
- Pins: +, -
BMS
- Description: A Battery Management System for managing multiple 3.7V batteries.
- Pins: B+, B2, B1, B-, P-, P+
Wiring Details
ESP32 38 PINS
- G13 connected to SIG of SparkFun Soil Moisture Sensor
- GND connected to:
- - of DHT22
- OUT- of Buck Converter
- GND of SparkFun Soil Moisture Sensor
- negative of Water Pump
- 5V connected to:
- + of DHT22
- OUT+ of Buck Converter
- VCC of SparkFun Soil Moisture Sensor
- G5 connected to positive of Water Pump
- G35 connected to Out of DHT22
DHT22
- - connected to GND of ESP32
- + connected to 5V of ESP32
- Out connected to G35 of ESP32
SparkFun Soil Moisture Sensor
- SIG connected to G13 of ESP32
- GND connected to GND of ESP32
- VCC connected to 5V of ESP32
Water Pump
- positive connected to G5 of ESP32
- negative connected to GND of ESP32
Buck Converter
- IN+ connected to 1 of Rocker Switch
- IN- connected to NEGATIF of Power Jack
- OUT+ connected to 5V of ESP32
- OUT- connected to GND of ESP32
Rocker Switch (SPST)
- 1 connected to IN+ of Buck Converter
- 2 connected to POSITIF of Power Jack
Power Jack
- POSITIF connected to 2 of Rocker Switch
- NEGATIF connected to IN- of Buck Converter
3.7V Battery
- + connected to B+ of BMS
- - connected to + of another 3.7V Battery
- + of another 3.7V Battery connected to B2 of BMS
- - of another 3.7V Battery connected to + of another 3.7V Battery
- - of another 3.7V Battery connected to B- of BMS
BMS
- B+ connected to + of 3.7V Battery
- B2 connected to - of 3.7V Battery and + of another 3.7V Battery
- B1 connected to - of another 3.7V Battery and + of another 3.7V Battery
- B- connected to - of another 3.7V Battery
- P- connected to sleeve of 2.1mm DC Barrel Jack
- P+ connected to center of 2.1mm DC Barrel Jack
2.1mm DC Barrel Jack
- sleeve connected to P- of BMS
- center connected to P+ of BMS
Documented Code
sketch.ino
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
documentation.txt