Device
The Lora Soil Moisture Sensor is a nice combination with the following components on a single circuit board:
- ATMEL AVR 8-bit Atmega328P with Arduino Pro Mini (3.3V/8M bootloader pre-loaded)
- LORA module RFM95W with coil antenna
- Soil moisture sensor V1.2
- Air humidity and temperature sensor AHT10
- Battery holder for 2 AAA batteries
- MOSFET-based sensor power control
- Optional 3D-printed case (not waterproof)
LORAWan Node
The following additional libraries are used in the ARDUINO IDE for a first prototype:
- MCCI LoRaWAN LMIC library, version: 4.0.0
- Lightweight low power library for Arduino, Version 1.81, Date 21-01-2020
- AHT10 library (github Makerfabs)
The basic framework for the sketch is the OTAA example from the LMIC library. Of course, special attention should be paid to the regional adaptation of the lmic_project_config.h file. The correct pin mapping can be derived by the circuit diagram. The source code for reading out the soil moisture sensor and the AHT10 was taken from Makerfabs' project documentation. The low power library is intended to reduce the energy requirement between each measurement and transmission. In addition, the battery voltage is determined via the bandgap voltage of the processor. The individual sensors are only supplied with energy for measurement.
Some difficulties with the AHT10 could be reduced with an additional queue, but could not be completely resolved. The cause here may be the AHT10 itself, the sleep mode and the control of the supply voltage. Due to the utilization of the flash memory with 92% and the dynamic memory with 85%, various unpredictable instabilities and runtime errors can be caused by the sketch. Perhaps a more efficient LMIC library can be used later. At the moment the device seems to be running stable, but I will be happy to share my long-term experiences.
LORAWan TTN integration
For the integration in TTN V3, an application with a device is usually created. The values for APPEUI, DEVEUI and APPKEY specified for the device are entered in the sketch (note the bit order according to the example, TTN generates the necessary character strings for copy-paste at the push of a button). The preparation of the payload for the integration, e.g. of Thingspeak, takes place via a payload converter in Javascript.
LORAWan Chirpstack Integration (privat)
Implementation of the following toolchain was successfully completed: OS Debian 11 on a NUC with Chirpstack, Mosquitto, InfluxDB2, Nodered, iobroker, Grafana and a lot of more stuff.
Unfortunately I had to abort the full implementation on a Cubietruck because the architecture is not well supported. At least Mosquitto, InfluxDB (V1) and iobroker work, so at least some services can be outsourced later.
Sensor calibration
The AHT10 is inherently imprecise and is subject to a good spread, so calibration is not required here. Since the sensor is used close to the ground, the measured temperature is likely to be a mixture of ground and air temperature. The air humidity cannot be evaluated anyway if the housing is sealed watertight (necessary outdoors and in a greenhouse ...).
The soil moisture sensor can be calibrated by recording the measured values in the air (0%) and in clear water (100%). A series of experiments with soil that is moistened in a defined manner is more complex. Here you can consider whether the effort is worthwhile, since ultimately the measured values in the real environment depend on the actual soil composition, water type and also on the positioning in the bed. Realistically, I consider the measured values as a rough guide as to whether it is necessary to water. I'd better leave everything else to scientists.
The battery voltage sensor is calibrated by a form factor calculated by the measured value of the insight and outsight voltage.
Experiences with the Prototype No. 1 in the field
The device has been working flawlessly for a month. I could increase the resolution of the soil moisture by...
Read more »
i think i need some help, i used your code, but i always get SOIL 100% as feedback ...
keine ahnung warum