|
Water pump |
x 1 | |
|
Soil moisture sensor |
x 1 | |
|
RGB LED |
x 1 | |
|
Breadboard |
x 1 | |
|
Power Bank |
x 1 | |
|
Raspberry Pi Pico |
x 1 |
Automatic Plant Watering System using Raspberry Pi Pico
Here, We are going to make an Automatic Watering System using Raspberry Pi Pico, which waters the plant every 8 hours or depending on the soil moisture level. Let's see how I made it.
Hardware Components
1. Raspberry Pi Pico x 1 - https://www.dfrobot.com/product-2187.html?tracking=qlFCvkDilNCTmTOSEGHNIxeqgaQGOp3SZCnaR13VZAG86M3mWPrLMfa9i9kvCzRL
2. Water pump x 1 - https://www.dfrobot.com/product-1710.html?tracking=qlFCvkDilNCTmTOSEGHNIxeqgaQGOp3SZCnaR13VZAG86M3mWPrLMfa9i9kvCzRL
3. Soil Moisture Sensor x 1 - https://www.dfrobot.com/product-599.html?tracking=qlFCvkDilNCTmTOSEGHNIxeqgaQGOp3SZCnaR13VZAG86M3mWPrLMfa9i9kvCzRL
4. RGB LED x 1
5. Breadboard x 1
6. Power bank x 1
Software Components
1. MicroPython
2. Thonny IDE
STEP 1 - Setting up Raspberry Pi Pico
1. Download the micropython firmware from https://micropython.org/download/rp2-pico/
2. On the Raspberry Pi Pico, Press the BOOTSEL button and hold it while you connect the other end of the micro USB cable to your computer. This puts your Raspberry Pi Pico into USB mass storage device mode.
3. Drag and drop the downloaded .uf2 firmware
Now the Raspberry Pi Pico is ready to be programmed. Open Thonny IDE, select the interpreter as MicroPython(Raspberry PI Pico).
STEP 2 - Connections
You can find the Pinout of the Raspberry Pi Pico below.
Make the connections as shown below.
We have an internal RTC to get the time. Here we connect Water Pump, Soil Moisture Sensor, RGB LED to the Raspberry Pi Pico.
5V Water Pump ->GPIO26
Soil Moisture Sensor ->GPIO27
LED_Pin1 -> GPIO14
LED_Pin2 -> GPIO13
LED_Pin3 -> GPIO12
STEP 3 - Functionality
First, we will interface with the internal RTC to get the current time. We will trigger the water pump every 8 hours. The Moisture level is also continuously monitored. If the soil moisture drops, then the water pump is activated for 5 to 10 seconds. In this way, the plant is supplied with sufficient water at regular intervals.
Reading the Soil moisture sensor as a digital input. We toggle the LEDs and the water pump depending on the sensor value.
STEP 4 - Code
You can find the code on my GitHub repository.
Link to the Project repo: https://github.com/Rahul24-06/Automatic-Plant-Watering-System-using-Raspberry-Pi-Pico-
CODE
from machine import Pin
import time
import utime
red_led = Pin(14, Pin.OUT) #RED LED
green_led = Pin(13, Pin.OUT) #GREEN LED
sensor = Pin(27, Pin.IN, Pin.PULL_DOWN)
pump = Pin(26, Pin.OUT) #pump
print()
print(" YYYY MM DD HH MM SS")
dateTime = (input ("Enter current date & time: "))+' 0 0'
synchronisedTime = utime.mktime(list(map(int, tuple(dateTime.split(' ')))))
timeDelta = synchronisedTime - int(utime.time())
def timeNow():
return utime.localtime(utime.time() + timeDelta)
def pump_on():
red_led.value(1)
green_led.value(0)
pump.value(0)
time.sleep(10)
print("Pump On - Watering the Plant")
def pump_off():
red_led.value(0)
green_led.value(1)
pump.value(1)
print("Plant is healthy.")
while True:
dateTime = timeNow()
#print("{:02d}-{:02d}-{:04d} {:02d}:{:02d}:{:02d}".format(dateTime[2],dateTime[1],dateTime[0],dateTime[3],dateTime[4],dateTime[5]))
utime.sleep(1)
if (dateTime[3] == 8 and dateTime[3] == 16 and dateTime[3] == 0):
if (dateTime[4] == 0 and dateTime[5] == 0):
pump_on()
else:
pump_off()
elif sensor.value():
pump_on()
else:
pump_off()
STEP 5 - Working
This setup is placed on a pot and is powered using a power bank. One of the water tubes is connected between the water pump and a water bottle, and the other tube from the water pump is connected to the soil.
We finally did this project successfully.
If you faced any issues in building this project, feel free to ask me. Please do suggest new projects that you want me to do next.
Give a thumbs up if it really helped you and do follow my channel for interesting projects. :)
Share this video if you like.
Blog - https://rahulthelonelyprogrammer.blogspot.com/
Github - https://github.com/Rahul24-06/
Happy to have you subscribed: https://www.youtube.com/c/rahulkhanna24june?sub_confirmation=1
Thanks for reading!
Automatic Plant Watering System using Raspberry Pi Pico
- Comments(8)
- Likes(7)
- 2 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
-
10design
-
10usability
-
10creativity
-
10content
-
9design
-
9usability
-
9creativity
-
9content
More by rahulkhanna
- Automatic Plant Watering System using Raspberry Pi Pico Here, We are going to make an Automatic Watering System using Raspberry Pi Pico, which waters the pl...
- Rock Paper Scissor AI Idea ??After working on various projects on different domains, I planned to make a fun project, and ...
- Raspberry Pi Pico - RGB LED Color Picker I had made a simple RGB color mixer using Raspberry Pi Pico. Let's see how I made it.Hardware Compon...
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
125 0 0 -
DIY Laser Power Meter with Arduino
181 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
165 0 2 -