Embrace your inner scientist with Plant_io™, an open-source project designed to delve into the captivating world of plant cultivation and experimentation. This DIY electronics kit serves as your comprehensive guide to establishing an automated plant irrigation system dependent on soil moisture levels. The kit includes everything you need to get started - and along the way you'll assemble electronics & irrigation hardware, and upload the Plant_io code to the controller.


I'm going to show you how to get started with Plant_io, a system to automatically cultivate plants and run long-term experiments.

In this guide, we'll set up Plant_io for simple plant cultivation. That's irrigating the soil when it becomes too dry. We're going to assemble the Plant_io hardware, make all the electronic connections, plumb the irrigation pump, commission a soil moisture sensor, and prepare our seeds to be watered automatically. We'll even log the soil moisture and the pump activity to a file on the microcontroller, a Raspberry Pi Pico, and we'll be able to analyze that later.

Now, Plant_io is all about experimentation, and we'll provide one recipe which includes specific growing media, seeds, and methods, but we also encourage you to remix these ideas for your own experiments. For example, I'll grow my plants directly from seeds. If you want to speed things along, you may want to sprout your seeds first by following the directions supplied with your seeds. I'm also growing in a closed bottom container. Perhaps you prefer to drill holes in the bottom of your container to allow drainage.

To follow along, you'll need a Plant_io acrylic platform kit. That's the structure that holds the whole project together. A water reservoir and growing container, a breadboard to mount the circuit on, a Plant_io plant cultivation shim, a Raspberry Pi Pico H, a Makerverse Nano power timer, cycles the project on and off periodically, which is great for running on battery power, a peristaltic pump with silicone tubing, a capacitive soil moisture sensor.

To run the project on battery power, we'll be using four high quality AA rechargeable batteries and a switched battery holder. You can load those in now.

Michael from the future here - some of your hardware may look a little different to what's in this video. We'll be tuning the Plant_io experience over time based on your feedback. If there's a change that affects assembly instructions, we'll be sure to update the guide with the latest advice. Let's get back to it. 

You also need a few workshop essentials like a Phillips screwdriver, a stick to mix the growing media with, some sticky tape, and of course, the seeds or seedlings that you want to cultivate. In this guide, we're growing alfalfa. Links for all the required hardware are in the article.

Begin assembly with the platform. Peel off the protective paper backing of all the acrylic pieces. Go slow to minimize tearing, and you can gently scrape off any stubborn pieces with the included paper peeler. Install 10 nylon standoffs and screws onto the base plate. Finger tight will be fine. Next, install the fixture plate using six screws. Make sure it's oriented as shown. Finally, install the electronics platform using four screws. This T-shaped feature should be on the right-hand side.

Now it's time for the pump. It mounts with two screws and nuts to this circular cutout. Leave the extra tubing disconnected for now, it'll just get in the way.

Let's start the electronics assembly with the Pico and the Plant_io shim. Orient the pair so that the Pico's USB connector is on the same side as the Plant_io shim's USB artwork. Align the Pico on top of the Plant_io shim and slide the pins through the shim. You may feel some slight resistance here. This is forming a semi-permanent sliding electrical connection without the need for any soldering. Now, this type of connection is not designed to be cycled a bunch of times, so try to avoid removing and re-plugging.The Pico has been mentioned too many times. Now let's move on to the Makerverse Nano Power Timer. To set the second switch on, use a screwdriver or another fine-tipped instrument. Make sure all the other switches are off. This configuration will cycle power to the project every 20 minutes, allowing it to run for a long time on battery power. If you prefer not to use batteries, you can power your project through the Pico's USB connector instead.

Next, connect the Pico to the Nano Power Timer from above. The Pico's downward-facing pins should plug into the Power Timer's upward-facing sockets. Note that the Plant_io shim will be sandwiched between the two. Plug the entire electronics assembly into your breadboard. I recommend plugging it into the top-left corner of the prototyping area for easy access to all the connectors.

Now, install the electronics assembly onto the platform. You can use the breadboard's sticky backing for this, but I personally prefer using BluTack to mount it temporarily. The pump's cable is colored black, red, and green. Plug one end into the pump's connector and the other end into the Plant_io shim. Pay attention to the labels and ensure that the wire colors match. The black wire should connect to the black label, the red wire to the red label, and the green wire is labelled as Signal. The red and black wires supply power to the pump, while the green wire is the control signal from the Pico, determining the pump motor's speed.

Using the soil moisture sensor is very similar, with the only difference being that the cable has a blue wire for the signal. Connect one end of the cable to the sensor and the other end to the Plant_io shim at the connector labelled Soil Moisture. Again, make sure the wire colors match the labels.Careful with the connector orientation here. Double check it's correct before proceeding. Leave the moisture sensor loose for now, and set the assembly aside.

It's time to prepare our growing medium. We're using these pellets for growing media in this guide. If you experiment with other media, we'd love to hear about your method and results in the comments.

Remove the casing from at least 6 pellets, and drop them into the container. Add about 20ml of water per pellet to the container. As the pellets hydrate, they start to expand after a couple of minutes. You can use a stick to break the pellets up and make sure there are no dry lumps remaining. You can add a little extra water where necessary, but try not to overhydrate the mixture. If you wind up with a runny mud, you'll need to pour or strain out the excess water before proceeding.

Now install the growing container onto the Plant_io platform.

Now we're ready to test the hardware setup. Connect the Pico to your computer with a USB cable. We're going to work with Thonny in this guide. If you're unsure how to use Thonny to program a Raspberry Pi Pico, find the Getting Started guide for that linked in the article. It goes through how to download and install Thonny, connecting to a Pico, and scripting workflow.

If you haven't already, download the code and resources from the article. Unzip and navigate to the code directory. Open the TestMoistureSensor script in Thonny. If Thonny detects your Pico isn't running MicroPython, it'll prompt you to install before proceeding.

Connect to your Pico and upload the Plant_io.py file. This driver file contains all the functionality required to run Plant_io. Now run the TestMoistureSensor script, and after a short delay, you oughtTo see some messages in the shell, the moisture percentage is showing zero because my sensor is currently out of the soil. With the script still running, carefully insert the sensor into the growing medium. I place mine at an angle to maximize contact with the growing medium. As I do, you can see the moisture level spikes sharply upwards and settles at about 60%.

Now don't be alarmed if your number is different. The reported moisture can vary quite drastically depending on the type of growing medium, how deep the sensor is inserted, how firmly the media is packed around the sensor, and of course how moist the medium is. For now, we're aiming to have the medium about as moist as we would like it to be for normal growing conditions. That means that we can take this current moisture percentage and use it as our desired moisture setpoint. Write this number down because we're going to use it later.

If you don't see this graph, you can right click in the shell and select Show Plotter.

This code starts by importing a sleep function to create a delay. It imports the Plant_io object, which is how we run this whole system, and then we initialize the controller. We call the initialization function for Plant_io and we name that Plant. Any time we refer to plant, we're referring to this whole assembly. Then we call plant.measureSoil to sample the capacitive soil moisture sensor. That returns a number as a percent and we assign that to currentSoilMoisture. And then we just print that formatted to the shell. Here we're printing with two decimal places so that it occupies the same amount of space every time. That's what we're seeing in the plot. And then we sleep for 100 milliseconds. And the whole process starts again.Going to commission the pump and water reservoir. I prepared my reservoir by drilling two holes in the lid, and I drilled from the inside of the lid to make sure that I didn't drill through any important features like the thread or the seal.

Add a couple hundred milliliters to the reservoir and install into the platform, ready for plumbing. It's probably best to remove power for this step.

The peristaltic pump comes with some silicon tubing. Connect one length of tube to the left port. This is the pump inlet where water is sucked in. Feed that tube through one of the reservoir holes and all the way down into the water. Push through a little more tube than necessary to ensure the end of the tube stays at the bottom of the reservoir.

The right port is the pump outlet. Connect another length of tube at one end and feed the other end to hang into the water reservoir. This is to avoid making a mess while we're testing and priming the pump. The water is just going to feed back in. Once we're done, we'll relocate this tube into the growing container to irrigate the plant.

Returning to Thonny, open the test pump script. This script simply runs the pump for a few seconds at a time. Run the script and observe the pump spinning. As you run the script multiple times, you ought to see water traveling up the inlet tube, moving through the pump, and finally being expelled by the outlet tube back into the reservoir. It doesn't matter that the tubes are initially filled with air. This pump is quite happy to suck water all the way through the inlet tube, and this feature is known as self-priming. Once water is coming out the outlet tube, we've successfully primed the pump.

Remove the outlet tube from the reservoir and secure it into the growing container.The center of the growing container. I found a piece of tape was the best solution to hold the tube with the orientation that I wanted.

I'm growing alfalfa from seeds in this guide, so I sprinkled in some seeds and added a little extra growing medium to bury them about 1cm deep.

Now we're just about ready for automatic operation. We've sowed our seeds, we've commissioned our plant, before we commit to running on battery power for some long period of time, let's take a look at the automatic watering script to see what's going to happen.

We start with some imports as usual, and then an infinite loop. We initialize the plant as we have in the other scripts, and we set the moisture set point to 32. Now this will vary very differently from setup to setup. We saw earlier that I was sitting at about 60%, so if that's the actual moisture set point that I desire, I would set this to 60. If I wanted a bit more moisture, I might set it a little higher, and if I thought there was too much moisture, I would set it lower.

Step two, collect some data to log. The next step is to measure the soil moisture, and measure the supply voltage. The soil moisture is easy, we just want to sample this sensor like we have before. We have a feature here to measure the supply voltage, this is so we can keep an eye on what our batteries are doing. I'm running on USB at the moment, so I expect this is going to be very stable at about 5V.

Step three, we need to run the pump if the plant requires water. So here we run the pump control method, which will look at the soil moisture, and decide how long to run the pump for, if at all. That method returns the number of seconds that the pump is going to run, and in general that's going to be zero, butEvery now and again as the moisture evaporates or leaves the soil, it's going to need some input from the pump. So this is how we can log the pump's activity. We print a little debugging information to the shell, and then step four is to take all that data and log it to a file.

The Raspberry Pi Pico has a file system on board, and we can actually log time series data to it. We won't dwell on this part too too much, but you can see we set some headings that we want to appear in that file, like time, moisture percentage, how long the pump runs in seconds, the supply voltage, and then we construct a data dictionary that couples the heading for each data with the data value.

So here we have the heading for time, and the timestamp. We have the heading for the pump, and how long the pump ran in seconds. And then we simply log all of that data to a file.

If we were running on battery power, we would be done now, so we would want to send the whole plant to sleep. That's when we would call plant.sleep, which would signal to the nanopower timer to remove power from the project. And so this script would stop there and then, and in about 20 minutes time, the nanopower timer would apply power back into the project, and we'd start at the top.

However, because I'm running off USB here, and you may not want to run on battery power, we can just call a sleep function with the same amount of time that you may have the timer set up for. And this is why we operate in an infinite loop. The Pico would just pause for 20 minutes and then start the whole process all over again.

So the behavior of the whole system will be the same, regardless of whether you're running through the nanopower timer on batteries, or if you're just powered by aUSB power supply. Let's click run on this script and see what happens. We have some debugging information. The moisture has gone up a fair way after I sowed my seeds and added a little more water. And so of course the pump doesn't need to run for any amount of time, because the moisture set point is quite low at the moment compared to the current moisture.

Currently we're at 88% moisture and the set point is only 60, so there's no need to run the pump. If we press CTRL C to stop the script, we can go over to the file pane and click refresh. And we have a new file now, log.txt. Double click that to preview it in Thonny. And here's our data logging file. We have the same headings that we prescribed in code, and these are all separated by a comma.

Time in minutes, moisture percentage, pump run in seconds. And here we have the corresponding data point. This assumes that we would be 20 minutes into the experiment. The moisture is 88.36, the same that we can see in the shell. We ran the pump for 0 seconds, the same as in the shell. And the supply voltage has even been captured at 5.01 volts.

If we were to run this script again and again, or if we were to leave it running automatically, this file would fill up with new data right now at about once every 20 minutes. I'm going to set my moisture set point somewhere in the middle at 70 and save this file to my Pico as main.py. Click file, save as, to the Raspberry Pi Pico, we'll call it main.py. This will ensure that this script runs every time power is applied to the Pico.

There's my main.py script on the Pico. And while I'm here, I'll delete this log file in preparation for growing my plants. Take a rubber band and feed both ends down through these slots in the electronics.Plate. You can girth hitch that rubber band in place and stretch it under the battery holder to secure it on the other side. So now the battery holder is being held by the rubber bands. The rubber band holds the batteries up and off the base plate out of harm's way should any water get spilled.

Flick the battery switch on and your project is running on battery power. I'm going to leave my project running for about an hour or so before checking on it again. I'll connect it to my computer and open the log file to make sure the data looks about right.

It's been about an hour and I'm just checking my log file. You can see we have the timestamp in minutes counting up 20, 40, and 60 minutes. The next value is the soil moisture, which has stayed pretty constant to be expected. That means that we don't need to run the pump. The pump has run for zero seconds. And the last entry, the supply voltage, my battery pack is at about 3.6, 3.7 volts.

I'm satisfied the project is running on battery power, so I'll leave my setup on a sunny windowsill to sprout these seeds.

This is now a few days down the track and it looks like the plant has reached maturity. But going back in time, I let the system first run for a day. I was curious to see what the soil moisture and pump duration plots would look like. So I downloaded that log file, plotted it in Excel, and this is the graph that I got. In blue we have the soil moisture percent and in red we have the pump duration. And you can see over the course of that first day, the soil moisture percent is rock steady. It's within 1% of the set point. I actually wound up changing this to about 74, 75%. And you can see it stays within 74 and a half and 73 and a half percent for the whole day. WeCan see the pump coming in and out with these spikes. Each of these spikes is the pump duration and we run the pump reasonably frequently, but only for about a second or two. And so I suppose that is just a small amount of water going into the soil to hold it at that perfect moisture set point.

I also decided to look at the voltage plot after the second day, and this is what I found. The supply voltage from the rechargeable battery starts off at nearly five volts. We're starting at around 4.93, 4.94 volts. And after a couple of days running, we're at 4.88. So we've dropped about 0.05 volts overall.

And so there you have it. We have an automated watering system that can irrigate our plant depending on soil moisture. We can even log and delve into that data. Join me in the next guide where we'll connect additional sensors to this system so we can collect richer information about our experiment and the environment. See you there.



Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.