Plant_io Basic Setup Guide | Automatically Water a Seedling Based on Soil Moisture

Updated 25 September 2023

What We'll Achieve

This guide will help you set up a Plant_io controller to automatically irrigate a plant of your choice. This example focuses on germinating seeds, but this is only one option.

Along the way we'll:

  1. Assemble a hardware platform to house the system neatly.
  2. Connect electronics to measure soil moisture and deliver water to the soil.
  3. Plumb a pump to deliver water, and locate a soil moisture sensor into a growing medium.
  4. Log data over a long period to observe how the controller is working and how effective our growing strategy is.

Before You Begin (Code and Resources)

This is an open-source project that you can adapt to your own needs. If you prefer to grow different seeds, use different shaped containers, or a different growing media then go for it!

All these resources are available for you to get started, and create your own experiments. Hack this Project!

  • Download the code and resources
  • It's helpful if you've already programmed a Raspberry Pi Pico using Thonny. If you need help getting started with this, check the tutorial.

Required Hardware

The Plant_io Cultivation Kit is the easiest way to acquire all the hardware you need for this guide. If you're deviating from these instructions and only need part of the kit, all the available spare parts are listed below:

Workshop tools and consumables:

  • Popsicle stick to mix the Growing Medium
  • Surgical gloves for mixing/potting Growing Medium
  • 2x Rubber bands (mounting electronics)
  • BluTac (mounting electronics)
  • Gaffer tape (to secure pump tube)
  • Drill, 5mm bit and clamp (to drill holes into the water reservoir)

An Introduction to the Hardware

To make an automatic watering system we're going to need a few pieces of hardware. Read more about the purpose and operation of each device here:

We'll use a peristaltic pump to deliver water to the soil.

A peristaltic pump is a special type of pump that moves fluids through a tube using squeezing motions.

Imagine you have a long, flexible straw that is filled with water. If you pinch one end of the straw and then move your fingers down the straw, the water will be forced to move in the direction you're pinching. This is similar to how a peristaltic pump works.

A peristaltic pump has a tube inside that is squeezed by rollers or gears. As the rollers move along the tube, they squeeze the fluid inside and force it to move in one direction. 

Peristaltic pumps are often used in medical equipment, laboratory instruments, and aquariums to move fluids without contaminating them since the fluid never comes in contact with the pump itself.

We need to know when the soil is becoming too dry. For that we'll use a Soil Moisture Sensor.

A capacitive soil moisture sensor measures the water content in soil. It consists of two electrodes that are inserted into the soil. The electrodes are separated by a non-conductive material. When the soil is moist, it has a high dielectric constant, which means it can store more electrical charge. The capacitance of the sensor changes as the moisture content of the soil changes, and this change is measured by the sensor.

The Raspberry Pi Pico is a small computer, or "microcontroller," that you can use to learn about electronics and how things work. It's like a mini-brain that can help you control lights, motors, and other things you might want to make. It's a fun way to learn about technology and programming!

In this guide we'll set the Pico up to read from the moisture sensor, and decide when to drive the pump and deliver more water to the soil.

The Plant_io SHIM is a simple circuit board that simplifies connecting a pump and a moisture sensor the a Raspberry Pi Pico. It's been designed to slide straight onto the Pico's pins, without any need for soldering.

For this guide we'll focus on the Soil Moisture and Pump connections. The third PiicoDev connector allows additional sensors and actuators to be connected - useful for more complex experiments. Using this feature is covered in the Plant_io Sensors Guide.

Powering project from batteries for a really long time is actually quite tricky. The Makerverse Nano Power Timer HAT makes it a lot simpler by taking care of power management for you. Essentially, the Power Timer periodically provides power to the project at a fixed interval.

The project wakes up, does what it needs to do like measure soil moisture or run a pump, and then signals to the Power Timer that it's "done." The Power TImer removes all power from the project until the next interval, when the cycle starts all over again.


Assemble the Plant_io platform

We'll start with assembling the Plant_io platform which consists of three acrylic panels: The Baseplate, Fixture Plate and Electronics Plate. Remove the protective paper coating from each panel before proceeding.

Install Standoffs onto the Baseplate

Install 10 standoffs onto the baseplate using the provided screws.

Standoffs keep the other plates elevated off the basteplate - this isolates the electronics components from sources of water or leaks.

 

Install the Fixture Plate

The Fixture Plate holds the water reservoir and plant experiment in place. Make sure this part is oriented correctly such that the circular cutout is over the Water symbol and the rounded-square cutout is over the Plant symbol.

Use 6x screws to secure the fixture plate onto the standoffs.

Install the Electronics Plate

The electronics plate carries most of the electronics. Locate the electronics plate as shown (the paper is left on to help show orientation). Install the electronics plate with 4x screws.

Install the Pump

Mount the pump to the fixture plate as shown using a rubber band. Leave the tubes disconnected for now - they'll just get in the way.

 


Connect the Electronics

Assemble the Controller

The controller is made up of a Raspberry Pi Pico, Plant_io SHIM, and Makerverse Nano Power Timer.

Plug the Pico into the Plant_io SHIM as shown. Note it's possible to make this connection backwards, or even upside down - be careful.

 

Use a fine instrument like a pen or some tweezers to configure the Makerverse Nano Power Timer. Set Switch 2 ON and leave the remaining switches OFF. This selects an interval time of 20 minutes. That means the controller will check the soil moisture every 20 minutes, and run the pump for a short duration if necessary. If you prefer to use a different value, just take note of the interval time - we need to know the interval time later when setting up the code.

 

Next, connect the Makerverse Nano Power Timer. The Pico's pins should stick through the SHIM far enough to allow plugging into the top of the power timer.

 

Install the assembled controller into the breadboard. The exact location is not very important - Here we installed as far forward in the breadboard as possible, so the connectors are most accessible. Then, use the adhesive backing on the breadboard to mount it to the Electronics Plate. If you prefer to be able to remove or reuse the breadboard you could use Bluetac instead.

 

Connect the Pump to the Controller

  1. Install the pump's cable into the polarised connector on the pump. The connector will only fit in one orientation.
  2. Connect the other end pump-output on the Plant_io SHIM. Pay attention to the orientation of the connector here! Make sure the black wire aligns with the negative(-)  symbol and the red wire alings with the positive(+) symbol. The third blue wire is for the drive signal (sig)  - which controls the pump.

Connect the Soil Moisture Sensor to the Controller

  1. Install the sensor's cable into the polarised connector on the sensor. The connector will only fit in one orientation
  2. Connect the other end to the sensor-input on the Plant_io SHIM. Pay attention to the orientation of the connector here! Make sure the black wire aligns with the negative(-)  symbol and the red wire alings with the positive(+) symbol. The third green wire is for the sensor signal (sig). This is an analogue voltage that is ready by the Pico.

Leave the Moisture Sensor loose for now. We first need to prepare the growing medium.


Prepare Growing Medium

Growing Medium is just a fancy term for "the stuff a plant grows in." Usually this is some kind of soil - but not always! There are lots of different media you can grow plants in. Some plants are happy to grow in clean, nutrient-rich water and some can grow in air! For this demonstration we'll use peat pellets. We're using these pellets because they're easy to store dry, retain moisture well, and are perfect for seedlings.

Hydrate the pellets and combine into a single mass

This method should result in a growing medium that is just hydrated enough to begin sprouting seeds. We want to err on the side of too-dry, because we can always add water later. Alternatively, we've also had good success by saturating the pellets and squeezing out excess moisture!

In the video we make a pretty conservative amount of growing medium. Use 10 pellets instead with appropriate water for better results.

  1. Gather the Plant container, 10 pellets, the graduated cylinder and a mixing instrument
  2. Remove the mesh casing from 10 pellets and add to the container 
  3. Measure out 200mL of water. Be careful with measurements here because we don't want excess water. We found this ratio of 20mL per pellet to work very well. If you wish to use more/fewer pellets because eg. you are using a different-sized container, use this ratio as a starting point.
  4. Add the water to the container and allow the pellets to soak for 5 minutes, or until all the water is absorbed. The pellets will expand a lot as they absorb water.
  5. Mix the expanding pellets into a single mass, ensuring there are no hard, dry lumps. You may need to add a small amount of water to help break up larger clumps. Once the clumps are gone, pack the growing medium gently into the container, creating a level surface. Don't pack down too much! We want enough depth to insert the soil moisture sensor at least half its length.
  6. Install the Plant Container into the platform.


Test Soil Moisture Sensor

Run the test_moisture_sensor.py script and confirm that the sensor returns valid data. The script reports the soil moisture level as a normalised percentage. 0 is completely dry and 100 is dipped into water.

  1. To begin, leave the moisture sensor out of the soil.
  2. Run the test_moisture_sensor.py script to begin plotting the moisture level. It ought to start at or close to 0
  3. insert the moisture sensor into the soil at a slight angle to maximise contact with the soil. It may also help to gently compress the soil around the sensor.
  4. Observe the new moisture reading - somewhere between 10 and 40 is expected.

 

 

This image shows an example of results you might see when you run the script and insert the moisture sensor. Initially, the moisture reading is zero. As the sensor is inserted and the soil is packed around it the reading here spikes to about 60% due to the soil being pressed hard against it. Once the pressure is removed the reading settles at about 30%.

 


Plumb and Test the Pump

Now it's time to add plumbing to the pump and run a quick test to a) demonstrate it works, and b) determine which tube is the inlet/outlet.

Note: Peristaltic Pumps are self-priming - there's no need to make sure the tubes are full of water before running the pump. That also means there is no danger in running the pump dry.

  1. Carefully drill 2x 5mm holes in the lid to the water reservoir. Use a clamp to hold the lid safely. Ensure debris stays out of the reservoir.
  2. Fill the reservoir with water and screw on the lid.
  3. Install the reservoir into the Plant_io platform.
  4. Press a silicone tube onto each the input (left) and output (right) of the pump.
  5. Pass the inlet-tube through one hole in the reservoir and insert it into the bottom of the water.
  6. Pass the outlet-tube through the other hole in the reservoir and suspend it above the surface of the water.
  7. Run the test_pump.py script which will drive the pump for three seconds. You ought to see water being drawn up inlet-tube. Repeat this step until water is expelled from the outlet-tube. You can repeat this step as much as you like because the water is just circulating back into the reservoir.

The pump is working, and the tubes are now primed with water. We'll leave the outlet tube as-is for now to keep it secure. Once the seeds are sown into the growing media we will transfer this tube into the Plant Container.

 


Sow some seeds

Carefully sow seeds evenly over the growing media surface. In this guide we're using alfalfa sprouts because they sprout quickly and can produce an edible result in just a couple of weeks.

Tip: Seeds will sprout more readily if they are soaked overnight first. This helps but is not necessary.

 You can now transfer the pump outlet-tube into the Plant Container. Carefully moisten all the seeds with water to help them begin sprouting. You could run the test_pump.py script a couple of times to dispense water onto the seeds manually - or use a misting spray bottle.

Once again, be careful to not introduce too much water. We don't want standing water in the bottom of the container.

In this guide we use gaffer tape to secure the tube in place so it deposits water into the centre of the growing media.

Remix Idea: Can you think of a better way to dispense the water evenly into the container? Perhaps additional plumbing can help by distributing water through multiple small holes.

 


Set up for Automatic Operation

So far we've only run test-scripts to check the Plant_io hardware. Now we're ready to commission the Plant_io automatic watering. Use the test_mositure_sensor.py script to check the soil mosture reading again. Depending on how much water you've used perhaps your growing media is still a little too dry, or perhaps it's perfect!

Take note of your moisture reading because we're going to use it as the desired moisture set point in the main.py script. 

  • Open automatic_watering.py and save it to your Pico as main.py. Don't forget to update the moisture setpoint as necessary.
  • If you're using a different timer interval than the one we set up, this is the time to update the period_minutes variable with the interval time you selected. If not, you can leave this at the default value of 20 minutes.

 

  • Load some fully-charged NiMH batteries into the battery holder and secure it to the underside of the electronics platform with a rubber band.
  • Turn on the power - slide the switch on the battery holder to the ON position.

 

You are now running in full automatic. The Plant_io controller will wake periodically (in this case, every 20 minutes) and sample the soil moisture level. If the soil is too dry water will be added. After some time, you may want to peek into the log.txt file which is a comma-separated variable file containing the mission time (in minutes), the soil moisture and the pump duration for that interval in seconds. After a few days the data in this file ought to look pretty interesting when plotted!

Happy Growing!


Results

I ran this setup with an initial setpoint of about 30% and left it over the weekend in the office. When returning on Monday I had some sprouts!

I noticed the growing medium was a little dry after a couple of days so I decided to update the moisture setpoint to 48%. The pump maintained this moisture setpoint well and after a couple more days I decided to analyse the data log. I imported the data into Excel and produced the following plot. For the first couple of days, you can see the soil moisture slowly dropping down as the water evaporates or is absorbed by the sprouts. When I update the setpoint you can see the moisture level rises slowly over the next 10 hours to reach the new setpoint. From here the pump only has to do a few seconds of work here and there to maintain the new moisture set point.

This image shows how I imported the data into Excel. I post processed the data to show hours on the x-axis instead of minutes.


Conclusion

After tuning the moisture set point to suit my setup the Plant_io system appears to hold a moisture set-point really well! My sprouts are a couple of days old now and are on their way to becoming delicious and nutritious. I happened to leave this experiment running over the weekend in a dark office. On Monday morning I had sprouts! While they could certainly use a little more light, the results show that the system is capable of cultivating seedlings and holding the desired moisture level.

Happy Making!


Where to From Here?

  1. Set your experiment up near a window. The seedlings used in this guide do well with filtered light. Direct sunlight can be a bit intense.
  2. Datalog soil moisture. We ought to see the soil moisture go up and down over the course of several days.
  3. Experiment with lighting strategies using halogen lamps and timers.
  4. Experiment with different moisture set points
  5. Collect additional data with extra sensors and log the data. This is covered in the Plant_io Sensors Guide.

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

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.