Plant Monitoring with Enviro Grow
Enviro Grow is a clever little Raspberry Pi Pico W- powered data-logging board which will let you keep an eye on all the metrics that your plants care about - water and light, plus environmental conditions like temperature and humidity. Team it with tiny pumps to water your plants automatically!
In this tutorial, we’ll show you how everything fits together and how to get started monitoring and auto-watering your plants.
What you’ll need
An Enviro Grow kit. For monitoring the moisture levels of your plants you just need the Grow + Sensors kit, but if you want to do auto-watering as well you'll want the full Grow + Accessory kit.
Some plants or seeds that rely on you for sustenance, and soil and pots for them to live in.
If you're planning on auto-watering, you'll need a reservoir to hold water. We're using a mug for ours, but other types of container are available (you probably shouldn't go for this kind).
Prerequisites
We're going to assume that you've provisioned your Enviro Grow and you've got it posting data somewhere. If you haven't done that yet, consult Getting Started with Enviro - this will show you how to set up your Enviro and connect it to adafruit.io - an easy to use cloud data service. We've got our Enviro Grow hooked up to an InfluxDB database hosted on a Raspberry Pi - if you'd like to do the same you can find instructions on how to do that at the link below.
If you don't want to post your data anywhere right now, you could just save it locally on your Enviro. It's easy to change this later if you want.
Updating your Enviro firmware
To see the Grow specific settings, you'll need to update your Enviro firmware to the most recent version. Note that updating will delete any files on the device, so you might want to back up any important details/readings first. Here's how to update it:
Download the latest Enviro .uf2 from the releases page.
Plug Enviro into your computer.
Hold down the BOOTSEL button on Enviro and hit RESET to put the board into DFU mode.
Copy the .uf2 file across to the new RPI-RP2 drive.
After a few seconds, Enviro should start up in provisioning mode (with the white activity LED flashing quickly). You'll need to reprovision it once you've updated.
Plant monitoring
Connecting the moisture sensors
The moisture sensors come in sets of three, still attached to their sprues. Side cutters are the best way to separate them if you have them, but snapping them by hand along the perforation line will work too. You can tidy up the rough edge with sandpaper or an emery board if you want (but your plants probably won't mind if you don't).
There's an area near the top of each sensor for you to label your plant. Giving your plants names is great for morale, you should definitely do this (ultra-fine Sharpies work well for labelling).
The moisture sensor cables have three wires and are used to connect the sensors to the three ports labelled SOIL on the front of Enviro Grow. The connectors will only go in one way round, so if you’re having trouble plugging them in try rotating the connector and trying it the other way.
For the capacitive moisture sensors to work best as much of them will need to be surrounded by soil as possible, so it’s best to position the sensors a little way in from the edge of the pot and push them in as far as they can go. The Under/Ground line should be above the level of the soil, to avoid the components at the top of the sensors coming into contact with water.
If the moisture sensor cables that come in the kit are too short, we also stock a longer version.
How the moisture sensors work
Grow's capacitive moisture sensors work using Pulse-Frequency Modulation - they report the moisture level by sending out a regular pattern of on-off electrical pulses, with varying frequency.
The Raspberry Pi Pico W on the back of Grow reads the frequency of the pulses , and the Enviro software converts this reading into a percentage relating to the moisture saturation of the soil.
We like capacitive sensors because they don't have exposed electrodes, which makes them more resistant to corrosion and means they last longer than old-school conductive moisture sensors.
Buzzer alerts
⚠ These instructions assume that you've updated to v0.0.9 (or later) of the Enviro firmware.
Grow will make a cute little noise to attract your attention when the moisture level drops beneath a certain percentage (50% by default). It will make a slightly different noise for each channel so you can tell which pot needs water - one drip for channel 1, two drips for channel 2 etc.
You can customise the threshold at which it starts bleeping by re-entering the provisioning process and connecting to Grow with your phone or other device (to re-provision: hold down Poke, tap reset and keep holding Poke until the Activity LED starts flashing rapidly). When provisioning an Enviro Grow, there will be an extra page allowing you to adjust the moisture_target
percentages.
Alternatively, you can edit config.py
with Thonny and change the moisture_target
percentages under the relevant channel. If you need more help with using Thonny to edit files, check out the link below.
If you're not using all the sensors (or if you don't want Grow to make noise) set the relevant channels to 0.
A good way of figuring out the right levels is by letting your pots dry out to the point at which you think they need watering, checking the readings, and then setting the moisture_target
s to that number.
Note that in v0.0.9 and later the moisture_target
channels are named a, b and c (to match the printed labels on the board).
If you're happy watering your plants manually when Enviro Grow bleeps at you, then you're ready to go. If, however, you have a brain that struggles to remember to do stuff even if things are beeping at you (hi!), you might want to consider getting it to water your plants too!
Auto-watering
Tips for success
Water and electricity are not besties, so make sure to position your auto-watering system as far away from plugs and mains power as you can. It's a good idea to put the whole thing on a tray or something similar, so if you get any water escaping it won't get anywhere dangerous.
Avoid starting a siphon with your pumps - this could result in your entire water reservoir emptying into your pots quite quickly, which your plants won't appreciate. Make sure that the plant ends of your tubes are always higher than the water level in your reservoir to beat physics and stay dry!
Selecting a water reservoir
We're using a mug as our water reservoir for this tutorial, but you could totally build something more elaborate. Something with a lid is good as it will stop your water stash from evaporating - but any kind of plastic box that you can make holes in to poke tubes out of will work - check out our original Grow HAT tutorial for an example of how to do that (this setup is still keeping our office plants alive two years on, hooray!).
Once you've decided what you're using for a reservoir, work out what lengths of tube you will need to connect your reservoir to your pots and chop the tube into an appropriate number of bits. Push the ends of the tube into the outlets on the pumps.
We sell tube separately if you need more!
Attaching the tubes to the pots
When figuring out how to attach the other end of the tubes to your pots, keep two things in mind.
- Make sure the tube end is securely fastened in place over the pot - if it comes adrift, water is likely to go places it shouldn't.
- Aim to have the tube end positioned well away from the surface of the soil to avoid soil being sucked back down the tube at the end of a watering 'pulse' - if soil gets inside the pump it could jam or damage it.
We're using some little 3D printed widgets to keep the end of our tubes in place here, but you could make a loop of wire round your pot to keep the tube end in place or tie the end to something like a wooden stake.
For best results, position the tubes so that they're not running directly onto the moisture sensors. We put our tubes and sensors on opposite sides of the pot to make sure that the pot gets thoroughly watered.
Connecting the pumps to Enviro
The ends of the pump wires plug into the two pin PUMP connectors on the back of Enviro Grow, these connectors are slightly squarer than the ones for the moisture sensors. If you want to plug in other (low current, 5V) devices to these connectors (or extend the length of the pump cables) we sell compatible cables on the shop.
The connectors will only go in one way round, so if they don't fit, try rotating them. If you need to remove them, make sure to pull on the plug rather than the wires so you don't detach the wires from the connector.
Final checks
Once you've plugged everything in, double check that each pump matches with the correct moisture sensor for the pot they'll be watering (so the pot containing the sensor attached to SOIL A should be watered by the pump connected to PUMP A) . You could draw coloured dots on the connectors, sensors and tube ends so you can keep track of which one is which and match them up correctly.
You'll probably find that you'll need to rearrange the pots and adjust the angle of the tube to find a position that they sit nicely in - the tube is rather springy. The cables on the pumps are quite long, so after we added the pumps to the our water reservoir we did a bit of cable management to tuck the surplus wire out of the way.
Enabling auto-watering
When you're ready to turn on auto-watering, open up config.py
in Thonny and change auto_water
to True
. Be sure to save the file when you're done. If you're running v0.0.9 or later of the firmware, you can also enable auto-watering through the provisioning process.
Double check your tube ends are positioned over your plant pots, just in case, and press the poke button. If your Enviro has power, and if the soil moisture level is sufficiently below the moisture_target
, watering should happen!
Configuring auto-watering
You'll probably want to adjust the moisture_target
settings depending on what kind of plants you're watering . Our second moisture sensor is monitoring Very Spiky Cactus who likes drier soil, so we only want it watering up to 20% saturation. Sensor 1 is monitoring Spider Jerusalem who enjoys more water, so we've left that one at 50% saturation. If you're not sure what saturation level targets to use for your plants, water them manually to the saturation level you want, then check the readings to see what saturation %s are being reported.
Our auto-watering code will calculate how long to run the pumps for based on the difference between the moisture level reported by the sensors and the moisture_target
level and deliver a bigger pulse of water if more watering is needed.
If you want to change this behaviour (to allow for longer tubes, perhaps), open up enviro/boards/grow.py in Thonny and look for this line:
duration = round((targets[i] - moisture_levels[i]) / 25, 1)
You could change the 25 to a smaller number (like 10) to make all the pulses longer or even change the line to something like the one below if you wanted it to dispense the same amount of water every time. This number is how many seconds the pump will run for.
duration = 0.2
There will likely be some adjustment required to find the right levels for your setup! If you're tweaking the code we'd suggest not leaving your setup unattended or overnight until you've monitored it for a while and are happy it's working as intended.
Troubleshooting
Help! I don't see the auto watering settings.
You'll need to update to the newest version of the firmware to see the auto-watering settings, you can grab the most recent version here.
Help! My moisture sensors are reporting 0, despite everything being suitably watered.
First of all, check that there's no moisture on the components at the top of the sensors - drops of water on the components can cause them to measure the capacitance incorrectly (and can also cause corrosion/damage).
It's also worth checking that the soil sensor is inserted deeply enough in the soil to work properly - we've found that at least half of the sensor area needs to be in contact with soil for best results.
Help! All my moisture sensors are reporting the same value.
If you're seeing a weird phenomenon where all your sensor readings converge on the same value after a while, check your plants aren't touching each other. If the leaves of your plants are making an electrical connection with each other they could be sharing the soil capacitance values between pots. Nature always finds a way!
Next steps
Hopefully that will help you get started with the basics of setting up plant monitoring / auto-watering system - as always, tweet us @pimoroni and let us know how you're getting on. Here's Auntie Dawn, fully hydrated!
Search above to find more great tutorials and guides.