Skip to content
Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

How to Build an Automatic Plant Waterer Using Raspberry Pi Pico

Keeping your plants healthy and hydrated can be challenging, especially when you’re away from home or caught up in a busy schedule. Fortunately, with the power of the Raspberry Pi Pico, you can create an automatic plant-watering system that ensures your plants receive the right amount of water, even when you’re not around. This DIY project is perfect for gardening enthusiasts and tech hobbyists alike.

Materials Needed:

  • Raspberry Pi Pico
  • Soil Moisture Sensor
  • Water Pump
  • Relay Module
  • Jumper Wires
  • Breadboard
  • Power Supply
  • Water Reservoir
  • Tubing

Step-by-Step Guide:

Step 1: Set Up the Raspberry Pi Pico Start by setting up your Raspberry Pi Pico. If you haven’t already, download and install the MicroPython firmware onto your Pico. Connect your Pico to your computer using a USB cable, and open your preferred IDE, such as Thonny.

Step 2: Connect the Soil Moisture Sensor The soil moisture sensor is the key component that will determine whether your plants need water. Connect the sensor to the Raspberry Pi Pico using jumper wires. The sensor typically has three pins: VCC, GND, and Data. Connect VCC to the 3.3V pin on the Pico, GND to a ground pin, and Data to one of the GPIO pins (e.g., GP28).

Step 3: Connect the Water Pump The water pump will be controlled by the Raspberry Pi Pico via a relay module. Connect the relay module to the Pico, then wire the water pump to the relay. Ensure the pump is also connected to a water reservoir using tubing.

Step 4: Write the Python Code Now, it’s time to program your Raspberry Pi Pico to control the plant-watering system. The code will read the soil moisture sensor’s data and activate the water pump when moisture levels fall below a certain threshold.

python

from machine import Pin, ADC
import time
# Initialize the soil moisture sensor and water pump relay
soil_moisture_sensor = ADC(Pin(28))
water_pump_relay = Pin(16, Pin.OUT)

# Set the threshold for soil moisture
MOISTURE_THRESHOLD = 30000

while True:
moisture_level = soil_moisture_sensor.read_u16()

if moisture_level < MOISTURE_THRESHOLD:
water_pump_relay.on()
time.sleep(5) # Water for 5 seconds
water_pump_relay.off()
else:
water_pump_relay.off()

time.sleep(10) # Check moisture every 10 seconds

Step 5: Test the System Once your code is ready, upload it to the Raspberry Pi Pico. Test the system by placing the soil moisture sensor in the soil and filling the reservoir with water. Monitor how the system responds to changes in soil moisture.

Step 6: Finalize and Deploy After successful testing, you can mount the components into a waterproof container or directly in your garden. Ensure the water pump is securely connected to the water source and the tubing leads to the plants.