@beegee from what I see, the RAK10702 and the RAK4631 has the same MCU and have the same SHTC3 sensor. So is it will be possible to “stole” from your your code as much as possible
Aside jokes, if the battery setup will be succesful, the project will be upscaled to other projects I have in mind.
Marco
All my codes are Open Source, so no need to steal it
Sure you can take them, adjust them to your needs.
However the RAK10702 is using a custom Base Board and some special IO’s to control the power of the sensors.
But other examples like my RAK4631-Kit-4-RAK1906 can work with both LoRaWAN and LoRa P2P and my new PoC.
This one is a more complicated variant. It supports out of the box many WisBlock Sensor Modules ==> WisBlock-Sensor-For-LoRaWAN. Despite it’s name, it supports LoRa P2P as well.
HTTP POST example is done as well. It was easier than I expected, thanks to the ESP32 framework that has everything.
Need to clean up the codes and write some explanations/readme. I guess I will post the code in the next days.
@beegee sorry for the silly question, i’m trying to build the RAK4631 Sensor Solution you posted but i receive an error
Blockquote
Processing rak4631-debug (platform: nordicnrf52; board: wiscore_rak4631; framework: arduino)-------------------------------------------------------------------------------------------------------------------------------------------- Verbose mode can be enabled via
-v, --verbose` option CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/wiscore_rak4631.html
PLATFORM: Nordic nRF52 (10.6.0) > WisCore RAK4631 Board
HARDWARE: NRF52840 64MHz, 243KB RAM, 796KB Flash
DEBUG: Current (jlink) External (jlink, stlink)
PACKAGES
framework-arduinoadafruitnrf52 @ 1.10601.0 (1.6.1)
framework-cmsis @ 2.50700.210515 (5.7.0)
tool-adafruit-nrfutil @ 1.503.0 (5.3)
tool-sreccat @ 1.164.0 (1.64)
toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 64 compatible libraries
Scanning dependencies…
Dependency Graph
|-- SX126x-Arduino @ 2.0.26
|-- WisBlock-API-V2 @ 2.0.18
|-- CayenneLPP @ 1.4.0
|-- SparkFun SHTC3 Humidity and Temperature Sensor Library @ 1.1.4
|-- Adafruit LPS2X @ 2.0.6
|-- ClosedCube OPT3001 @ 1.1.2
|-- Adafruit BME680 Library @ 2.0.4
|-- SparkFun u-blox GNSS Arduino Library @ 2.2.27
|-- TinyGPSPlus @ 1.1.0
|-- Adafruit LIS3DH @ 1.3.0
|-- RAK12035_SoilMoisture @ 1.0.3
|-- RAKwireless VEML Light Sensor @ 1.0.2
|-- Sensirion Gas Index Algorithm @ 3.2.2
|-- Sensirion I2C SGP40 @ 0.1.0
|-- Sensirion Core @ 0.7.1
|-- RAKwireless MQx library @ 1.0.0
|-- Adafruit MCP23017 Arduino Library @ 2.3.2
|-- VL53L0X @ 1.3.1
|-- RAK I3G4250D Gyroscope @ 1.0.0
|-- RevEng PAJ7620 @ 1.5.0
|-- nRF52_OLED @ 1.0.0
|-- Melopero RV3028 @ 1.1.0
|-- Grove - Coulomb Counter for 3.3V to 5V LTC2941 @ 1.0.0
|-- RAK12019_LTR390_UV_Light @ 1.0.0
|-- INA219_WE @ 1.3.8
|-- RAKwireless CAP1293 Touch Pad library @ 1.0.3
|-- MPU9250_WE @ 1.2.9
|-- LPS35HW @ 1.0.2
|-- SparkFun SCD30 Arduino Library @ 1.0.20
|-- SparkFun MLX90632 Noncontact Infrared Temperature Sensor @ 1.0.1
|-- SparkFun GridEYE AMG88 Library @ 1.0.2
|-- RAKwireless Storage @ 1.0.2
|-- ArduinoECCX08 @ 1.3.8
|-- Adafruit FRAM I2C @ 2.0.3
|-- SparkFun u-blox Arduino Library @ 1.8.11
|-- RAKwireless RAK12034 @ 1.0.0
|-- Adafruit EPD @ 4.5.5
|-- SparkFun STC3x Arduino Library @ 1.0.0
|-- RAK12027-D7S @ 1.0.0
|-- BSEC Software Library @ 1.6.1480
|-- RAK12039_PM_Sensor @ 1.0.0
|-- RAK12052-MLX90640 @ 1.0.0
|-- SparkFun ADXL313 Arduino Library @ 1.0.4
|-- Wire @ 1.0
|-- RAKwireless_ADC_SGM58031_library @ 1.0.1
|-- Adafruit GFX Library @ 1.11.10
|-- SE0352NQ01 EPD Library @ 0.0.1
|-- Adafruit Unified Sensor @ 1.1.14
|-- Adafruit Little File System Libraries @ 0.11.0
|-- Adafruit Internal File System on Bluefruit nRF52 @ 0.11.0
|-- SPI @ 1.0
Building in release mode
Compiling .pio\build\rak4631-debug\lib564\Adafruit_TinyUSB_Arduino\arduino\Adafruit_TinyUSB_API.cpp.o
Compiling .pio\build\rak4631-debug\lib564\Adafruit_TinyUSB_Arduino\arduino\Adafruit_USBD_CDC.cpp.o
Compiling .pio\build\rak4631-debug\lib564\Adafruit_TinyUSB_Arduino\arduino\Adafruit_USBD_Device.cpp.o
Compiling .pio\build\rak4631-debug\lib564\Adafruit_TinyUSB_Arduino\arduino\Adafruit_USBH_Host.cpp.o
In file included from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5/Arduino.h:60:0,
from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\libraries\Adafruit_TinyUSB_Arduino\src\arduino\Ada
fruit_USBD_CDC.cpp:30: C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5/Uart.h:27:10: fatal error: variant.h: No such file or directo
ry
***************************************************************
Looking for variant.h dependency? Check our library registry!
** CLI > platformio lib search “header:variant.h” Web > PlatformIO Registry
#include "variant.h ^~~~~~~~~~~
compilation terminated.
In file included from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5/Arduino.h:60:0,
from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\libraries\Adafruit_TinyUSB_Arduino\src\arduino\Ada
fruit_USBD_Device.cpp:35: C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5/Uart.h:27:10: fatal error: variant.h: No such file or directo
ry
****************************************************************** Looking for variant.h dependency? Check our library registry! CLI > platformio lib search “header:variant.h” Web > PlatformIO Registry*****
#include “variant.h”
^~~~~~~~~~~
compilation terminated.
In file included from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5/Arduino.h:60:0,
from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\libraries\SPI/SPI.h:24,
from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\libraries\Adafruit_TinyUSB_Arduino\src/arduino/Ada
fruit_USBH_Host.h:30, from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\libraries\Adafruit_TinyUSB_Arduino\src/Adafruit_Ti
nyUSB.h:80, from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\libraries\Adafruit_TinyUSB_Arduino\src\arduino\Ada
fruit_TinyUSB_API.cpp:29: C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5/Uart.h:27:10: fatal error: variant.h: No such file or directo
ry
****************************************************************** Looking for variant.h dependency? Check our library registry!** CLI > platformio lib search “header:variant.h”* Web > PlatformIO Registry******************************************************************
#include “variant.h” ^~~~~~~~~~~
compilation terminated.
*** [.pio\build\rak4631-debug\lib564\Adafruit_TinyUSB_Arduino\arduino\Adafruit_USBD_Device.cpp.o] Error 1
*** [.pio\build\rak4631-debug\lib564\Adafruit_TinyUSB_Arduino\arduino\Adafruit_USBD_CDC.cpp.o] Error 1
*** [.pio\build\rak4631-debug\lib564\Adafruit_TinyUSB_Arduino\arduino\Adafruit_TinyUSB_API.cpp.o] Error 1
In file included from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5/Arduino.h:60:0,
from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\libraries\SPI/SPI.h:24,
from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\libraries\Adafruit_TinyUSB_Arduino\src\arduino\Ada
fruit_USBH_Host.h:30, from C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\libraries\Adafruit_TinyUSB_Arduino\src\arduino\Ada
fruit_USBH_Host.cpp:36: C:\Users\Utente.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5/Uart.h:27:10: fatal error: variant.h: No such file or directo
ry ****************************************************************** Looking for variant.h dependency? Check our library registry!** CLI > platformio lib search “header:variant.h”* Web > PlatformIO Registry*
***************************************************************** #include “variant.h”
^~~~~~~~~~~
compilation terminated.
*** [.pio\build\rak4631-debug\lib564\Adafruit_TinyUSB_Arduino\arduino\Adafruit_USBH_Host.cpp.o] Error 1
======================================================= [FAILED] Took 66.24 seconds =======================================================
Environment Status Duration
------------- -------- ------------rak4631-debug FAILED 00:01:06.241
================================================== 1 failed, 0 succeeded in 00:01:06.241 ================================================== * Il processo del terminale “C:\Users\Utente.platformio\penv\Scripts\platformio.exe ‘run’” è stato terminato. Codice di uscita: 1.
`
but i don’t know to fix it, i already watched in the framework of the PlatformIO searching for the arduinoadafruitnrf52 keywords but i didn’t find anything. Can you please help me on where to search? Many thanks
When using PlatformIO, you have to patch the platform/package files to be able to get the RAK11200/RAK4631/RAK11310 to work.
It is a little bit inconvenient, but I had no success so far to get these devices added to the original BSP’s.
The guide Installation of Board Support Package in PlatformIO should still work.
P2P Gateway code is online in Github WisBlock LoRa P2P Gateway to MQTT Broker or HTTP Post service
@beegee I have already patched before trying to compile it, I received on error but it was about the RP2040 MCU. The error appear in the building phase after patching the PlatformIO.
I’ve installed also the Raspberry Pi RP2040 from the Platforms menu on PlatformIO just to be shure that the execution of Python script is searching and blocking by the missing Raspberry RP2040 platform but nope, it throws another error.
Anyway, thanks for taking time to help me on this phase, Bernd.
Marco
You can ignore errors that are not related to your MCU.
The patcher is just a “stupid” Python script. No checks if files exists or not.
Seems I need to update the repo. It compiles when I try locally.
Your logs say you compile GitHub - beegee-tokyo/WisBlock-Sensor-For-LoRaWAN: Firmware for RAKwireless WisBlock RAK4631 Core module.
Not the link to the other example GitHub - beegee-tokyo/RAK4631-Kit-4-RAK1906: Example code for WisBlock Environment Sensor with RAK1906 environment sensor
But both are compiling for me.
Just updated the WisBlock-Sensor-For-LoRaWAN repo. Can you try again.
@beegee I’ve compiled the “Sensor Solution” repo not the RAK1906 because i’ve the RAK1901 sensor. Anyway, i’m downloading now and i’ll let you know, thanks
After this put the @1.0.4 on the version seems to resolve the problem
Now it compiles but finds some problems (sorry for the image, i don’t know how to paste the problem log)
It will throw a lot of warnings (yellow), but it should compile. The warnings are mostly coming from the included libraries (unused variables, redefinition of macros, …) but nothing serious.
What you see in the Problem tab are all warnings. You can ignore them.
For the Sparkfun library, I don’t know why they removed the version 1.0.0 from Github.
The old V1.0.0 version was still in my project library folder, so it didn’t throw the error. Now I see it as well.
I updated the platformio.ini and tried again, it compiles and runs.
Ok, I’ll try to put the fimware to work and i’ll let you know, thanks.
I was thinking if it will be possible to have one or more P2P sensor(s) (maximum 3) and put via the AT-Commands another one RAK4631 in P2P Rx mode and read the sensor via serial console, maybe via the usual Node-RED exec node. What do you think?
Yes, that should be definitely possible.
You will have to decode the payload from CayenneLPP format in NodeRED in that case.
@beegee Hi Bernd, so far i’ve uploaded successfully the firmware on both the sender (RAK4631 + RAK19007 + RAK1901) and the receiver (RAK4631 + RAK19007) thanks to your firmware. After setting both of the MCU on P2P LoRa mode, i’m trying to set the receiver that will continuously listen to P2P LoRa TX packets without any timeout with the AT command AT+PRECV=65534, it respond with OK but asking if the parameter is stored it looks like it isn’t
As you can see, i’m using Putty to comunicate with the MCU, what i’m doing wrong?
EDIT: I found this and now it works:
but why i can’t see what is transmitted but only this log?
I can see the temperature and humidity readings on the transmitter every 60 seconds if connected via the COM port to the sender
The AT command manual is for our RUI3 firmware (RAK3172, RAK11720, RAK4631 with RUI3).
Most of my example codes are not based on RUI3. I tried to copy the RUI3 AT commands as good as possible, but there are still some differences between the AT commands.
But in any case, you have to start P2P RX explicitly, it is not saved in Flash and not automatically enabled on next reboot/start-up.
For the payload decoding, in the RX functions, you see the plain uint8_t value array and you still have to decode them.
You will something like my parse_send() function to see the decoded sensor values.
@beegee ah ok, i see. Unfortunately decoding the array or trying to implement your function in Node-RED directly will beyond my technical knowledge at the moment. Is that array unit8_t the CayenneLPP format?
Yes, it is CayenneLPP format.
NodeRED is Javascript, so you might be able to use our Javascript decoders for LoRaWAN servers as a start. ==> RAKwireless_Standardized_Payload
I never tried to decode the payload directly in NodeRED, but there is a CayenneLPP payload decoder available ==> node-red-contrib-cayennelpp-extended (node) - Node-RED
From that NodeRED palette I found ==> CayenneLPP/decoders/decoder.js at master · ElectronicCats/CayenneLPP · GitHub
which might work already:
// To use with NodeRED
// Assuming msg.payload contains the LPP-encoded byte array
/*
msg.fields = lppDecode(msg.payload);
return msg;
*/