RAK3172 as a sensor node

Hi, can I ask for proper full example of using RAK3172 as sensor node - for Arduino and RUI 4.0?
The example with sending data with some fixed time interval and with proper energy savings modes would be great.

In RUI 3.x it worked more or less OK (it was hanging after 45 days of work). In RUI 4.0 I see that the RAK3172 is constantly going in to loop() on every event and it look for me like less stable …

Best practice for low power system is not to use loop at all and make your system event based.
Event can be a timer callback or an external interrupt. This way you don’t need to time your loop to wait for the end of sending a packet to go back to sleep.

Here is an example that I use RUI3-RAK12047-Air-Quality


Can you check the file exists or who can access it? @beegee

Sorry, the repo was set to private.

Can you try again?

Hi, thanks a lot - this was exactly what I was looking for. Simplified version of this project should be official example.

By the way in this RUI 4.0 firmware sleep current is something like 5uA vs ca 2uA in previous firmware version. Do you know what causes this higher current consumption?

I have an idea, but I need to check on Monday.

On the RAK3172 we changed the low power modes. Some customers who are using both UART’s had problems that the second UART was not waking up the device because the mode chosen disabled the second UART.
In the new version the low power mode is different, leaving the UART2 active. But there is an option to switch back (permanent) to the other LPM. The documentation is for it is not yet online.

From the API side, the command to enable/disable the LPM:

  /**@par	Description
       *     	This api allows to get the low power mode
       * @par	Syntax
       *	api.system.lpm.get()
       * @retval	1 for low power mode enabled
       * @retval	0 for low power mode disabled
       * @par         Example
       * @verbatim
     void setup()

         Serial.printf("Set the low power mode %s\n\r", api.system.lpm.set(1) ? "Success" : "Fail");

     void loop()
         Serial.printf("The low power mode = %d\n\r", api.system.lpm.get());




I tried this on my system - and in both modes power usage is the same. But in free time I try to do proper power usage tests…