A low-cost, remote soil moisture sensor with a 3G connection to the web.
The Soil Cell is a web-connected environmental sensor unit used to monitor soil moisture levels. It uses a low-cost Electron microcontroller and the 3G cellular network to transmit data to a website or server of your choice. (In this tutorial, we will view the data on the free cloud service Ubidots.) The Soil Cell is buried underground and sends data at whatever interval suits your needs. Here, we’ll be sending data every two hours and plotting the results online. You can also enable alerts through Ubidots to send a text or email when your soil moisture falls below a specified value; this is helpful for coordinating watering for vegetation.
This is a modular design. Add a second or third soil moisture sensor or measure humidity, light level, air quality, or water level. In addition to soil moisture and temperature measurements, we’re going to keep track of the device’s battery level and the strength of the cellular network signal.
You need a cellular signal in your area for this to work. If you live in an area with no cellular network access, consider building a datalogger.
In monitoring locations where the Soil Cell is safe to be placed above ground, we have added a solar panel and charging battery (such as this one) to power the Electron.
Below are the materials you will need to build your Soil Cell. Many of the product links refer you to Amazon or Adafruit, an online electronics retailer. We do not endorse any specific retailer; feel free to shop around online for the best prices. Shipping costs not included below.
Particle Electron 3G: $69
Vegetronix VH400 soil moisture sensor: $40
10K Thermistor: $4
Waterproof case: $7
PG7 cable glands: $5
Silicone caulk: $3 at home improvement store
Dessicant packs: $5 for pack of 20 at home improvement store
You will also need a computer, a drill and a shovel.
Total Cost: ~$135
Upload the Code
Register for a free account at ubidots.com. Ubidots is a cloud service where the data will be sent and stored. Once you are registered, go to the Settings tab and create a short token. Next, create a new data source under the Sources tab. The source is your Soil Cell device; call it Soil Cell or Garden Monitor or Fred and add a description if you like.
Now that you have a Source, create four variables (click on “Add Variable” under Sources); call them Soil Moisture 1, Soil Moisture 2, Battery Level, and Network Strength. When you click on each variable, you’ll notice each has a unique ID in the left-hand sidebar.
Note: This code will not compile in the Arduino IDE. You must compile the code on Particle’s platform (either the Web IDE or Particle Dev desktop IDE). Please see Particle’s website for more detail.
Assemble and Deploy
Using a handheld drill and a 1/2-inch bit, drill a hole in the bottom of the case. Thread the soil sensor wire and thermistor through the head of a cable gland and through the hole into the case.
The VH400 soil sensor has three wires: ground (bare), signal (black), and power (red). Connect them to the Electron pins as such (you can press the wires into the pins with your fingers):
Soil 1 red wire > D0
Soil 1 black wire > A0
Soil 1 bare wire > GND
The 10K thermstor requires a 10K ohm resistor. Wire the thermistor as shown in this tutorial and use D6 as the power pin and A5 as the analog signal pin.
Once the sensor wires are securely in the pins, adjust the cable lengths in the case, tighten the cable glands, and caulk around the gland both inside and outside the case. Throw in a few dessicant packs and plug in the battery.
Did we forget to dig the hole? We forgot to dig the hole! We don’t recommend burying the Soil Cell case more than a foot deep, as that degrades the network signal and makes it more difficult to dig up. The soil sensors can be installed horizontally at whatever depth you desire. Be sure to insert the sensor probe into undisturbed soil, taking care not to break the plastic probe and avoiding rocks or anything that my create an air pocket around the probe. You want maximum contact between the probe and soil.
We also recommend a flag or stake in the vicinity of the sensor unit so that it can be found when you return to change a battery or perform maintenance on the unit.
View the Data
Log in to Ubidots anytime you want to see the latest data. Ubidots will automatically generate a plot of your data, which you can embed on any website. You can also download text or csv files of archived data.
For greater accuracy, calibrate your soil sensors. We have used this procedure from Decagon in combination with the ASTM method (shortened version here) for using a microwave oven to dry the calibration samples.