Bonsai trees are the most glorious of miniature shrubbery. But caring for them takes seriously green fingers. Luckily, this Raspberry Pi–powered bonsai watering system doesn’t require much to get started. Also, the Reddit user who shared the project is named Lord-of-the-Pis, so, we love.
You will need:
- Raspberry Pi
- Submersible water pump
- Jumper wires
The Pimoroni Explorer HAT Pro isn’t essential to make this project work, it just makes things a whole lot easier by removing the need for a relay. It also comes with a Python library for interfacing with Raspberry Pi. The project uses an I2C connection, so it would also be possible to not use the HAT and instead plug a moisture sensor into an analogue-to-digital converter and then into Raspberry Pi’s GPIO pins.
How was it done?
Lord-of-the-Pis explains: “I used the Pimoroni Explorer HAT Pro in order to make the entire system on a small breadboard on top of Raspberry Pi. The Explorer HAT has inbuilt analogue inputs over I2C, which I used for the input of the moisture sensor (two wires pushed into the soil as probes). Furthermore, the output GPIO pins on this HAT sink all current to ground when activated so they can be used as a transistor to power the small 5V motor (which was also attached to the 5V power pins on Raspberry Pi).”
Using the HAT also allowed this maker to simply hook the pump up to the GPIO pins and turn these on and off, so there’s no need for an on/off switch.
How does it work?
This project’s code is in Python 3, and you can find it all on GitHub.
The main watering program (plantWater.py) takes input from the moisture sensor, and if the soil moisture level is below a set amount, the bonsai gets watered.
Lord-of-the-Pis built a simple web interface for the project on a localhost site that’s hosted using Apache. Apache SSI is used to execute the Python scripts. Due to the use of SSI, the index page is called index.shtml.
A lot more detail about the hardware and software involved is available in this second reddit post about the project.
Lord-of-the-Pis is now working on a dashboard that plots the soil moisture over time, as well as tracking other things like light intensity, temperature, and humidity.
May no other plant perish due to overwatering on our watch ever again!