Indoor/Outdoor Plant Watering System
project using ESP32 & solar
In this IoT internet of things project, I have shown how to make the IoT-
based indoor plant watering system using ESP32 Blynk and a soil moisture
sensor.
The ESP32 will control the water pump automatically as per the soil
moisture level. You can control and monitor the moisture level, and
temperature from anywhere in the world on Blynk IoT.
So if you follow all the steps, you can easily make this IoT-based plant
monitoring system using ESP32 and Blynk app.
Required Components for Plant Watering System
UMT student project
ESP32 DEV KIT V1
Capacitive soil moisture sensor V2.0
DHT11 Sensor
0.96″ OLED Display
1k 0.25watt Resistors (R1-R6) – 6 no
1N4007 diode
BC547 NPN Transistor
TIP122 NPN Transistor with heat sink
LEDs 5mm – 4no
7805 voltage regulator with heat sink
2-pin Push Button – 2no
2-pin Terminal connectors (2 no)
3-pin Terminal connectors (1 no)
5V DC Buzzer
100uF 25V capacitor (C1)
100nF 330nF AC capacitors (C1, C2)
12V DC pump or solenoid valve
12VDC Supply
Circuit of IoT Based Indoor Plant Watering System
In the circuit, you have to give a stable 12V DC supply. The amps rating of
the power supply will depend on the pump or solenoid valve current rating.
A 7805 voltage regulator is used to provide the 5V supply to ESP32, and the
3.3V supply is given to OLED and capacitive moisture sensor from ESP32
3.3V pin.
To control the pump we have used a TIP122 NPN transistor which is
connected with the GPIO D25.
Please refer to the following table for ESP32 GPIO used in this circuit.
ESP32 GPIOs Connected Sensors/Components
D34 Capacitive moisture sensor AOUT pin
D32 Push-Button to turn ON/OFF pump
D33 Push-Button for changing MODE.
D25 TIP122 base pin (controlling pump)
D26 BC547 base pin (controlling Buzzer)
D14 DHT11 sensor O/P pin
D15 LED indicator for MODE
D2 LED indicator for WiFi
D21 SDA of OLED
D22 SCL of OLED
If you want to use a 12V solenoid valve to control the water, then refer to
the following circuit.
Please use heat sinks with TIP122 and 7805 voltage regulator.
PCB Layout for ESP32 Plant Monitoring System
See this digram to solder zeroboard PCB
g
Set up Blynk IoT Cloud for the ESP32 Project
You can refer to the following article to set up the new Blynk cloud
account.
Create Blynk Template
During creating the template, I selected ESP32 as the hardware and the
connection type as WiFi.
In the template, I have created the first Datastreams (Pin: V1, Datatype:
Integer, Min Value: 0, Max Value: 100) to show the moisture level in
percentage.
The next two Datastreams (Pin: V2 & V3, Datatype: Integer) will show the
Temperature and Humidity reading from the DHT11 sensor.
Forth Datastream (Pin: V4, Datatype: Integer, Min Value: 0, Max Value: 1,
Default Value: 1) is for changing the MODE.
Fifth Datastream (Pin: V5, Datatype: Integer, Min Value: 0, Max Value: 1,
Default Value: 0) is for manually controlling the pump
Create Web Dashboard in Blynk Cloud
After that, click and drag 1 Gauge widget, 2 Level widgets, and 2 Switch
widgets and select the related Datastreams for each widget.
Then click on “Save” to save the template.
Add Device in Blynk Cloud using Template
You can refer to the following article to add a device to the Blynk cloud
Now open the Blynk IoT App and tap on the device name
.
Then add 1 Gauge widget, 2 Leveled Value widgets, and 2 Button
widgets from Widget Box.
1. Tap on the Gauge widget and select Datastream “Moisture” with V1.
2. Tap on the first Leveled Value widget and select Datastream
“Temperature” with V2.
3. Tap on the second Leveled Value widget and select Datastream
“Humidity” with V3.
4. Tap on the first Button widget and select Datastream “Mode” (V4) and
MODE “Switch“.
5. Tap on the second Button widget and select Datastream “Water” (V5)
and MODE “Switch“.
Source Codes for Blynk ESP32 Plant Monitoring
System
Program ESP32 with Arduino IDE
For this IoT-based project, I have used the Arduino IDE to program ESP32.
First update the Preferences –> Aditional boards Manager
URLs: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-
pages/package_esp32_dev_index.json,
http://arduino.esp8266.com/stable/package_esp8266com_index.json
Then install the ESP32 board (2.0.5) from the Board
manager or Click Here to download the ESP32 board.
Download the required libraries from the following links:
o Blynk Library (Version 1.1.0)
o AceButton Library (Version 1.9.2)
o Adafruit_SSD1306 Library (Version 2.5.7)
o Adafruit Unified Sensor Library (Version 1.1.7)
o DHT Library (Version 1.4.4)
Get Sensor reading for the DRY & WET soil
To get the MIN & MAX moisture reading from the sensor, first, upload the
following code to ESP32
Connect the Moisture Sensor AOUT pin with D34 and supply 3.3V across
VCC and GND.
Then open the serial monitor with baud rate 115200.
Note the MAX value when the sensor is dry, then dip the sensor into water
and note the MIN value.
Save these two values.
Now open the main sketch in Arduino IDE. and update the following values.
Blynk AUTH code and template details
WiFi Name and Password.
Update the MAX value when the sensor is dry, and the MIN value for the
wet soil.
With these two readings, we will calculate the moisture percentage.
After doing these changes, please upload the code to ESP32
Connect the Pump & Sensors with PCB
Water
pump
Now connect the sensors, OLED, Pump, and 5V Buzzeras per the above
diagram.
Here I have a 12V 2A DC supply, you have to use the power supply as per
the pump amps rating.
Testing the DIY Plant Watering circuit
Before connecting the solenoid valve with the pipeline, I will recommend
you to test the circuit for Dry and Wet soil scenarios.
If everything works fine, connect the solenoid valve with the main water
pipeline of the drip irrigation system.
Now your plants will get water automatically whenever needed.
Extra component /senser add
same as well also more senser in this project like fire senser or rain senser
to detect rain out side and then send you a message on blynk app and send
mail “its raining”.