Automatic watering and monitoring - AKA Garduino

I decided to grow tomato plants from seed this year and with typical lack of forethought I planted a several small tubs of tomatoes plus a few courgettes and french beans for good measure just a couple of weeks before our planned holiday to Spain, for two weeks. Without watering these seedlings would perish during our fortnight away, which seemed a bit of a shame.

I'd been meaning to look into Arduinos for a couple of years as this seemed like fun and I used to love tinkering with electronics as a child, much to the dismay of my brother, whose toys I might have cannibalised for parts, when he'd already broken them of course.....

So after research I hatched a plan to keep my seedlings alive whilst we enjoyed the pleasures of Andalucia. I purchases an Arduino Uno, a real time clock (RTC) board, relays, temp and humidity sensor, soil moisture sensor, ultrasonic distance sensor, peristaltic pump plus connectors and silicon tubing. Many late nights later I had a bodged together a contraption that just might work.

I wrote an Arduino sketch that would activate the pump via a relay for 20 seconds per day at 8pm, watering the plants. Rather than just leaving it at that I added a host of sensors that the Arduino would monitor and send data via serial port to a Rasberry Pi. The Pi would then in turn forward on the data to a MySQL database that I could then use to create a webpage, which I could monitor over the internet from spain.

The sketch checked each sensor every 10 minutes and output the data to serial as XML. The temp, humidity, and soil moisture sensors are pretty self explanatory, but I also used a ultrasonic distance sensor to measure the depth of water left in the bowl being used as a reservoir.

Unfortunately I ran out of time for in depth testing before leaving for our holiday. Everything was put into place on our kitchen sink, switched on and left to fate. With the combination of untested electronics, water and an empty house, what could possibly go wrong.....

We arrived in spain and I could see the data coming every ten minutes, lovely. But then after 8pm UK time I expected to see the soil moisture sensor readings change to indicate that the pump had run and that the soil had been watered. But nothng happened..... The moisture sensor just kept showing drier and drier. Crap. The pump must not be working or not working long enough to wet the soild sufficently to register on the soil moisture sensor.

I continued to monitor the readings for the rest of the holiday but with the soil moisture data getting drier each day I held little hope that my seedlings survived :(

Imagine my amazement when we got home after a fabulous holiday to find this sight!!!!

The pump had been working all along and we had healthy happy plants ready to be put into pots and grow bags :) I must have placed the soil moisture sensor in a spot too close to the side of the tray in an area that remained dry. Further testing showed the soil moisture sensor to be a bit crap anyway. The Garduino was a success!!!

Cheers to Duncan for help with the script to parse the serial data on Pi :)