RAK5802 RS485 Power Consumption

Hi RAK community,

As already reported, I’m using the RAK4631 in combination with the RS485 module (RAK5802) and the RAK19002 12V power module. I based my code on the hydroponic sensor using the RUI3_ModbusRtu library.

I managed to get values from my sensor, store them in the flash module, and send them via a custom AT command to the serial BLE… My device was working well and was almost ready to go into the field.

But, to my surprise, I tested the power consumption, and it was much higher than expected, around 10mA. I managed to isolate the main “leak” coming from the RS485 module, especially during initialization (when calling master.start()). I tried to find a way to turn off the module at the end of my app_event_handler(), but couldn’t find a solution. The Modbus::end() function, declared in the structure, is not implemented in RUI3_ModbusRtu.cpp. I also tried turning off every WisBlock GPIO and serial interface using digitalWrite(WP_##, LOW), but it didn’t change anything.
I tried to find a solution on this forum, but did not succed.

I’m now stuck with this major issue… Does anyone have any insights on this?

You can find my project in this repository. I also tried the hydroponic sensor example, and I get the same power consumption.

I hope someone help me ! Thank you.
Nicolas.

Using RAK4631 with RAK19007.
platformIO

AT+VER=WisBlock API 2.0.21
Device status:
   RAK4631
   Mode P2P
   P2P frequency 916000000
   P2P TX Power 22
   P2P BW 125
   P2P SF 7
   P2P CR 0
   P2P Preamble length 8
   P2P Symbol Timeout 0
   Send Frequency 900

Has no one faced this issue with the RS485 module? For my usage, the 10mA consumption makes the device unusable…

Are you using LoRaWAN or LoRa P2P?
Your settings here say LoRa P2P, but your code uses LoRaWAN (LoRa P2P send is commented out).

If you are using LoRaWAN, what class did you setup? Class A or Class C?
Class C is at least 6mA, because the transceiver is in RX mode all the time. Class A is lower, because the transceiver is only active during TX and RX1 and RX2 windows. Otherwise it is set to sleep.

If you are using LoRa P2P, try to call Radio.Sleep() in the LoRa TX finished callback.

Thanks for your reply, Bernd.

For my current project, I don’t need LoRaWAN or P2P. However, I did use your WisBlock API 2 because I’m planning to use this RAK node for several other sensor applications (LoRaWAN-based environmental monitoring) later, and I want a robust and scalable base code.

For this project, I’ve set the device to P2P mode, and the class is set to A. The issue arises during sleep mode, should LoRa be turned off? My guess is that the problem is related to digitalWrite(WB_IO2, LOW), which doesn’t seem to be working. During sleep, I still notice that the pins for RS485 remain powered (Vbat, 3.3V). Is there a pull-down resistor I need to activate?

I’ve tried flashing two different RAK4631+19007 with your hydroponic sensor node code, and I’m encountering the same issue. Did you check power consumption when you implemented it?

lora_rak4630_init();
Radio.Sleep();

It doesn’t solve the problem.

I hope you have another suggestion.

When I don’t initiate the RS485 module but only the flash module, I get something similar. The power consumption during sleep mode is 1.25mA. As I understand it, the WB_IO2 (power circuit) is not turned off during sleep mode…
However, my 12V power module is off during sleep mode, but is activated when I need it.

The hydroponic system was permanently powered, so I didn’t do any power consumption measurements.

What Flash module are you using? The RAK15001? This module is permanent powered, what library are you using? I never used that module for battery applications, not sure how to put it into sleep mode. I can’t find a command for sleep in the Adafruit library.

Did you measure consumption without the flash module?

Right now I have a setup with a RS485 Soil Sensor, RAK19007, RAK4631, RAK5802 and RAK19002 power module for 12V supply of the sensor. The whole thing is battery powered with solar panel for recharging. No flash module or other NVRAM.

I am getting a sleep current of ~30uA.
Only difference to the hydroponic system is that I stop Serial1 after RS485 communication is finished with Serial1.end().
Otherwise I use only WB_IO2 to shut down the 12V supply and the RS485.

Thanks a lot, Bernd!

Calling Serial1.end() solved the RS485 power loss issue. I had tried this before without success, but I must have done something wrong. However, the current still fluctuates between 25uA and 500uA (flash module off). This seems to be related to BLE, as it stabilizes to 25uA when I set g_enable_ble = false. However, I still want to use BLE for AT commands, as it’s the way I read my data.

Yes, I’m using the RAK15001 flash module with Adafruit_SPIFlash and SdFat_Adafruit_Fork. Is there a way to shut down the pin? I tried…

pinMode(WB_IO3, OUTPUT); 	//WB_IO3 controls SLOT C : FLASH module.
digitalWrite(WB_IO3, HIGH);
//some code
digitalWrite(WB_IO3, LOW);

I manage to reduce the power loss from 1.5mA to 320uA with this end functions, but seems still a bit to much.

fatfs.end(); //FatPartition::end()
g_flash.end(); //Adafruit_SPIFlash::end()

WB_IO3 is putting the flash module into HOLD status. Not sure how much current that saves.

Can you try to add SPI.end() after using the flash?

fatfs.end();      //FatPartition::end()
g_flash.end(); //Adafruit_SPIFlash::end()
SPI.end();       // De-initialize SPI

Thanks! I managed to shut everything down during sleep. It’s better not to use digitalWrite(WB_IO3, LOW);.
Everything works, and the sensor is going to Amazon next week :wink:
One last question: the power fluctuates between 0.25 µA and 400 uA. I assume this is related to BLE, as the device periodically looks for a new connection. On one hand, it’s very useful to be able to connect, configure, and download data through AT commands without opening the sensor box… On the other hand, I’m a bit concerned about this energy loss. Where can I change the “BLE check timer” from something like 1s to 5 or 10s?

Thanks again! I really appreciate your support and your work (Wiblock API V2 is awesome).

BLE should be advertising only if the device doesn’t join LoRaWAN network or if LoRa P2P is not initialized.
You can set the advertising time manually by using

restart_advertising(0);

0 == advertising never stopping
1 … 65534 == advertising time in seconds

to stop advertising use restart_advertise(1) and it will stop within 1 second.