Smart Indoor Plant Monitor - Know When Your Plant Needs Watering

by thediylife in Circuits > Arduino

7928 Views, 96 Favorites, 0 Comments

Smart Indoor Plant Monitor - Know When Your Plant Needs Watering

DIY Smart Indoor Plant Base - Know When Your Plant Needs Watering
Smart Indoor Plant Base.jpg
Watering Indoor Plant.jpg
Plant On Shelf.jpg
Soil Moisture Monitoring Stick.jpg

A couple of months ago, I made a soil moisture monitoring stick that is battery powered and can be stuck into the soil in your indoor plant's pot to give you some useful information about the soil moisture level and flash LEDs to tell you when to water your plant.

It does a great job, but it's quite prominent stuck into the pot and it's not the best-looking device. So this got me thinking of a way to make a better looking indoor plant monitor which could give you the information you need as a glance.

If you enjoy this Instructable, please vote for it in the Remix contest!

Supplies

Designing the Base

Sketch of New Soil Moisture Monitor.jpg
Base For Indoor Plant.jpg
Seeeduino XIAO.jpg
Capacitive Soil Moisture Sensor.jpg
Measure Plant Base.jpg
Components To Be Cut.jpg

After playing around with a couple of ideas, I thought of making a simple round base for the indoor plant to stand on, similar to a coaster. The base would consist of three layers, a layer of MDF, then an indicator layer that would light up to show the status of the plant, and then another layer of MDF.

The indicator layer would be lit up by an RGB LED which would go green when the plant had enough water and go red when the plant needed water. The levels of moisture in between would be varying shades of yellow/orange as the LED transitions from green to red. So a greeny-yellow would mean that there is still a fair amount of water and an orangy-yellow would mean that you'd need to water your plant quite soon.

I still wanted to use the same capacitive soil moisture monitoring sensors that I used in the first project, as I had a couple of spares. This time, however, there won't be any electronics attached to it directly, all of the processing would be done in the base.

The microcontroller I decided to use was the Seeeduino XIAO because its really small, it's Arduino compatible and it costs just $5.

I started out by measuring up the base of the pot so that I could make the new base slightly larger. I designed the components in Inkscape to be laser cut as well as in PDF format to be printed and cut by hand. You can download the templates here.

Cutting the Acrylic & MDF

Laser Cutting Components.jpg
Laser Cut Components.jpg
Roughen The Edges Of The Acrylic.jpg
Roughen The Edges Of The Acrylic To White.jpg

I cut the components out from 3mm MDF and 3mm clear acrylic on my laser cutter. If you don't have a laser cutter, you can print out the PDF templates and cut the components out by hand. Both MDF and acrylic are quite easy to work with.

In order to get the RGB LED to light up the edges of the acrylic layer, you'll need to roughen them up using some sandpaper. I used some 240 grit sandpaper and sanded all of the edges of the acrylic until they had an even white haze. The rough edges diffuse the LED's light and make the acrylic look as if it is lighting up.

Assembling the Base

Allow Epoxy To Cure.jpg
Clamp The Pieces Together.jpg
Glue Components Together.jpg
Use Epoxy To Glue Components Together.jpg

Next, glue the layers together using some epoxy adhesive.

Only use a small amount of epoxy, you don't want it to seep out of the edges and onto the acrylic faces which you've just sanded or you'll have to sand them again.

Use some small clamps to hold the layers together or put them under a heavy object while the epoxy cures.

Soldering the Electronics

Gather Electronic Components Together.jpg
Smart Indoor Plant Base Schematic.jpg
Solder Components Together.jpg
Soldered Components.jpg

While the epoxy is curing, you can solder your components together.

The circuit is quite simple, you've just got two PWM outputs to control the RGB LED, one for the green leg and one for the red leg, and then a single analogue input to read in the sensor output.

You'll also need a current limiting resistor on each of the two LED legs. The green light from these LEDs is generally much brighter than the red, so I used a 220Ω resistor on the green leg and a 100Ω resistor on the red leg to balance the colours out a bit better.

These capacitive soil moisture sensors are supposed to be able to run on either 3.3V or 5V, however, I have had a couple which just don't output anything when powered by 3.3V. If you find that you get no output from your sensor, you might need to power it from the 5V supply on the Arduino - Vcc instead. The sensor steps the voltage down anyway, so you'll still only get a 3.3V output. Be careful if you use a different model sensor as this particular Arduino can only accept up to 3.3V on the analogue inputs.

Installing the Electronics

Install Components Into Housing.jpg
Close Up Component Housing.jpg
Base Is Now Complete.jpg

Next, you'll need to install your electronic components into your housing at the back of the base.

When I tried to assemble my components the first time, I saw that I'd been a bit optimistic in thinking that I'd get them all into the two-layer space, so I had to cut an additional spacer layer.

Push your LED into the hole in the acrylic, making sure that the brightest part of the LED is within the acrylic layer. So don't push it all the way in.

Then glue your Arduino into the housing and the header pins onto the top cover. You can use epoxy or a glue gun for this step, I used a glue gun as it sets faster. It's also a good idea to cover the soldered joints on the header pins with glue so that they don't short on the legs of the LED when you close it up.

That's it for the assembly, now you just need to program it.

Programming the Arduino

Sketch 1.jpg
Sketch 2.jpg
Change To Moving Average.jpg

The sketch is quite simple. It just takes readings from the soil moisture sensor and then maps these between the wet and dry limits. It then uses these mapped values to drive the two LEDs proportionally.

So the red LED is on completely and green is off completely when dry and visa versa for wet. Intermediate levels have scaled PWM outputs to provide the varying shades of yellow/orange.

In my first version of the sketch, I just updated the LEDs with each value read in from the sensor. I noticed that there was some variation in measurements and every so often there was a value which was significantly higher or lower than the others, which caused a colour flicker/glitch. So I changed the code a bit so that the past ten readings are averaged and this average drives the LED colour rather. This makes the changes a bit more gradual and allows for some outliers without significantly affecting the colour.

This data can be seen in the Serial monitor output.

You can download the sketch here along with a full description of the code.

Calibrating the Sensor

Plug In Soil Moisture Sensor.jpg
Replace Pot Plant Base.jpg

The last thing to do before you use the monitor is to calibrate the sensor. You'll need to do this so that your Arduino knows at what moisture level your plant has enough water and at what moisture level it needs water. This is an important step because each sensor's output is slightly different based on the position and soil type and each plant has different watering requirements.

The best way to do this is to start with your "dry" plant, with the soil at a moisture level where you'd expect to water it.

Place your plant onto the base, push the sensor into the soil (don't submerge the electronic components), and then plug the sensor into the header pins on the base.

Connect your Arduino to your computer and open up your Serial monitor. You'll need to add a Serial.print(""); line to the code to print your sensor's outputs to the Serial monitor so that you can see the raw values. You want a new value to be displayed every 1-2 seconds, you can change this using the delay. You can output the moving average result as well if you'd like, you'll just need to wait a bit longer to get your stabilised readings.

Note the average of around 10-20 readings once they have stabilised, this will be your "dry" setpoint.

Once you're happy with the dry readings, water your plant as you would normally. Give it enough water to be fully absorbed into the soil, but don't drown it. Now do the same as before and get an average "wet" setpoint.

Update the two set points in the code and then re-upload the sketch and you're ready to start using the base properly.

Using the Smart Indoor Plant Monitor

Plant Monitor On A Shelf.jpg
Colour Flicker.jpg
Base In Between.jpg
Red, Plant Needs Water.jpg

Since you've just watered your plant to calibrate it, the display should be green. It will slowly start going yellow and then red again over the next few days as the soil dries out.

Because of the moving average array, there is a bit of a delay between when you water the plant and when the sensor goes green again. It should turn green after around 20-30 seconds.

If you're going to use the base in a really sunny spot then you might want to add a second or third LED and another acrylic layer to the base to make it a bit larger and brighter.

Let me know what you think of this monitor in the comments section below. What do you like and what would you change?

As mentioned before, please vote for this project in the Remix contest if you enjoyed it!

Have fun building your own!