This is a new approach for WisBlock. It scans the I2C bus and Serial to detect which WisBlock modules are attached to the WisBlock base and creates an LoRaWAN payload in Cayenne LPP with the data of the found modules.
This firmware is using the WisBlock API V2 ⤴️ which helps to create low power consumption application and taking the load to handle communications from your shoulder. WisBlock-API-V2 is a new version of the WisBlock API that has an AT command interface that is compatible with RAK's RUI3 AT command interface.
This code can be used without changes for | Kit/Solution | Setup Guide |
---|---|---|
WisBlock Kit 1 ⤴️ | Setup Kit 1 | |
WisBlock Kit 2 ⤴️ | Setup Kit 2 | |
WisBlock Kit 3 ⤴️ | Setup Kit 3 | |
WisBlock Kit 4 ⤴️ | Setup Kit 4 | |
RAK Developer Kit ⤴️ | Setup Dev Kit 2 Setup Dev Kit 3 Setup Dev Kit 4 | |
Helium Mapper Kit ⤴️ | Setup Helium Mapper | |
WisBlock GNSS Tracker for LoRaWAN ⤴️ | Setup GNSS Tracker |
Module | Function | Used in Kit |
---|---|---|
RAK4631 ⤴️ | WisBlock Core module | - |
RAK5005-O ⤴️ | WisBlock Base board | - |
RAK19007 ⤴️ | WisBlock Base board | - |
RAK19003 ⤴️ | WisBlock Mini Base board | - |
RAK19001 ⤴️ | WisBlock Fullsize Base board | - |
RAK1901 ⤴️ | WisBlock Temperature and Humidty Sensor | WisBlock Kit 1, RAK Developer Kit 2 |
RAK1902 ⤴️ | WisBlock Barometer Pressure Sensor | WisBlock Kit 1, RAK Developer Kit 2 |
RAK1903 ⤴️ | WisBlock Ambient Light Sensor | WisBlock Kit 1, RAK Developer Kit 2 |
RAK1904 ⤴️ | WisBlock Acceleration Sensor (used for GNSS solutions) | WisBlock Kit 2 & 3, WisBlock Tracker for LoRaWAN, RAK Developer Kit 3 |
RAK1905 ⤴️ | WisBlock 9 DOF sensor | - |
RAK1906 ⤴️ | WisBlock Environment Sensor | WisBlock Kit 4, RAK Developer Kit 4 |
RAK1910 ⤴️ | WisBlock GNSS Sensor | WisBlock Kit 2 & 3, RAK Developer Kit 3 |
RAK1921 ⤴️ | WisBlock OLED display | (Status display) |
RAK5814 ⤴️ | WisBlock ACC608 encryption module | - |
RAK12002 ⤴️ | WisBlock RTC module | - |
RAK12003 ⤴️ | WisBlock FIR sensor | - |
RAK12004 ⤴️ | WisBlock MQ2 Gas sensor | - |
RAK12008 ⤴️ | WisBlock SCT31 CO2 Gas sensor | - |
RAK12009 ⤴️ | WisBlock MQ3 Alcohol Gas sensor | - |
RAK12010 ⤴️ | WisBlock Ambient Light sensor | - |
RAK12014 ⤴️ | WisBlock Laser ToF sensor | - |
RAK12019 ⤴️ | WisBlock UV Light sensor | - |
RAK12025 ⤴️ | WisBlock Gyroscope sensor | - |
RAK12023/RAK12035 ⤴️ | WisBlock Soil Moisture and Temperature sensor | WisBlock Soil Sensor Solution |
RAK12027 ⤴️ | WisBlock Earthquake Sensor | - |
RAK12032 ⤴️ | WisBlock Acceleration Sensor | - |
RAK12034 ⤴️ | WisBlock 9 DOF sensor | - |
RAK12037 ⤴️ | WisBlock CO2 sensor | - |
RAK12039 ⤴️ | WisBlock Particle Matter sensor | - |
RAK12040 ⤴️ | WisBlock AMG8833 temperature array sensor | - |
RAK12047 ⤴️ | WisBlock VOC sensor | - |
RAK12052 ⤴️ | WisBlock MLX90640 32x24 temperature array sensor | - |
RAK12500 ⤴️ | WisBlock GNSS Sensor | WisBlock Tracker for LoRaWAN |
RAK14002 ⤴️ | WisBlock 3 button touch pad | - |
RAK14003 ⤴️ | WisBlock LED bar display | - |
RAK14008 ⤴️ | WisBlock Gesture sensor | - |
RAK15000 ⤴️ | WisBlock EEPROM module | - |
RAK15001 ⤴️ | WisBlock Flash module | - |
RAK14008 ⤴️ | WisBlock Gesture sensor | - |
RAK16000 ⤴️ | WisBlock DC current sensor | - |
The MCU and LoRa transceiver go into sleep mode between measurement cycles to save power. I could measure a sleep current of 40uA of the whole system for a solution that enables sleep. Some solutions, like GNSS trackers or the RAK12047 VOC sensor, that require longer wake times or more frequent wake-ups, have a higher power consumption.
In addition, sensors like the MQ gas sensors that are using a heating element will consume more power as well.
... to be updated, check platformio.ini for a list of all libraries used
The project was developed using Platform IO. But for the users that still stick to Arduino IDE, an Arduino IDE compatible copy of the sources is in the ArduinoIDE folder. The code is not compiling on Arduino IDE atm.
The complete project for PIO is in the PlatformIO folder.
When using PlatformIO, the libraries are all listed in the platformio.ini
and are automatically installed when the project is compiled.
When using Arduino IDE all libraries need to be installed manually using the Arduino Library Manager.
Compile the firmware and flash it on a WisBlock with all required modules installed.
Connect over USB to setup the LPWAN credentials. Use the DevEUI printed on the RAK4631, use the AppEUI and AppKey from your LPWAN server. Do NOT activate automatic join yet. As weather sensor levels are not changing very fast, it might be sufficient to set the send frequency to every 10 minutes. The send frequency is set in seconds, so the value would be 10 * 60 ==> 600
Example AT commands:
AT+NWM=1
AT+NJM=1
AT+BAND=10
AT+DEVEUI=1000000000000001
AT+APPEUI=AB00AB00AB00AB00
AT+APPKEY=AB00AB00AB00AB00AB00AB00AB00AB00
AT+SENDINT=600
Command | Explanation |
---|---|
AT+NWM=1 | set the node into LoRaWAN mode |
AT+NJM=1 | set network join method to OTAA |
AT+BAND=10 | set LPWAN region (here AS923-3) see AT Command Manual ⤴️ for all regions |
AT+DEVEUI=1000000000000001 | set the device EUI, best to use the DevEUI that is printed on the label of your WisBlock Core module |
AT+APPEUI=AB00AB00AB00AB00 | set the application EUI, required on the LoRaWAN server |
AT+APPKEY=AB00AB00AB00AB00AB00AB00AB00AB00 | set the application Key, used to encrypt the data packet during network join |
AT+SENDINT=600 | set the interval the sensor node will send data packets. 600 == 10 x 60 seconds == 10minutes |
The manual for all AT commands can be found here: AT-Commands.md ⤴️. WisBlock API V2 does not support all RUI3 AT commands. You can check available AT commands with the command AT?
Use the WisBlock Toolbox ⤴️, connect over Bluetooth with the Soil Sensor and setup the credentials. Do NOT activate automatic join yet.
The packet data is made compatible with the extended Cayenne LPP encoding from ElectronicCats/CayenneLPP ⤴️.
The content of the packet depends on the modules installed on the WisBlock Base Board:
Data | Channel # | Channel ID | Length | Comment | Required Module | Decoded Field Name |
---|---|---|---|---|---|---|
Battery value | 1 | 116 | 2 bytes | 0.01 V Unsigned MSB | RAK4631 | voltage_1 |
Humidity | 2 | 104 | 1 byte | in %RH | RAK1901 | humidity_2 |
Temperature | 3 | 103 | 2 bytes | in °C | RAK1901 | temperature_3 |
Barometric Pressure | 4 | 115 | 2 bytes | in hPa (mBar) | RAK1902 | barometer_4 |
Illuminance | 5 | 101 | 2 bytes | 1 lux unsigned | RAK1903 | illuminance_5 |
Humidity 2 | 6 | 104 | 1 byte | in %RH | RAK1906 | humidity_6 |
Temperature 2 | 7 | 103 | 2 bytes | in °C | RAK1906 | temperature_7 |
Barometric Pressure 2 | 8 | 115 | 2 bytes | in hPa (mBar) | RAK1906 | barometer_8 |
Gas Resistance 2 | 9 | 2 | 2 bytes | 0.01 signed (kOhm) | RAK1906 | analog_9 |
GNSS stand. resolution | 10 | 136 | 9 bytes | 3 byte lon/lat 0.0001 °, 3 bytes alt 0.01 meter | RAK1910, RAK12500 | gps_10 |
GNSS enhanced resolution | 10 | 137 | 11 bytes | 4 byte lon/lat 0.000001 °, 3 bytes alt 0.01 meter | RAK1910, RAK12500 | gps_10 |
Soil Temperature | 11 | 103 | 2 bytes | in °C | RAK12023/RAK12035 | temperature_11 |
Soil Humidity | 12 | 104 | 1 byte | in %RH | RAK12023/RAK12035 | humidity_12 |
Soil Humidity Raw | 13 | 2 | 2 bytes | 0.01 signed | RAK12023/RAK12035 | analog_in_13 |
Soil Data Valid | 14 | 102 | 1 byte | bool | RAK12023/RAK12035 | presence_14 |
Illuminance 2 | 15 | 101 | 2 bytes | 1 lux unsigned | RAK12010 | illuminance_15 |
VOC | 16 | 138 | 2 bytes | VOC index | RAK12047 | voc_16 |
MQ2 Gas | 17 | 2 | 2 bytes | 0.01 signed | RAK12004 | analog_in_17 |
MQ2 Gas Percentage | 18 | 120 | 1 byte | 1-100% unsigned | RAK12004 | percentage_18 |
MG812 Gas | 19 | 2 | 2 bytes | 0.01 signed | RAK12008 | analog_in_19 |
MG812 Gas Percentage | 20 | 120 | 1 byte | 1-100% unsigned | RAK12008 | percentage_20 |
MQ3 Alcohol Gas | 21 | 2 | 2 bytes | 0.01 signed | RAK12009 | analog_in_21 |
MQ3 Alcohol Gas Perc. | 22 | 120 | 1 byte | 1-100% unsigned | RAK12009 | percentage_22 |
ToF distance | 23 | 2 | 2 bytes | 0.01 signed | RAK12014 | analog_in_23 |
ToF Data Valid | 24 | 102 | 1 byte | bool | RAK12014 | presence_24 |
Gyro triggered | 25 | 134 | 6 bytes | 2 bytes per axis, 0.01 °/s | RAK12025 | gyrometer_25 |
Gesture detected | 26 | 0 | 1 byte | 1 byte with id of gesture | RAK14008 | digital_in_26 |
LTR390 UVI value | 27 | 2 | 2 bytes | 0.01 signed | RAK12019 | analog_in_27 |
LTR390 UVS value | 28 | 101 | 2 bytes | 1 lux unsigned | RAK12019 | illuminance_28 |
INA219 Current | 29 | 2 | 2 bytes | 0.01 signed | RAK16000 | analog_29 |
INA219 Voltage | 30 | 2 | 2 bytes | 0.01 signed | RAK16000 | analog_30 |
INA219 Power | 31 | 2 | 2 bytes | 0.01 signed | RAK16000 | analog_31 |
Touchpad left | 32 | 102 | 1 byte | bool | RAK14002 | presence_32 |
Touchpad middle | 33 | 102 | 1 byte | bool | RAK14002 | presence_33 |
Touchpad right | 34 | 102 | 1 byte | bool | RAK14002 | presence_34 |
SCD30 CO2 concentration | 35 | 125 | 2 bytes | 1 ppm unsigned | RAK12037 | concentration_35 |
SCD30 temperature | 36 | 103 | 2 bytes | in °C | RAK12037 | temperature_36 |
SCD30 humidity | 37 | 104 | 1 byte | in %RH | RAK12037 | humidity_37 |
MLX90632 sensor temp | 38 | 103 | 2 bytes | in °C | RAK12003 | temperature_38 |
MLX90632 object temp | 39 | 103 | 2 bytes | in °C | RAK12003 | temperature_39 |
PM 1.0 value | 40 | 103 | 2 bytes | in ug/m3 | RAK12003 | voc_40 |
PM 2.5 value | 41 | 103 | 2 bytes | in ug/m3 | RAK12003 | voc_41 |
PM 10 value | 42 | 103 | 2 bytes | in ug/m3 | RAK12003 | voc_42 |
Earthquake event | 43 | 102 | 1 byte | bool | RAK12027 | presence_43 |
Earthquake SI value | 44 | 2 | 2 bytes | analog 10 * m/s | RAK12027 | analog_44 |
Earthquake PGA value | 45 | 2 | 2 bytes | analog 10 * m/s2 | RAK12027 | analog_45 |
Earthquake SHUTOFF alert | 46 | 102 | 1 byte | bool | RAK12027 | presence_46 |
LPP_CHANNEL_EQ_COLLAPSE | 47 | 102 | 1 byte | bool | RAK12027 | presence_47 |
Switch Status | 48 | 102 | 1 byte | bool | RAK13011 | presence_48 |
SensorHub Wind Speed | 49 | 190 | 2 byte | 0.01 m/s | SensorHub RK900-09 | wind_speed_49 |
SensorHub Wind Direction | 50 | 191 | 2 byte | 1º | SensorHub RK900-09 | wind_direction_50 |
Audio level | 49 |
Channel ID's in cursive are extended format and not supported by standard Cayenne LPP data decoders.
Example decoders for TTN, Chirpstack, Helium and Datacake can be found in the folder RAKwireless_Standardized_Payload repo ⤴️
The compiled files are located in the ./Generated folder. Each successful compiled version is named as
WisBlock_SENS_Vx.y.z_YYYY.MM.dd.hh.mm.ss
x.y.z is the version number. The version number is setup in the ./platformio.ini file.
YYYY.MM.dd.hh.mm.ss is the timestamp of the compilation.
The generated .zip
file can be used as well to update the device over BLE using either WisBlock Toolbox ⤴️ or Nordic nRF Toolbox ⤴️ or nRF Connect ⤴️
When using PlatformIO in addition a UF2 file for the RAK4631 is generated. You can force the RAK4631 into bootloader mode by double-pushing the reset button. A new USB drive will be installed. Pull the UF2 file into the new drive to flash the device.
Debug output can be controlled by defines in the platformio.ini
_LIB_DEBUG_ controls debug output of the SX126x-Arduino LoRaWAN library
_API_DEBUG_ controls debug output of the WisBlock-API library
_MY_DEBUG_ controls debug output of the application itself
_CFG_DEBUG_ controls the debug output of the nRF52 BSP. It is recommended to keep it off
[env:wiscore_rak4631]
platform = nordicnrf52
board = wiscore_rak4631
framework = arduino
build_flags =
; -DCFG_DEBUG=2
-DSW_VERSION_1=1 ; major version increase on API change / not backwards compatible
-DSW_VERSION_2=0 ; minor version increase on API change / backward compatible
-DSW_VERSION_3=0 ; patch version increase on bugfix, no affect on API
-DLIB_DEBUG=0 ; 0 Disable LoRaWAN debug output
-DAPI_DEBUG=0 ; 0 Disable WisBlock API debug output
-DMY_DEBUG=0 ; 0 Disable application debug output
-DNO_BLE_LED=1 ; 1 Disable blue LED as BLE notificator
lib_deps =
beegee-tokyo/SX126x-Arduino
beegee-tokyo/WisBlock-API-V2
sparkfun/SparkFun SHTC3 Humidity and Temperature Sensor Library
adafruit/Adafruit LPS2X
closedcube/ClosedCube OPT3001
sabas1080/CayenneLPP
extra_scripts = pre:rename.py
This guide can be used for WisBlock Kit 1 and RAK Developer Kit 2
Install the modules in any matching slot, following the Quick Start Guides in the RAKwireless Documentation Center
Setup the device using the AT command interface or the BLE application
This guide can be used for WisBlock Kit 2, WisBlock Kit 3, WisBlock GNSS Tracker for LoRaWAN and RAK Developer Kit 3
The RAK1904 module MUST be installed in
Slot C of RAK5005-O, RAK19007, RAK19003 or RAK19001
If using the RAK1910, it MUST be installed in
Slot A of RAK5005-O
any matching slot of RAK19007 or RAK19001
If using the RAK12500, it can be installed in any matching slot of the Base Boards.
The RAK1906 can be installed in any matching slot of the Base Board.
For installation guides, following the Quick Start Guides in the RAKwireless Documentation Center
Setup the device using the AT command interface or the BLE application
RAK11700 GNSS Tracker for LoRaWAN is the default start mode for this setup.
If building the Helium Mapper Kit, the mode MUST be changed with the below AT command:
The solution can be set to 3 different working modes using the AT command AT+GNSS
:
Command | Input Parameter | Return Value | Return Code |
---|---|---|---|
AT+GNSS? | - | Get/Set the GNSS precision and format 0 = 4 digit, 1 = 6 digit, 2 = Helium Mapper |
OK |
AT+GNSS=? | - | 0 or 1 or 2 |
OK |
AT+GNSS=<Input Parameter> |
1 or 2 or 3 |
- | OK or AT_PARAM_ERROR |
The Cayenne LPP standard format uses only 4 digit for the location precision. This default location format is automatically supported by most LoRaWAN servers and Visualization platforms like MyDevices
.
It is the default and is set with the AT command AT+GNSS=0
.
Setting this option, the data is still sent in Cayenne LPP format, but uses a custom data identifier and 6 digits for a higher latitude and longitude resolution. To decode this format a custom data encoder is required. Data encoders for TTN, Chirpstack and Datacake can be found in the Custom Data Decoder folder.
The enhanced location resolution is set with the AT command AT+GNSS=1
.
This option sends the data in the Helium Mapper format, as explained in Make a Helium Mapper with the WisBlock.
Packet decoders for this format are provided in the above article.
The Helium Mapper functionality is set with the AT command AT+GNSS=2
.
This guide can be used for WisBlock Kit 4 and RAK Developer Kit 4
Install the modules in any matching slot, following the Quick Start Guides in the RAKwireless Documentation Center
Setup the device using the AT command interface or the BLE application