Read fully, thanks.
Important disclaimer: this was just me tinkering with the code to get it to work for EU868 as the file was too large to compile. For US915 you would not need to follow these steps. Please note that my tinkering is by no means a guarantee for reliable working code but it has been running well for me.
Initial installation:
- Install Arduino IDE
- Open https://github.com/gradoj/Lora-Soil-Moisture-Sensor, download the libraries for Arduino IDE and download the V3 Helium folder. Please read the repo for little more info.
- Generate keys in Helium Console. Copy LSB format for DEVEUI & APPEUI. Copy MSB format for APP KEY. They need to be in those exact formats otherwise it won’t work!
- Open de downloaded Arduino code in Arduino IDE (
HeliumMakerfabsSoilMoistureV3.ino).
- Fill in the copied device keys in the code (
APPEUI, DEVEUI, APPKEY).
- Change LoRaWAN region from MCCI LoRaWAN LMIC library:
Open Arduino\libraries\MCCI_LoRaWAN_LMIC_library\project_configComment\lmic_project_config.h.
Comment #define CFG_us915 1 (default), uncomment #define CFG_eu868 1 and save.
- Since EU868 somehow uses more space we need to remove some
serial.print statements from the code. I removed the following lines:
Line 202 (case EV_LOST_TSYNC: ...) to line 217 (… ALIVE")); break;)
Line 322 (if (humi … use)!"));)
Line 345 (//Print the results …) to line 363 (… Serial.println(F("% \\t"));)
- Connect your programmer to the sensor. Select “Arduino Pro or Pro Mini” for the board. Select “ATmega328P (3.3V, 8MHz)”. Make sure the right COM port is selected and hit Upload. If it’s not uploading hit the RESET button on the sensor and press Upload again (worked for me).
- Decoder from https://gist.github.com/denicola2/79639d7b17bf1b828c7cfeffedee0a13 works. GL!
Calibrating the sensor
We noticed not all sensors are calibrated the same. To calibrate the sensor we can use the raw ADC values that are being transmitted.
- Keep the soil moisture sensor dry and in air. Send an uplink (can press reset button on sensor).