
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

Cool? Ranking DIY