Handheld Arduino Nano Capacitive Soil Moisture Meter With 7 Segment LED Display
by averiestg in Circuits > Tools
697 Views, 6 Favorites, 0 Comments
Handheld Arduino Nano Capacitive Soil Moisture Meter With 7 Segment LED Display
Simple, low-budget handheld capacitive soil moisture meter with a 4-digit 7 segment LED display and power button. Great for use in the field.
Supplies
Arduino Nano clone (~$5)
TM1637 7-segment display (~$3.50)
On/Off button (~$0.33)
Capacitive soil moisture sensor probe (~$1.13)
9V battery ($~1.13)
9V battery connector (~0.42)
Wires
Soldering iron + solder
Small cardboard box or other storage container for housing
Duct tape (optional)
Electrical tape or conformal coating (optional)
Total price = ~ $12 (compare to commercial $20 digital soil moisture probes)
This design was in large part due to my need to keep costs low, but also reuse components that I already had. I actually ended up only needing to purchase a Nano clone, moisture probe, and 9V battery connector, costing me under $7.
Description + Connections
An Arduino Nano clone was used as the microcontroller for this project, but this design is simple enough that nearly any 3V/5V microcontroller with at least 1 analog pin will work. The small size of the Nano enabled a compact design, ideal for field use.
Wiring:
TM1637
CLK ---- D3 pin
DIO ---- D4 pin
VCC ---- 3v3 power pin
GND ---- GND
Moisture probe
AUOT ---- A2 pin
VCC ---- 5V power pin
GND ---- GND
9V Battery
Pos+ ---- on/off button
Neg- ---- GND
On/off Button (Wiring doesn't matter here, as long as one wire goes to one prong, and the other wire to the other prong)
unused prong ---- VIN
Arduino Code
This code is very straightforward, and I tried to leave brief comments explaining each aspect.
Before you can get your soil moisture, you must calibrate your moisture probes, for details on this, see step 3.
Once calibrated, the "water" and "air" probe readings are used to map the probes current reading to a percentage from 0 (completely dry) to 100 (completely wet). I set the constrain to be from -10 to 110, to ensure that if calibration wasn't perfect that I would still get accurate readings. I also included the raw and percentage readings from the probe to be read in the serial monitor when plugged into a computer, to check if the probe is reading correctly.
Downloads
Moisture Probe Callibration
This very simple code can be used to determine the soil capacitance (raw) and percentage readings for your moisture probe. You can also get this information from the code above, but I find it helpful to have this file on hand when I am working on more complex codes.
To calibrate your probe:
Step 1: Upload this code to your nano and run it
Step 2: In the serial monitor, you will see readings for "Soil capacitance" and "Soil %"
Step 3: Make sure your probe is completely dry, while holding the probe record the "Soil capacitance" reading into "p1ValAir," replacing the value of "260" that is there by default
Step 4: Submerge the probe into a cup of water, making sure not to go further than the white indicator line. If you get water above this line, you risk damaging the electronics.
Step 5: Allow the serial monitor to read from the probe for a few seconds until the "Soil capacitance" value stops changing. Be sure to hold the probe steadily in the water or you may get fluctuating readings. Record this value as "p1ValWater," replacing 571.
Step 6: Run the code and you should now see the calibrated "Soil %" readings in the serial monitor.
Note: If you have multiple probes, you must calibrate each one individually.
Downloads
Housing
In an effort to contribute as little as possible to the current over consumption crisis, I opted to use recycled materials to house the moisture meter. I dug through my recycling and found a small cardboard box (9 cm X 6 cm X 5 cm) to use as housing. I measured the dimensions of the TM1637 and the button and carefully cut holes where I wanted each to be placed. A small hole was cut into the bottom of the box to allow the probes wires to run out.
For aesthetics, and somewhat increased durability, I covered the box in duct tape. My box happened to have a small tab to keep the lid closed, if yours does not, you can easily make one by taping on an extra small piece of cardboard and cutting a hole for it to fit into.
Check Your Soil Moisture!
Use of the soil moisture meter is simple, insert the probe into soil until the white line is reached, hit the power button and the LED will display the moisture percentage. Just be sure the wipe any remaining soil off of the probe before taking another reading.
This instructable was hopefully an easy to follow and comprehensive guide to building a tool to measure soil moisture on the go. This is the first part of a much larger automated watering system that I will be posting an instructable for soon!