Evaluation of a ready-to-use Arduino-based device for wireless measurement of soil moisture, temperature and humidity over LORAWan

Public Chat
Similar projects worth following
The LORA soil moisture sensor (V2) is a compact ready-to-use sensor device for wireless measurements distributed by MAKERFABS. It is battery powered and has long range communication (up to 10km from gateway). The device is based on ATmega328P microprocessor and has sensors for measuring air temperature, air humidity and soil moisture.

Schematic, tutorial, wiki and sourcecode for realization of a LORA-based network are available.

The primary goal of this project is to evaluate the device with regard to its possible uses with LORAWan applications. For this purpose, several sensors are to be used in my garden, the data of which can be evaluated after transmission and processing via web interface and on mobile devices.

Since the corresponding source codes and instructions are not yet available, the functionalities for LORAWan must be implemented separately on the hard way.


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:

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 »

1 - 13.48 kB - 07/15/2021 at 14:14


20210715 lmic_project_config.h

LMIC config file for Europe

x-chdr - 385.00 bytes - 07/15/2021 at 13:57


20210715 Payload Formatter Uplink TTNV3 V0.1

TTN V3 payload formatter for uplink for transmission to Thingspeak

1 - 2.41 kB - 07/15/2021 at 13:54


  • 1 × LORA temperature/ humidity/ soil moisture sensor 868MHz (V2) Distributor: Makerfabs
  • 1 × USB to TTL serial adapter converter with DTR and 3,3/5V Needed to program the sensor device.
  • 2 × Battery Type AAA To give life to the sensor device.

View project log

Enjoy this project?



benny wrote 08/22/2022 at 15:22 point

i think i need some help, i used your code, but i always get SOIL 100% as feedback ...

keine ahnung warum

  Are you sure? yes | no

AG March wrote 08/30/2022 at 14:24 point

Please note that the values contained in the source code must be determined individually for each sensor. To do this, I simply use debugging via the serial interface and measure the values in the air (AirValue) and in tap water (WaterValue).

I haven't touched up the source code in several places yet. I'm glad the sensors are really running satisfactorily outside in the garden.

Debugging can also be usefull to determine whether the sensor is actually working technically correctly.

  Are you sure? yes | no

Tamadite wrote 08/01/2022 at 20:48 point

Thank you so much for this hack! I have used your code for the V3 of this device. You are credited on

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates