My Blög

An internet connected soil moisture sensor


The Electric Imp makes it so easy to put things on the web to make that web of things everyone is talking about. I decided to build a soil moisture sensor that alerts when plants need watering. This my oh-so extensive list of requirements:

  • It should connect to the net and log to Cosm
  • It should send SMS or other notifications when attention is needed
  • It should monitor soil moisture and water level so you either stick the sensor in the soil and measure VWC (Volumetric Water Content) or put it in a self-watering pot where it measures water level
  • It should run on solar power with battery backup
  • It should not be awfully expensive

Some research on the net quickly pointed out a moisture sensor from Vegetronix that measures both moisture and water level. It’s super easy to use, solidly built, won’t corrode (an almost inevitable fate for cheaper moisture sensors) and operates on very low effect. Perfect for me, except that they are a bit pricey @US$38 each. But WTF, YOLO and so on, they are the best.

The Electric Imp is the bridge between the sensor and the net. It has six IO ports that all can handle Analog-to-digital conversion but I decided to limit the number of probes to three, and save the rest of the ports for other needs. One port controls power to the soil probes. One input will monitor battery level. This leaves one IO port for future needs. Here’s a sketch of the electronics:


The soil probe delivers a voltage from 0–3 volts depending on how moist it is. I tossed in a simple protective circuit in front of on each input port; a voltage follower with a 3.3V Zener diode to ground that protects from over-voltage and a 1M pull-down resistor to ground that pulls down to 0V if no probe is connected.

Then there is a N-type MOS-FET (horribly rendered in the sketch above) connected to an output pin on the imp. Setting the output to high will open the FET and get juice to the probes. I squeezed everything into a little box and use a solar panel boosted rechargeable battery to provide power.

Here’s the finished prototype:

Moisture Guard

The rest is software. Quite simple stuff, but I’m using parts of the electric imps API which still is in closed beta so I’m not allowed to show it until it’s officially released. Will update when possible. But basically, the imp wakes up at regular interval, measures, detects if there is a significant change and if so reports to the server part of the Imp solution. The server then decides wether to notify or just log.

That’s all!

Per Ejeklint in disguise

Writings by Per Ejeklint, living and working in Stockholm, Sweden. Follow me on Twitter!