RUI3 example code for WisBlock I2C sensor modules.
This code is Work in progress and far from finished. But it can give a first start how to use RUI3.
The code compiles on RAK4631. For RAK3172 examples see my other RUI3 examples
Module | Function | Supported |
---|---|---|
RAK4631-R |
WisBlock Core module with RUI3 | ✔ |
RAK19007 |
WisBlock Base board | ✔ |
RAK19003 |
WisBlock Mini Base board | ✔ |
RAK19001 |
WisBlock Fullsize Base board | ✔ |
RAK1901 |
WisBlock Temperature and Humidty Sensor | ✔ |
RAK1902 |
WisBlock Barometer Pressure Sensor | ✔ |
RAK1903 |
WisBlock Ambient Light Sensor | ✔ |
RAK1904 |
WisBlock Acceleration Sensor (used for GNSS solutions) | ✔ |
WisBlock 9 DOF sensor | Work in progress | |
RAK1906 |
WisBlock Environment Sensor | ✔ |
WisBlock GNSS Sensor | Work in progress | |
RAK1921 |
WisBlock OLED display | ✔ |
RAK12002 |
WisBlock RTC module | ✔ |
RAK12003 |
WisBlock FIR sensor | ✔ |
WisBlock MQ2 Gas sensor | Work in progress | |
WisBlock MG812 CO2 Gas sensor | Work in progress | |
WisBlock MQ3 Alcohol Gas sensor | Work in progress | |
RAK12010 |
WisBlock Ambient Light sensor | ✔ |
RAK12014 |
WisBlock Laser ToF sensor | ✔ |
WisBlock UV Light sensor | Work in progress | |
WisBlock Gyroscope sensor | Work in progress | |
WisBlock Soil Moisture and Temperature sensor | Work in progress | |
RAK12037 |
WisBlock CO2 sensor | ✔ |
RAK12040 |
WisBlock AMG8833 temperature array sensor | ✔ |
RAK12047 |
WisBlock VOC sensor | ✔ |
RAK12500 |
WisBlock GNSS Sensor | ✔ |
WisBlock 3 button touch pad | Work in progress | |
WisBlock LED bar display | Work in progress | |
WisBlock Gesture sensor | Work in progress | |
RAK15000 |
WisBlock EEPROM module | ✔ |
RAK15001 |
WisBlock Flash module | ✔ |
WisBlock DC current sensor | Work in progress |
- The RAK1904 module MUST be installed in
- Slot C of RAK19007, RAK19007 or RAK19001
- Slot A of RAK19003
- The RAK1905 module MUST be installed in
- Slot C of RAK19007, RAK19007 or RAK19001
- Slot A of RAK19003
- RAK1910 and RAK12500 cannot be used together (both are GNSS location trackers)
- ArduinoIDE
⤴️ - RAK-STM32-RUI
⤴️ - RAK-nRF52-RUI
⤴️
- CayenneLPP
⤴️ - ArduinoJson
⤴️
- Adafruit BME680 Library
⤴️ - Adafruit LIS3DH
⤴️ - Adafruit LPS2X
⤴️ - Adafruit MCP23017 Arduino Library
⤴️ - Adafruit Unified Sensor
⤴️ - ClosedCube OPT3001
⤴️ - Coulomb Counter
⤴️ - INA219_WE
⤴️ - Melopero RV3028
⤴️ - nRF52_OLED
⤴️ - Pololu VL53L0X
⤴️ - RAK12019_LTR390_UV_Light
⤴️ - RAK12035_SoilMoisture
⤴️ - RAKwireless CAP1293 Touch Pad library
⤴️ - RAK I3G4250D Gyroscope
⤴️ - RAKwireless MQx library
⤴️ - RAKwireless VEML Light Sensor
⤴️ - RevEng PAJ7620
⤴️ - Sensirion Core
⤴️ - Sensirion Gas Index Algorithm
⤴️ - Sensirion I2C SGP40
⤴️ - SparkFun SHTC3 Humidity and Temperature Sensor Library
⤴️ - SparkFun u-blox GNSS Arduino Library
⤴️ - TinyGPSPlus
⤴️ - LPS35HW
⤴️ - SparkFun SCD30 Arduino Library
⤴️ - SparkFun MLX90632 Noncontact Infrared Temperature Sensor
⤴️ - Melopero AMG8833
⤴️ - SparkFun ADXL313 Arduino Library
⤴️ - RAKwireless Storage
⤴️ - ArduinoECCX08
⤴️
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 bytes | 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 bytes | 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 bytes | 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 bytes | 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 bytes | 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 bytes | 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 bytes | 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 bytes | 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 byte | 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 byte | 0.01 signed | RAK16000 | analog_29 |
INA219 Voltage | 30 | 2 | 2 byte | 0.01 signed | RAK16000 | analog_30 |
INA219 Power | 31 | 2 | 2 byte | 0.01 signed | RAK16000 | analog_31 |
Touchpad left | 32 | 102 | 1 bytes | bool | RAK14002 | presence_32 |
Touchpad middle | 33 | 102 | 1 bytes | bool | RAK14002 | presence_33 |
Touchpad right | 34 | 102 | 1 bytes | bool | RAK14002 | presence_34 |
SCD30 CO2 concentration | 35 | 125 | 2 bytes | 1 ppm unsigned | RAK12037 | |
SCD30 temperature | 36 | 103 | 2 bytes | in °C | RAK12037 | |
SCD30 humidity | 37 | 104 | 1 bytes | in %RH | RAK12037 | |
MLX90632 sensor temp | 38 | 103 | 2 bytes | in °C | RAK12003 | |
MLX90632 object temp | 39 | 103 | 2 bytes | in °C | RAK12003 |
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 decoders
The setup of the device (LoRaWAN region, DevEUI, AppEUI, AppKey, ....) can be done with AT commands over the USB port or with WisToolBox
Example AT commands:
AT+NWM=1
AT+NJM=1
AT+BAND=10
AT+DEVEUI=1000000000000001
AT+APPEUI=AB00AB00AB00AB00
AT+APPKEY=AB00AB00AB00AB00AB00AB00AB00AB00
ATC+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 |
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 | |
ATC+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-Command Manual
There are additional custom AT commands implemented:
ATC+STATUS
to get the current status of the device.
Example:
atc+status=?
Device Status:
Module: RAK4630
Version: RUI_3.5.2b_175_RAK4631
Send time: 120 s
Network mode LoRaWAN
Network joined
Region: 10
Region: AS923-3
OTAA mode
DevEUI = AC1F09FFFE057110
AppEUI = AC1F09FFFE057110
AppKey = 2B84E0B09B68E5CB42176FE753DCEE79
+EVT:RAK1901 OK
+EVT:RAK1902 OK
+EVT:RAK1903 OK
+EVT:RAK12019 OK
OK
ATC+SENDINT
to get and set the automatic send interval
Example:
atc+sendint=?
ATC+SENDINT=120s
OK
atc+sendint=120
OK
If an RAK12002 RTC module is used, the command ATC+RTC
is available to get and set the date time
Example:
atc+rtc=?
ATC+RTC=2000.01.01 0:00:21
atc+rtc=2022:10:21:14:15
OK
atc+rtc=?
ATC+RTC=2022.10.21 14:15:25