Skip to main content
Version: ACS CC

Plant Friend

This project is about taking care of your plants (even if you sometimes forget about them). It has quite a lot of sensors, monitoring aspects about temperature, humidity, light, and soil moisture, and it can water the plant when needed.

info

Author: Ionescu Petru-Vlad
Github Project Link: https://github.com/UPB-PMRust-Students/proiect-vladiouz

Description

The project is using a Raspberry Pi Pico 2W board, which is connected to the sensors and the water pump. Based on all the data collected, the project can determine if the plant needs to be watered or not. Additionally, the user can turn off the auto-watering functionality by a press of a button. In critical conditions, a red LED will start flashing. Using Wi-Fi, the project can send the data to a web server, where the user can see the data in real time.

Motivation

I have quite a few plants at home and I often forget wattering them, which is quite a shame (basically I wanted to create something that I would really use). My grandma also loves flowers and I think this project will make her happy.

Arhitecture

The following components were used:

  • soil moisture sensor, that provides both digital and analog output. I will use the analog output to get good precision. For this, the sensor will be connected to an ADC capable pin of the board, namely pin 26.
  • water pump, which will be put under water and will be connected to a relay in order to be controlled.
  • one-channel relay, connected with the water pump and a GPIO pin of the board. I will choose pin 22 for this.
  • AHT10 humidity and temperature sensor, which is I2C capable. I will connect it to pins 18 and 19 of the board.
  • photoresistor, which will send data about light intensity. I will connect it to pin 27 of the board, being an ADC capable pin.
  • button for toggling auto-watering mode. I will connect it to pin 16 of the board.
  • red LED for signaling a critical state of the plant. I will connect it to pin 17 of the board.
  • Raspberry Pi Pico 2W board, which will be the main component of the project. It is connected directly to (almost) all the other components and will also be used for its Wi-Fi capabilities.

Architecture

Weekly Log

Week 24 April - 1 May

Wrote project documentation, including all components and connections needed. Finalized the hardware scheme in KiCad.

Week 1 May - 8 May

Wired 90% of the hardware. Also accidentally burnt one of the Picos while connecting the soil moisture sensor. Wrote the code for initializing all the periferics + reading data from the AHT10. Updated the KiCad schematics, having a small issue (one PIN badly connected). Updated the bill of materials.

Week 8 May - 15 May

Wired correctly hardware, some complications with wiring the batteries, relay and water pump (could not get it done at the lab). Found the issue with the soil moisture sensor and solved it. Updated KiCad. Next up is writing up the software.

Week 15 May - 22 May

Hardware done, software wrote and tested, working as expected. Next up is PM Fair.

Hardware design

Description of hardware used: The Raspberry Pi Pico 2W is the central component of the project. It is connected to all the sensors and the water pump (indirectly). The sensors where chosen based on pricing and performance, so measurements would be accurate and useful. The water pump is used to water the plant when needed, and the relay is used to control it. The red LED is used to signal a critical state of the plant, while the button is used to toggle the auto-watering functionality.

Schematics

Hardware HW PIC 1 HW PIC 2 HW PIC 3 HW PIC 4

Bill of materials

95% of the hardware has been purchased from Optimus Digital:

DescriptionQuantityUnit Price (RON)Total Price (RON)
Raspberry Pi Pico 2W339,66118,98
AHT10 High-Precision Digital Humidity and Temperature Sensor114,9914,99
0.25W 10KΩ Resistor30,100,30
0.25W 4.7KΩ Resistor20,100,20
Soil Humidity Sensor Module23,997,98
Photoresistor (5528 type)21,492,98
6x6x6 Button10,360,36
HQ Breadboard (400 Points)14,564,56
Fire Set for Breadboard17,997,99
5V Single-Channel Relay Module14,994,99
Mini Submersible Water Pump19,999,99
Colored Wires Male-Female (10p) 10 cm12,992,99
Red 5mm LED10,390,39
0.25W 220Ω Resistor20,100,20
Black Micro USB Cable 1m13,993,99
Green 2.54mm Pin Header (40p)20,991,98
Colored Female-Female Wires (40p) 10 cm16,996,99
Breadboard (750 points)18,988,98
Red 3mm LED40,391,56
Colored Female-Male Wires (10p) 20 cm23,997,98
Battery holder 4 x R619,439,43
1N4007 Diode20,490,98
Duracell AA5124,9924,98
6mm Hose (1m)14,174,17
Total246,97

Software design

The program will periodically check the sensors values and will determine if the plant needs to be watered or not. It will use an algorithm based on soil moisture, temperature, light and air humidity. The user will be notified on the frontend regarding the health status of the plant. Toggling the button will change the auto-watering functionality, so the relay will or will not activate the water pump.

The software repository also contains the server and the frontend client. Data is send each second from the Pico 2W to the TCP server and back.

Regarding the software libraries:

LibraryDescriptionUsage
embassy-rpHAL for Raspberry PiADC, Channel, I2C and GPIO functionalities.
embassy-syncno-std, no-alloc synchronization primitives with async supportCommunication using Signal
embassy-timeWorking with time in embassySetting timers
embedded-hal-asyncasync Hardware Abstraction Layer for embeddedI2C communication
itoainteger primitive to string conversionserializing data to be sent over TCP
static_cellStatically allocated, initialized at runtime cellFor RESOURCES during Wi-Fi configuration
embassy-netAsync TCP/IP network stack for embedded systemsWi-Fi
embassy-futuresno-std, no-alloc utilities for working with futuresyield_now for button and LED
embassy-executorasync/await executor designed for embedded usageSpawning to be executed almost simultaneously
cyw43Rust driver for the CYW43439 WiFi chip, used in the Raspberry Pi Pico WWi-Fi
defmtLogging framework for embedded systemsUsed for logging and debugging
defmt-rttReal-Time Trace (RTT) support for defmt.Enables logging output over RTT
  1. How to wire soil moisture sensor
  2. AHT10 datasheet
  3. Relay info