RAK3172 GPIO pulses while sleep

Hi

I’m working on a low-power LoRaWAN project using the RAK3172 module, configured as an AT command node. I need to generate regular, short pulses on a GPIO pin (specifically PA6 in my current setup) even when the module is in sleep modem(i.e., after the AT+SLEEP command has been sent). The goal is to minimize power consumption.

My current Arduino IDE code (shown below) works perfectly for generating the pulses when the device is not asleep. However, as expected, the pulsing stops when the AT+SLEEP command is issued, because the loop() function is no longer executing

void setup()
{
Serial.begin(115200);
Serial1.begin(115200, RAK_AT_MODE);
delay(2000);
Serial.println(“RAKwireless Custom ATCMD Example”);
Serial.println(“------------------------------------------------------”);

pinMode(PA6, OUTPUT);

}

void loop()
{

digitalWrite(PA6, HIGH);
udrv_delay_us(5);
digitalWrite(PA6, LOW);
udrv_delay_ms(15);

}

Regards.

Hi @isurki, I might not be the person to answer this but its interesting to learn what can be expected from a AT-node.

My understanding (that is very novice):

  1. Isn’t the idea with a AT-node that you have to send AT-commands (via terminal) to get something to change?
  2. What is the interval of your expected pulse behavior? Your code is doing it repeatedly, so then a sleep function make less sense with the timing seen now?
  3. So when a AT+SLEEP is sent it will go to sleep, but then you need to wake it up again some how, either in code or with a AT-command, right?.

Doing it with AT-command makes no sense if you want to save power due to the connection needed, so my guess is that you need it in the code.

Maybe some more info on what your trying to build here to get a better understanding?

Hi @tomas

The RAK 3172 is used as an AT command modem for an ESP32, the main mcu of a data logger. As all the GPIOs on the ESP32 are used, I need to control the GPIOs of the RAK 3172 to generate some pulse cycles, even when the RAK3172 is in sleep mode. I will not enter into details, but the pulse cycles above are used to light up an LED using less than 100uA. Here you have more details if you want to look into it:

To sum up, I need to create a custom AT command (‘ATC+BLINK’ for instance). When the RAK3172 receives that command should be able to keep pulse cycles for at least 5 minutes (even in sleep mode after ‘AT+SLEEP’)

1 Like

Ok, thanks for clarifying that your HW setup with the ESP32, I thought your where running the 3172 stand alone.
What DC power consumption level are you looking for?

@tomas The datalogger should consume around 25uA at 3v3 with the LED flashing every 5 seconds.

1 Like

Hi @isurki ,

Why not just run it in loop via sleep API?

void loop()
{
  digitalWrite(PA6, HIGH);
  udrv_delay_us(5);
  digitalWrite(PA6, LOW);
  udrv_delay_ms(15);
  api.system.sleep.all(5000);
}