Home  |  Subscribe  |  Computerized Grow Box  |  LED Grow Box  |  PC Grow Box  |  

Friday, August 28, 2009

How to use Vegetronix soil moisture sensor (VG400) on Arduino

With the summer starting to come to a close it has been time for me to start thinking back to the computerized grow box.  I have been doing some considerable work on the electronics and software over the summer.  Better to break stuff while the plants are outside and not while killing them inside.

Though I have been happy with my homemade gypsum soil sensors I decided to try out a commercial option hoping for better accuracy and longer life.  This is important with my current plans to include automatic watering to the latest version of my grow box.  Don’t want to wake up to a flood in the garage due to a broken sensor.  After some looking I came across the Vegetronix VG400 which measures the dielectric constant of the soil using transmission line techniques.  Which I have no idea what that means but sounds impressive.

The hookup couldn’t be simpler, red wire to 3V, bare wire to ground, and black wire to an analog input.  As you can see below in my completely not to scale diagram below.

image

From here it all comes down to some simple code to write on the Arduino to get some values.

void setup()
{
  // Setup serial
  Serial.begin(9600);
}

void loop()
{
   Serial.println(analogRead(0));
  
   delay(200);  // wait 200 milliseconds
}

Upload the code to the Arduino and now I can get a moisture value from the analog input between 0 and 614 (0-3 volts) depending on the degree of water saturation. 

image

Though not as hacky as my PS2 controller moisture sensor solution definitely more elegant and reliable.  Stay tuned for more details of other improvements to the computer controlled grow box.

15 comments:

Anonymous said...

Have you had problems with your homemade gypsum soil sensors? How long do they last? Why do they break down?

I was thinking of making some of those, so I was wondering what problems you encountered.

Thanks for your informative articles!

Hank said...

Cheap Vegetable Gardener, what a great resource you have created here.

I am not nearly as techie as you, but I am searching for a "cheap" way to turn a 115v 1.3 amp submersible pump on when soil is dry and off when the soil is saturated. It sure looks like you have the solution here, but I am searching for more of a layman's explanation of how to make it happen ("insert tab A into slot B").

Probably too much of an imposition, but could you post such a thing?

Again, probably too much to ask, but I thought would try...

Cheers,
Hank

The Cheap Vegetable Gardener said...

Anonymous, actually they have been pretty durable and unless you move them around a lot they should last for at least six months. The problem is their property of being porous is the reason they will slowly breakdown after repeated submersion in water.

Hank, stay tuned will be including a write up of my latest version of my computerized grow box which may not be completely "insert tab A into slot B" but should be pretty basic.

Hank said...

Thanks so much TCVG, your generous sharing of ideas is really super...

In the meantime, I may try theVG400 and the VG-RELAY-DC from Vegetronics ... not that i really know how to connect it all up, but I may get lucky .... if I can make it work, and if its of any interest, I'll post results ...

The Cheap Vegetable Gardener said...

Hank, I should have thought of that. I haven't tried the VG-RELAY-DC but definately looks like a good programmingless solution. Just hook up the 3 sensor wires, + and - from power supply and split the cable to the pump (or better yet use a $2 extension cord from Home Depot.

Hank said...

Excellent ... thanks s much for the feedback ... I ordered a sensor and a relay yesterday ... will report back ... I guess I just need to add a 12VDC power supply

I would really like to try my hand at the Arduino solution at some later date...

Cheers,
Hank

The Cheap Vegetable Gardener said...

Hank, would love to hear how it works out for you. Arduino is actually pretty easy once you get past the initial learning curve. Though if you want to plug in it and be working relay sounds like a good option

Hank said...

Vegetable Gardener, received sensor and relay from Vegetronix. I think it will work very nicely for me: all I wanted to do right now was to turn my submersible pump on when soil is "dry" and off when "wet" and it seems to do exactly that. I tested it with the kind of wet and dry conditions I expect to see and adjusted the sensitivity on the relay board to get the on/off where I wanted it. Works beautifully. Easy to setup, even for me.

Continuing thanks for your help..

Cheers,
Hank

Hank said...

P.S. ordered an Arduino and parts to try http://www.make-digital.com/make/vol18/?folio=90

The Cheap Vegetable Gardener said...

Hank, did you see the garduino kit? I believe it is the same as the article you mentioned, though not sure how safe the 120V that close to the arduino...

Anonymous said...

Hi,

The Vegetronix sensor is a very nice solution. There is also a more consumer packaged version available here:
http://www.waterstik.com/Main.php?do=home

There is a nice comparison between different types of soil moisture sensors here: http://edis.ifas.ufl.edu/AE266

I think you could make your own sensors that measured the soil Dielectric constant, and thus soil moisture -- see the project link below.

I've tinkered with the idea of combining a moisture sensor like the Vegetronix with a wireless interface -- for instance the xbee: http://www.digi.com/products/wireless/point-multipoint/xbee-series1-module.jsp
It should be possible to program it so that it only wakes up a few times a day to report readings, so a battery would last a long time.

Here is a paper that describes a project that did something similar:

http://hulk.bu.edu/pubs/papers/2007/TR-05-02-2007.doc

James H Thompson
jht@lj.net

Hank said...

That's wonderful information, James. the Waterstik looks similar to the Vegetronix VG400, except better looking of course. too bad it doesn't have a little port to output to something like the Arduino ...

What do you think of the WiShield, combined with Arduino of course, as a potential wireless moisture monitor/control system? Could it be made relative easy for a neophyte such as myself? I don't think the wireless/net interface is absolutely necessary for my app, but it would be very cool!

Cheap Vegetable Gardener, unfortunately, I missed the Garduino kit information - I ordered the parts individually. The kit would have been nice... maybe for my next one.

Cheers,
Hank

The Cheap Vegetable Gardener said...

I guess while we are at it should also mention Botanicalls Plant Twitter Kit which as the name sounds twitters you when you plants need watering.

Though I haven't finished my latest version thoughts of a wireless grow box controller has defiantely been a consideration. As for Hank's question I am pretty sure there are enough example code out there you probably could do the wireless/networked solution shouldn't been too difficult.

Anonymous said...

The WiShield is a really nice solution and would be simpler than using a zigbee based solution.
But it depends on the scale of deployment, for one sensor its a great solution, but as the number of sensors goes up zigbee would be more economical.

James H Thompson
jht@lj.net

Hank said...

Hey Guys,

I was able to get a webpage up that reports on the moisture content, light and air temperature of my garden. I used the WiShield and the included SimpleServer software(for simple people like me).

At the moment I enter a local IP address on my LAN and the page serves up great. I did have a problem because my dlink router was an unreliable connection, but it works great on my linksys router.

I hope to add ph reporting and maybe a way to be able to view the local IP address on the WAN, if I can figure that out.

I love your Tweet application, Cheap Vegetable Gardener. I hope to try that out once I have time and how to incorporate your code into the my SimpleServer sketch.

Cheers,
Hank