It’s spring and summer comping up, and I am spending a bit of money on flowers every year so I would like to know more accurately their condition. Weather can change from very hot to very wet and not all plants get what they need from rain – some plants also get to much water etc. The solution to this is a moisture sensor that report soil moisture once an hour as illustrated below:
Using my classic block diagrams I use a Blackpill – cheap STM32F401CC breakout in dip40 format – as base and create the circuit abobe. I add a battery and remove things like leds and add a single sensor – a low cost moisture sensor consisting of two pins I stick into the soil. This gives resistance that decreases with moisture, so a very wet soil (water) will give value 0 (Zero). I removed the circuit that came with the sensor and powered it from a GPIO pin + connected a 10K resistor in serie – that gives a nice ADC reading after a few ms allowing me to switch the sensor on/off.
Temperature of electronics are not that accurate, but it is sufficient in this case and vref are internal. I also have VBAT (not shown) – I need to experiment a bit with VBAT and VREF, but I expect they will show me the condition of my battery – if not I will need to add another sensor measuring battery so I can predict battery condition/life.
The more complex circuit is the LoRa transmitter. I decided on a 5.- USD E220-900T22 D or S for the moment. These operate through UART and is very easy to use. I will need to put this in deep sleep and wake it up every time I want to send data. I also put a 32KB FRAM chip that uses the same footprint as SPI Flash on the back of the BlackPill – 32Kb is a lot of storage and FRAM is very low power and fast and can be written to almost forever. It is a good solution if you want to sample more often than you want to activate the transmitter. I am just experimenting with solutions here.
The illustration above is the actual finish sensor. I will use an old plastic pill-container, put the sensor through the lid and tighten it up consealing the electronics and transmitter inside – painten in black or dark green it will be “invinsible” in my garden between my flowes. I obviously need a matching adapter as gateway, so I decided on a Raspberry PI connected to mainst that will act as a gateway between LoRa and Wifi. I can connect UART + 3 GPIO pins from Raspberry PI directly to the LoRa unit.
It will be no PCB on first prototype, but I will order a PCB later – this is the first time I do a low power LoRa project so it is an experiment. STM32F401CC is not optional, but I still believe I should manage to get ca 1 year’s operation out of a 1Ah/3.7V battery – lets see.
The way this shold work is that the sensor sleep most of the time and measure moisture every 5th or 10th minute – reporting results every hour or so. Sending uses 110mA so I have to be carefully with not doing that to often or to long. One option to LoRa is ESP32 & Wifi, but I decided against that because of distances in my garden and the 3-4 seconds needed to connect Wifi + nice to actually do something withy LoRa as well.