Using the Sparkfun Moisture Sensor in our Herb Garden

Here's What You'll Need to Make Your Sensor

The SparkFun Moisture Sensor is a new addition to the FRL catalog, so we thought we'd give it a try tending our new herb garden.  Hopefully, these fresh sprouts don't go the way of our poor African Violet and we'll be able to enjoy some fresh herbs by summer.

Here's How To Hook it Up and Program It

The Soil Sensor requires an input voltage and ground, and in exchange gives you a signal that can be read by an analog input on the RedBoard.

Once you have the wiring complete, you need to calibrate the sensors input using the following code and the serial monitor.


The calibrate the sensor, we measured air, water and a dead African Violet plant we had.  The open circuit (air) registered a 0 on the serial monitor.  The water registered a value of ~750, so this was the upper limit.  The (neglected) African Violet measured a 250, but we didn't want to set this as the lower limit, because by that point it was too far gone.  We set our threshold for the signal at 400.We used 3 points to create a threshold for our "dry dirt" warning, which is blinking an LED on Pin 13.

The last command outside of the simple "IF" statement is just a delay that checks the moisture content periodically.  This was a pretty easy little project, so lets hope it keeps the Sage alive.

The blinking light means trouble.