Monday, July 1, 2013

Soil moist monitor/manager and logger!

The 'what if' problem...
This project started with a LED, a moist probe and an arduino. Then I thought "what if" adding another probe? After that, "what if" adding an SD shield to log the values? 
When done, "what if"... You understand what I mean, I'm sure. 


So this ended up in a complex system as described:


- 3 Moisture probes, (max) which can be grounded (with a jumper or so) this way you can use from 1 to 3 probes as you need them. (as the one you can see in the picture)

- 3 Solenoid outputs, which will set up the watering of each probe plant (solenoid 1 will open if soil moisture probe 1 alerts for a thirsty plant.)
- 1 Digital thermometer, to log temperature.
- 1 LED.
- 1 Press button.
- 1 RTC (pointless to have a logger without date/time).
- 1 SD shield and card to retain system data.
- 1 arduino board or a DIY arduino board.
My self made board design can be viewed in the picture:
 Now, the most important, how does all this works?
You use as many probes as you want, with a maximum of 3, and connect all the devices, the system boots up, and the led will give you information about the moist:
- 2 blinks - too wet... :(
- 1 blink - GREAT! 
- Fading - too dry.

In the last state, the output pin for the solenoid will turn HIGH and open a TIP120 or a relay circuit (not done yet) to open the solenoid and then water the plant.
The time of each reading is 15 minutes, which changes to 2 minutes when a plant is dry and the solenoid opens, to assure a more accurate watering.
There is also a press button for knowing the water needs at any time, once pressed, 1 second or so later the LED gives you the information needed, not written to console nor SD card.
The logger has a format like this:

Initializing SD card... Warming up!! Starting!!!
Date    Time    Temperature    Pb1    Pb2    Pb3    V1    V2    V3    Ws1    Ws2    Ws3
2013-07-01    20:41:59    24.50    81.64    76.27    76.56     4.08     3.81     3.83    0    0    0   

 
It can be worked out in a spreadsheet or any program that deals with this kind of data, (separated by tabs). A file is created EACH month with a name like "201306.csv" which stands for the year and the month. V1, 2 and 3 are the voltage values read by arduino and Ws1, 2 and 3 are the watering status, a boolean value which is 0 or 1 depending of the watering status, 1 when watering.
I hope You enjoy this, (as I wrote, I have many flavors of this, with several combinations) now go monitor your plants, mine have never been so pretty since I started this, and though I don't have the solenoids working, the LED indications are usefull enough to get them awesome!
The code.The prototype configuration on the picture:
Used this SD library and this RTC library.