My roommate and I were looking for gardening supplies in a local hardware store when we ran across this. It’s a cheap ($18) soil moisture gauge -- it’s a simple unit that blinks when a plant needs to be watered. I’ve been looking for inexpensive ways to measure soil moisture for a side project, and this seemed to be a good fit… Except that it’s a consumer device -- it has no kind of digital or analog output. So I did what any curious engineer would do -- take it apart!
The most basic way to measure the moisture content of soil is by a resistance measurement. Just stick two bare electrodes in the ground and measure how much current flows between them. More water -- more current flows -- less resistance. The problem with this technique is that other factors can also effect the resistance of the soil -- like salt content from plant food and other chemical additives. You can get around this by encasing the two electrodes in a solid filtering material like gypsum, which passes water but blocks salt and other chemicals. This is probably the least expensive type of sensor, but there has to be a better way, right?
My hypothesis is that this moisture gauge uses an AC impedance measurement like the Vegetronix VH400. There is only one way to find out:
I was a bit too excited to take photos of the unit before tearing it out of it’s plastic case. I can tell you that the plastic case is not designed for easy dis-assembly - I couldn’t find any snap points. So I basically just ripped the two plastic halves of the case apart. These photos are from a little later in my testing (try to ignore the extra black wires for a moment):
Sensor Overview - Top
From the top side, we can see that the sensor itself is only two strips of copper on a PCB (underneath the white numbers). Then there is a small control area with a few ICs and a button. Lastly, there is an RGB LED poking out of the top of the PCB.
Sensor - Back Side
The bottom side of the board doesn’t reveal much of anything new -- on the rear of the control board there are contacts for two batteries, as well as two small pads (later discovered to be MSP430 JTAG pins). Let’s take a closer look, shall we?
Sensor circuit closeup
Right away, it’s hard not to notice the single IC in the middle of the board -- that appears to be an MSP430F2012 microprocessor, neat! To the left of the MSP430, there seems to be some current limiting resistors for the RGB LED, an RF bypass capacitor for the microcontroller, and a diode. That implies that the three components on the right (R8, D3 and C4) are the only ones needed to measure soil moisture. It also became apparent that one of the two strips of copper inserted into the soil was connected to the ground plane of the circuit, and the other leg was connected to the node shared by R8 and D3. Right away, I soldered a short wire to each of these copper strips and created a bit of a test jig to view the circuit while powered on:
Initial observations - pulse-burst on left, closeup on right
Right away I noticed that the sensor was already driving the two copper strips, even before the button is pressed to take a measurement. On the left you can see a ~70us burst of a 1MHz wave, which seemed to occur every 100ms or so. Since the two copper strips are acting like a large capacitor, the 1MHz signal is slew rate limited and the signal is easily affected by any objects nearby. I noticed that holding the sensor in my hand changed the amplitude of the measured wave. It looks as if the MSP430 is creating a standing wave in the electrodes. The amplitude of the resulting wave or SWR (Standing Wave Ratio) should be a function of the characteristic impedance of the electrodes, which probably varies with moisture content! Looking at the Pk-Pk voltage of the standing wave, I did a quick test comparing the electrodes in air versus dipped into a glass of water:
SWR test - left: dry air - right: dipped into water.
Lo an behold, the peak amplitude changed. This must be how the MSP430 measures the moisture content of the soil, by looking at the amplitude of the wave. I assume that there is some part of the circuit that is creating a wave on the electrode, and another part of the circuit that is measuring the amplitude of the peaks (an envelope detector). Impressively, the circuit does this with only three components! (Ok, maybe a few more if you consider the internals of the MSP430. Here is a schematic I inferred by scoping around the board:
Possible sensor schematic
Measuring the voltage at one end of R8 I saw a proper square wave, indicating that the electrode is driven from that side of the circuit. The other side was a little bit trickier to determine, since D3 is actually a 3 terminal device, and I didn’t get any hits when looking up the markings on the case (WW1 97 markings on a SOT23 package anyone?). After some trial and error I assumed D3 was a diode, and acts to discharge C4 to the level of the peaks on the electrode waveform. Measuring the voltage drop across C4, we can see exactly the same signal that the MSP430 is measuring. Here probe 1 (top, yellow) is measuring the input to the ADC, and probe 2 (bottom, blue) is measuring the voltage on the electrode:
peak detector in action
Before taking a measurement, C4 is somehow charged up to approximately 3V. I think that the circuit is cleverly using a pull-up resistor internal to the MSP430, which is shut off right before measurement. During measurement, the electrode is excited with the 1MHz wave, while C4 is allowed to discharge through the diode. We can see the voltage level gently fall until it roughly corresponds with the peak values of the electrode voltage. Presumably an ADC measurement is taken towards the end of the curve, once the voltage has stabilized. Then the driving wave is turned off, and the pull-up is re-enabled, quickly charging C4 back up to 3V.
So there you have it! I haven’t yet decided how I will use this in my project. I have a few other sensors on order that I want to test out. I’d love to use this particular sensor in my project, but it would involve opening up lots of these, soldering delicate wires, wrapping it all back up and hoping it’s still waterproof. If only they had included some kind of raw output… Maybe i’ll design my own! We shall see…