logo elektroda
logo elektroda
X
logo elektroda

Wireless soil moisture sensors

Sareph  12 71655 Cool? (+25)
📢 Listen (AI):

TL;DR

  • A wireless soil moisture sensor for flower pots uses an STM32F030 with an LT8920 2.4 GHz radio to report when watering is needed.
  • The probe measures moisture capacitively with a 2.4 MHz PWM signal, PCB tracks and wet soil forming the filter, then a diode-capacitor maxima detector feeds the ADC.
  • The LT8920 needs only two capacitors and a 12 MHz crystal, sleeps at about 6 uA, and costs 25 cents apiece.
  • Measurement and transmission take about 55 ms every 5 minutes, and the design is estimated to run roughly 8 months from a 400 mAh LiPo.
  • Range is limited to about 1-2 concrete walls, documentation is terrible, and the current version cannot fully disable data traffic without disconnecting the battery.
Generated by the language model.

Since my girlfriend is a flower freak, she marked something to stick in the ground, forget about the fact that it is in the ground for a few months and in the meantime find out about how much water is in the ground (aka "when it's best to water" ), preferably via WiFi. With WiFi, nothing came out, because in total everything that uses WiFi has electricity consumption from space, and we want to have about half a year of work on a 300-400mAh battery. An option was still BLE (nRF52), but it also dropped out due to little convenience.
It ended up with the STM32F030 paired with the LT8920. The STM does not need to be introduced, and the LT8920 is a 2.4GHz radio transceiver, the main advantage of which is the small number of additional elements needed, all two capacitors and a 12MHz crystal are needed. In addition, the power consumption in sleep at the level of 6uA and the cost of 25 cents apiece. But there is no rose without thorns, the range is ok in practice, but it could be better: about 1-2 concrete walls, and terrible documentation.

The humidity measurement is performed by the capacitive method:



2.4MHz PWM signal with 30% duty cycle is fed to the input of the measuring system. After passing through a filter consisting of PCB tracks, any ambient water and R2 is flattened. We are interested at the moment what is more or less the maximum level after filtering, and this can be measured by a maxima detector composed of D1 (it is actually 4148 diode, there was no corresponding symbol in the eagle at hand), C1 and R3. After that, even a not too fast ADC and the determination of voltage levels in dry and wet environments for calibration is enough.



Charging via mini USB socket using TP4057, stabilization to 3V is provided by HT7530-7, both in SOT23-5 housings. The peak current consumption during measurement / transmission is about 60mA, 22mA in reception, and in sleep mode it does not exceed 30uA. Measurement / shipping takes place once every 5 minutes, it takes about 55ms. This theoretically should allow you to work with a 400mAh lipo battery for about 8 months, taking into account the 3% self-discharge and without considering the manual listening mode.



The system has one button, the operation of which differs depending on the holding time:

* single press - immediate measurement and sending the current data in the packet (LED blinking)
* hold for 3s - the system goes into the listening mode, it allows you to remotely switch to the bootloader and upload new firmware via the radio or read data live via the control unit, possibly also changing the parameters (LED flashing every 1s)
* hold for 10s - reset + bootloader input for 30s (LED blinking 3xs)

Currently, there is no other option to turn off data traffic than disconnecting the battery. But I think that changing the STM32F030 to F07x would give the option to configure via USB, useful in case of some very wrong settings. This, however, maybe in the next version, the current one works quite well for our needs.



When measuring soil moisture, the system also measures battery voltage, optionally temperature (NTC), and USB voltage during charging.

A clock is used to collect data from sensors:



Built on STM32F107 (and 18 matrix displays 8x8 20 / 1.9mm), it has an Ethernet port, several sensors specifying the parameters of the environment in which it is located and a transciver on the LTC8920 which allows it to exchange data with sensors.



But this one will be described more precisely as my darling will do something meaningful with his WebUI ;)

About Author
Sareph
Sareph wrote 638 posts with rating 378 , helped 65 times. Been with us since 2004 year.

Comments

Anonymous 01 Sep 2020 13:11

I understand that the fill and frequency of this signal is constant? What was the dictated choice of these parameters? [Read more]

Sareph 01 Sep 2020 13:16

Yes, she was. I experimented with the widest measuring range, in this case 2100 by 12bit ADC. [Read more]

398216 Usunięty 01 Sep 2020 14:23

How do you protect the tile against moisture? [Read more]

Sareph 01 Sep 2020 14:31

I did not protect, the solder mask is water resistant, and the FR4 does not absorb it. One thing I did not mention - the sensors will get housings at a free moment so that an accidental clearing does not... [Read more]

gkalfail 01 Sep 2020 15:48

A very nice design. Congratulations! I am interested in what is the matter with the antenna. Is it just a 1/4 wavelength piece of wire? You don't need any impedance adjuster or something like that?... [Read more]

Jogesh 01 Sep 2020 16:23

And what's the range in open space? Didn't you prefer to use the 'L' series Prock. They are more energy efficient. [Read more]

Sareph 01 Sep 2020 16:26

Oh, thank you. Exactly. As I wrote, the documentation for the circuit is impaired and contains absolutely no hints as to what this circuit likes best for its antenna. And the sample layout in... [Read more]

pier 02 Sep 2020 08:01

The + 12V symbols on the diagram are probably an error? Have you been using these sensors for a long time? I am asking because I have been testing my version for several months and I noticed that the... [Read more]

Sareph 02 Sep 2020 08:29

Yes, I copied this fragment from another schematic where it was actually 12V and it just stayed that way. About a month and I noticed something like this, but it does not happen by itself, but for... [Read more]

.:KoSik:. 04 Sep 2020 12:50

Very nice design. Some time ago I made a similar project but powered by CR2032. It has been working on one battery for 4 months without a noticeable drop in voltage, so it should last a little longer.... [Read more]

Sareph 04 Sep 2020 14:39

Oh, thank you. I was wondering about 2032, but with the peak consumption of about 60mA, I found that I would not test how they would behave and I would take a safe option. ;) Hmm, I think that... [Read more]

kaczodp 08 Sep 2020 18:19

The D1 diode disturbs the measurements a bit. This method of measurement was used in analog meters. Capacitance can be measured by measuring the pulse time, not the voltage. The diode is not needed and... [Read more]

FAQ

TL;DR: 60 mA peak bursts enable ~8 months on a 400 mAh Li-Po; "works quite well" [Elektroda, Sareph, post #18900400] A 2.4 GHz LT8920+STM32F0 sensor transmits moisture data every 5 min through 1-2 concrete walls. Why it matters: Long-life, low-maintenance wireless probes simplify indoor and balcony plant care.

Quick Facts

• Power budget: 60 mA TX/RX, 30 µA sleep, 3 % monthly self-discharge assumed [Elektroda, Sareph, post #18900400] • Battery: 400 mAh Li-Po, USB mini-B charging via TP4057 [Elektroda, Sareph, post #18900400] • Radio: LT8920 2.4 GHz, 6 µA standby, ≈ $0.25 each [Elektroda, Sareph, post #18900400] • Range: 1–2 concrete walls indoors, ≈ 100 m open air at minimum speed/maximum power [Elektroda, Sareph, post #18900869] • Antenna: 31 mm (¼-λ) wire, no matching network used [Elektroda, Sareph, post #18900869]

How does the capacitive soil-moisture circuit work?

A 2.4 MHz, 30 % duty PWM excites the PCB probe. After an RC filter, the peak voltage is captured by D1-C1-R3 and read by the 12-bit ADC. Higher soil permittivity raises the peak, giving a monotonic voltage-to-moisture curve [Elektroda, Sareph, post #18900400]

Why exactly 2.4 MHz and 30 % duty?

The author swept frequency and duty to maximise ADC span; 2.4 MHz/30 % delivered a 0–2100 code window on a 12-bit converter, improving resolution without extra gain stages [Elektroda, Sareph, post #18900589]

What real-world battery life is achievable?

At 55 ms transmissions every 5 min, average current is ≈ 0.34 mA. With 400 mAh capacity and 3 % self-discharge, runtime calculates to about 8 months [Elektroda, Sareph, post #18900400]

How far can the LT8920 link reach?

Indoors it penetrates one to two concrete walls reliably. In open space, minimum data rate and maximum power should yield roughly 100 m line-of-sight, though documentation is vague [Elektroda, Sareph, post #18900869]

Do I need impedance matching for the antenna?

No matcher was used. A straight 31 mm solid-core wire soldered close to the RF pin provided stable links. For repeatable production, keep 50 Ω microstrip from chip pad to launch and maintain ≥ 3 mm ground clearance around the radiator [RF Basics Guide].

How is the PCB protected against moisture?

Only the factory solder-mask shields the copper; FR-4 absorbs negligible water. Planned clip-on housings will stop accidental splashes. For outdoor pots add acrylic conformal coat and potting compound around the USB jack [Elektroda, Sareph, post #18900725]

Would an STM32L cut power even further?

Yes. STM32L0 stop current falls below 1 µA; switching could extend life 1.5-2×. The designer stayed with F0 parts already in stock, meeting the six-month goal without extra BOM lines [Elektroda, Sareph, post #18900869]

Why are +12 V markings on a 3 V board?

They are leftover labels copied from another schematic. All operating rails are 3.0 V after the HT7530 regulator [Elektroda, Sareph, post #18902054]

Can I eliminate D1 and still measure capacitance?

Yes. Time-to-threshold methods charge the probe and count microseconds, widening dynamic range and removing the diode drop. STM32 timers can capture this directly in hardware [Elektroda, kaczodp, post #18913760]

How do I force a reading or enter bootloader?

  1. Short press: instant sample + transmit (LED blinks).
  2. Hold 3 s: listen mode for OTA firmware or live data (LED flashes 1 Hz).
  3. Hold 10 s: reset and 30 s bootloader window (LED triple-blink) [Elektroda, Sareph, post #18900400]

Which other parameters can the node report?

Alongside moisture it logs battery voltage, optional NTC temperature, and USB charge voltage, giving a complete power profile [Elektroda, Sareph, post #18900400]

Edge case: How does salinity affect readings?

High ionic content increases dielectric loss, shifting the capacitive value downward and faking a ‘wet’ reading. Professional probes compensate using dual-frequency excitation; DIY users should avoid fertiliser build-up near the electrodes [kaczodp comment, #18913760].

How do I build a ¼-wave wire antenna?

  1. Strip 31 mm of 24-26 AWG solid wire (for 2.45 GHz).
  2. Solder vertical to the LT8920 RF pad, keeping trace under 5 mm.
  3. Leave at least 3 mm clearance from other metal for one wavelength around the tip. Done.
Generated by the language model.
%}