hello,
I have a very simple setup: a RAK4630 on a RAK19007 baseboard with a RAK1901 temperature sensor (SHTC3) powered by two AA batteries connected in parallel.
I send temperature, humidity, and voltage data every 30 minutes (for the tests i put 3 minutes), then switch to sleep mode. However, the standby current is 600µA, whereas I expected a maximum of 10µA. Is there a hardware limitation or a software trick to achieve this?
#include <Arduino.h>
#include <SX126x-RAK4630.h>
#include <SPI.h>
#include <Wire.h>
#include "SparkFun_SHTC3.h"
#define SLEEP_TIME 180000
#define RF_FREQUENCY 868300000
#define TX_OUTPUT_POWER 22
typedef struct {
int16_t temp;
uint16_t hum;
uint16_t batt;
} Payload;
SHTC3 g_shtc3;
static RadioEvents_t RadioEvents;
SoftwareTimer taskWakeup;
float read_battery() {
analogReference(AR_INTERNAL_3_0);
analogReadResolution(12);
delay(2);
return (float)analogRead(WB_A0) * (3000.0 / 4095.0) * 1.73;
}
void perform_measure_and_send() {
digitalWrite(WB_IO2, HIGH);
delay(15);
Wire.begin();
if(g_shtc3.begin() == SHTC3_Status_Nominal) {
g_shtc3.wake();
g_shtc3.update();
Payload p;
p.temp = (int16_t)(g_shtc3.toDegC() * 100);
p.hum = (uint16_t)(g_shtc3.toPercent() * 100);
p.batt = (uint16_t)read_battery();
g_shtc3.sleep();
Radio.Send((uint8_t *)&p, sizeof(p));
}
Wire.end();
pinMode(PIN_WIRE_SDA, INPUT);
pinMode(PIN_WIRE_SCL, INPUT);
digitalWrite(WB_IO2, LOW);
}
void setup() {
// 1. Coupure totale UART et activation DCDC
NRF_POWER->DCDCEN = 1;
NRF_UART0->ENABLE = 0;
// 2. Extinction LEDs
pinMode(LED_BLUE, OUTPUT); digitalWrite(LED_BLUE, LOW);
pinMode(LED_GREEN, OUTPUT); digitalWrite(LED_GREEN, LOW);
// 3. Alimentation Slots
pinMode(WB_IO2, OUTPUT);
digitalWrite(WB_IO2, LOW);
// 4. Radio
lora_rak4630_init();
RadioEvents.TxDone = [] { Radio.Sleep(); };
RadioEvents.TxTimeout = [] { Radio.Sleep(); };
Radio.Init(&RadioEvents);
Radio.SetChannel(RF_FREQUENCY);
Radio.SetTxConfig(MODEM_LORA, TX_OUTPUT_POWER, 0, 0, 7, 1, 8, false, true, 0, 0, false, 3000);
Radio.Sleep();
// 5. Timer & Sommeil
taskWakeup.begin(SLEEP_TIME, [](TimerHandle_t xTimer) { perform_measure_and_send(); });
taskWakeup.start();
perform_measure_and_send();
suspendLoop();
}
void loop() {}
