This circuit integrates various components controlled by an ESP32 microcontroller to perform a range of functions. The ESP32 is connected to input devices, output devices, and sensors, including a pushbutton, an I2C LCD screen, a relay module, an ultrasonic sensor, a soil moisture sensor module, a mini water pump, and multiple LEDs. The circuit is powered by a 5V battery and a 2x 18650 battery pack. The ESP32 reads inputs from the pushbutton and sensors to control the relay, which in turn controls the water pump, and to display information on the LCD screen. LEDs are used as status indicators.
D5
: Connected to the pushbutton.GND
: Common ground for the circuit.Vin
: Connected to the VCC of the I2C LCD screen, 5V relay, and HC-SR04 ultrasonic sensor.D14
, D27
, D26
, D25
, D32
: Connected to the anodes of various LEDs.D33
: Connected to the A0 pin of the YL-83 Module LM393.D12
: Connected to the TRIG pin of the HC-SR04 Ultrasonic Sensor.D13
: Connected to the ECHO pin of the HC-SR04 Ultrasonic Sensor.D22
: Connected to the SCL pin of the I2C LCD screen.D21
: Connected to the SDA pin of the I2C LCD screen.D4
: Connected to the In pin of the 5V relay.GND
: Connected to the common ground.VCC
: Connected to the 5V battery positive terminal.In
: Controlled by the ESP32 to switch the relay.Normally Open
: Connected to the VCC of the mini water pump.Common terminal
: Connected to the VCC of the 2x 18650 battery pack.SCL
: Connected to the D22 pin of the ESP32.SDA
: Connected to the D21 pin of the ESP32.VCC (5V)
: Powered by the Vin pin of the ESP32.GND
: Connected to the common ground.+
and -
: Interconnected between the YL-69 Sonda and YL-83 Module LM393.A0
: The analog output from the YL-83 Module LM393 to the D33 pin of the ESP32.GND
: Connected to the common ground.VCC
: Powered by the 5V battery positive terminal.VCC
: Powered by the Normally Open terminal of the 5V relay.GND
: Connected to the GND of the 2x 18650 battery pack.Pin 1 (in)
and Pin 2 (in)
: Connected to the D5 pin of the ESP32.Pin 3 (out)
and Pin 4 (out)
: Connected to the common ground.VCC
: Powered by the Vin pin of the ESP32.TRIG
: Connected to the D12 pin of the ESP32.ECHO
: Connected to the D13 pin of the ESP32.GND
: Connected to the common ground.vcc
: Connected to the Common terminal of the 5V relay.gnd
: Connected to the GND of the mini water pump.positive
: Connected to the VCC of the I2C LCD screen, 5V relay, and HC-SR04 ultrasonic sensor.negative
: Connected to the common ground.cathode
: Connected to the common ground.anode
: Connected to various GPIO pins on the ESP32 for status indication.void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
The code for the ESP32 microcontroller is currently a template with empty setup()
and loop()
functions. The setup()
function is intended to initialize the pins and peripherals, while the loop()
function will contain the main logic for reading sensors, controlling the relay, updating the LCD display, and managing LED states. The actual implementation will depend on the specific requirements of the circuit's operation.