Well it’s Spring, so it must be Arduino in the Garden time!…
Last year I rigged up my small outdoor container garden to a bought (Off the Shelf) watering timer and home made hydroponics set up.
Update: I’ve posted my latest soil sensor sample code on GitHub here: https://github.com/adamfowleruk/arduinosamples/tree/master/soilsensor
After a bit of experimentation with pipe sizes and water flow this proved really successful! After final construction I had no further damage due to poor watering, and had bumper crops of Strawberries, tomatoes, and herbs – way too much for me to eat!
This year, time for an even more scientific approach. I’m going to control one container’s environment to try and give the plant the perfect amount of watering and nutrition. I’ll use another container as the ‘control’ on the standard watering system.
Happily I have two strawberry containers each with several plants in them. A number of plants should reduce the error of, say, one plant getting sick. I’ll measure the average number of strawberries per plant. (Measuring weight is a faff… plus I tend to ‘steal’ strawberries on my way out to work in the morning… Chef’s perks!… so no time to weigh them throughout the year)
My strawberry plants are already prepped, so I need to now create a strawberry environment management monitoring system.
So obvious things to monitor:-
- Moistness of the soil
- Light level hitting the container
- Temperature
Some less than obvious things we may want to measure eventually
- Humidity
- Salinity of the soil / run off water
- Measure the water level within the water reservoir (to prevent dry running the motor)
- Current date / time (probably via a GPS receiver – I’m a cheat!)
Things we may want to do:-
- Turn a water pump on / off
- Log all the data somewhere (even to the interwebs)
- Turn a liquid feed pump on / off
First things first. Here’s what I need to build:-
- Soil moistness sensor
- Water pump controlled by an Arduino
- All of the above working in a single unit
Phase 1: Moistness sensor
This should be relatively simple. You can simply use an Arduino’s ADC to monitor the current between two wires places a few mm apart.
There are a couple of tutorials I know about for this. One at SparkFun with it’s H20OhNo device, another SparkFun one with their own soil moisture sensor, and one using a garden solar light as a base… Which I can’t seem to find now.
I have a pot plant in my home office (as you do), so I’ll just keep it simple, and power the Arduino from my laptop and print the readings every few seconds to the Serial on my Mac’s terminal.
Used the second SparkFun code as a base, and had it up and running pretty quickly.
Hint: If you see 1023 constantly as your output value, ensure the analog pin (A0 in my code) is the one connected to the transistor’s Emitter, and NOT the one connected to the input voltage and resistor!
In my set up I saw around 450 when moist, and this spiked to 500 after a watering. This reading in my office sunny windowsill drops every 10 seconds by about 4 as the top layer of soil dries out.
Phase 2: Control a water pump
I found a cheap DC submersible pump from Amazon.co.uk for £3.10 (well, from China, took a while to get here! But hey, it’s cheap and good!) that is USB powered. My theory being I can run it easily enough from a 5V line. It’s input voltage is 3.5-9V and is rated at 1-3 W. It also tolerates being ran dry – good for testing.
I’m hooking this up to two pint glasses (Hey, I’m British, of course it’s pint glasses!), one with the pump and a reservoir, the other empty for filling, connected by my irrigation hose.
This seems to work very well.
Hint: Play with the settings for the valve hidden on the side of the pump. If you can hear the motor strain but no water moves, the valve is shut! Open it fully (Move the handle to the right).
In my testing this thing can pump half a pint in 22 seconds. Not bad! It’s also pretty much silent.
Now to control it from an Arduino. My Arduino’s are 3.3V, not 5V (because I’m a tart and was experimenting with long term, low power usage kit) so this may present a challenge. Also it’s rated at 3W, which at 5V is a max draw of 600mA, way more than the 40 mA an Arduino’s digital pin can provide.
This means I’ll have to set up another voltage line at 5V and control it from the Arduino. In the real world I’m going to power the Arduino from Solar with battery backup. This means I can happily set up a SparkFun Sunny Buddy charger with a 5V Li-ion battery.
If you’re wondering how to connect a solar cell, battery, and load check out this SparkFun tutorial.
… After some testing it appears that although a 5V 1A direct connection to a USB port can power the motor, the same is not true of the 3.7V 2000mAh 1C (Thus max 2A) battery I’m using. I’m going to have to use two batteries in parallel, which means I’ll have to remove the solar charger (as it’s designed for single cell charging only).
This means power usage is a big thing, but thanks to my previous work on minimising Arguino power usage, I’m well placed to address this.
I’ve ordered some bits to get my pot plant (indoor) version working, so watch this space and I’ll post back progress!!!
Phase 3: All working together
I’ve had to order some more boards and bits and pieces for testing, so I’ll stick up the final design when I’ve figured it all out…