ESP32-Based Automated Plant Watering System with Soil Moisture Sensing and RTC Scheduling
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit in question is designed to interface an ESP32 microcontroller with a DS1307 Real-Time Clock (RTC), a 1-Channel 5V Relay Module, and a Soil Moisture Sensor. The ESP32 serves as the central processing unit, controlling the relay based on the time from the RTC or the data from the Soil Moisture Sensor. The relay can be used to control an external device, such as a water pump or an electric valve for irrigation purposes. The Soil Moisture Sensor provides feedback on the moisture level of the soil, which can be used to make decisions about watering plants.
Component List
ESP32 38 PINS
- Description: A microcontroller with Wi-Fi and Bluetooth capabilities, featuring a wide range of GPIO pins.
- Pins: GND, 23, 22/SCL, 1, 2, 21/SDA, 19, 18, 5, 17/TX2, 16/RX2, 4, 0, 15, D1, D0, CLK, 3V3, EN, VP, VN, 34, 35, 32, 33, 25, 26, 27, 14, 12, 13, D2, D3, 11, 5V/VIN
1 Channel 5V Relay Module
- Description: A relay module that can be used to control high power devices, with one normally open (N.O.) and one normally closed (N.C.) contact.
- Pins: VCC+, VCC- (GND), IN, N.O., COM, N.C.
DS1307 RTC (Wokwi Compatible)
- Description: A real-time clock module for keeping track of the current time and date.
- Pins: GND, 5V, SDA, SCL, SQW
Soil Moisture Sensor
- Description: A sensor that measures the moisture level in the soil.
- Pins: VCC, GND, SIG
Wiring Details
ESP32 38 PINS
- 5V/VIN connected to the 5V power supply lines of the Relay Module, Soil Moisture Sensor, and DS1307 RTC.
- GND connected to the ground lines of the Relay Module, Soil Moisture Sensor, and DS1307 RTC.
- Pin 5 connected to the IN pin of the Relay Module to control it.
- Pin 21/SDA connected to the SDA pin of the DS1307 RTC for I2C communication.
- Pin 22/SCL connected to the SCL pin of the DS1307 RTC for I2C communication.
- Pin 2 connected to the SIG pin of the Soil Moisture Sensor to read the moisture level.
1 Channel 5V Relay Module
- VCC+ connected to the 5V power supply from the ESP32.
- VCC- (GND) connected to the ground line from the ESP32.
- IN controlled by pin 5 of the ESP32.
DS1307 RTC (Wokwi Compatible)
- GND connected to the ground line from the ESP32.
- 5V connected to the 5V power supply from the ESP32.
- SDA connected to pin 21/SDA of the ESP32 for I2C communication.
- SCL connected to pin 22/SCL of the ESP32 for I2C communication.
Soil Moisture Sensor
- VCC connected to the 5V power supply from the ESP32.
- GND connected to the ground line from the ESP32.
- SIG connected to pin 2 of the ESP32 to output the moisture level.
Documented Code
No code was provided for the microcontroller. To fully utilize this circuit, embedded code for the ESP32 is required to initialize and manage I2C communication with the DS1307 RTC, read the moisture level from the Soil Moisture Sensor, and control the Relay Module based on the logic defined by the user. The code would typically include setup routines, a main loop, and possibly interrupt service routines if real-time clock alarms or other asynchronous events are used.