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)
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
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.
- Change of the open TTN LORWan server to a private LORAWan server
(Chirpstack, already set up on a Cubietruck, but not yet put into operation). This is already planned for the LORAWan devices already in use (Dragino LHT65 / LDS01 / DLOS8, Adafruit Feather M0 RFM95, etc.).
- Establishment of a private toolchain for processing the sensor data via a
Mosquitto MQTT Broker (already set up on a/the Cubietruck, but not yet put into operation) including the evaluation and display of the data (web-based, databases, smartphone app).
- Waterproof case, - especially for outdoor areas and greenhouses.
- Expansion by...