Please include the following information, in order for us to help you as effectively as possible.
What product do you wish to discuss? RAK4631
What firmware are you using? Arduino BSP
Computer OS? Windows
What Computer OS version? 11 Pro
I am developing a Wisblock solution with:
RAK4631
RAK19007
RAK1904
RAK1906
RAK 12500
After I am measuring with Nordic Power Profile Kit II, when the minimum power consuming that I get when manually disable until UART, it is 2 mA. I am not finding what is consuming.
I am expecting to maintain in “sleep mode” it is some µA for 15 minutes and after that wakeup to make its tasks.
Could you help me to find what I have to make to a real sleep mode?
(2) RAK1906, did you enable or disable the heater of the sensor? If you set automatic measurement and the heater is on, it leads to higher consumption.
(3) RAK12500, what is your setup? What is your measurement rate, navigation frequency, did you enable power save mode? Do you power it down when not in use?
(4) RAK4631, I get lowest power consumption when stopping the loop() by using semaphores to wake it up by events (timers, interrupts, …)
void IniciaRAK12500()
{
// Incia RAK12500 GNSS sensor
pinMode(WB_IO2, OUTPUT);
digitalWrite(WB_IO2, 0);
vTaskDelay(pdMS_TO_TICKS(1000));
digitalWrite(WB_IO2, 1);
vTaskDelay(pdMS_TO_TICKS(1000));
if (CFG_DEBUG >= D_INFORMA) {
Serial.println("============ Iniciando o RAK12500 via I2C ============");
Serial.println("=======================================================");
}
do //testa se o sensor está conectado
{
count2++;
if (SensorGNSS.begin() == false)
{
if (CFG_DEBUG != 0) {
Serial.print("Não detectado o u-blox GNSS no endereço padrão. Verifique as conexões. Tentativa ");
Serial.print(String(count2));
Serial.println(". Tentando outra vez!");
Serial.println("=======================================================");
}
}
} while(((SensorGNSS.begin()) == false) & (count2<11));
if (CFG_DEBUG >= D_INFORMA) {
Serial.println("=========== RA12500 inciado com sucesso ===============");
Serial.println("=======================================================");
}
// SensorGNSS.setNavigationFrequency(1); // Set the update rate to 1Hz
// Habilita o modo de economia de energia
// SensorGNSS.powerSaveMode(true);
}
void LeGNSS()
{
if (CFG_DEBUG >= D_INFORMA) {
// Le via GNSS a geo-localização
Serial.println("=======================================================");
Serial.println("============= Geo-localização =========================");
}
count2=0;
do //testa se o sensor está conectado
{
count2++;
if (SensorGNSS.begin() == false)
{
if (CFG_DEBUG >= D_ERRO) {
Serial.print("Não foi detectado o u-blox GNSS no endereço padrão. Verifique as conexões. Tentativa ");
Serial.print(String(count2));
Serial.println(". Tentando outra vez!");
}
}
} while((SensorGNSS.begin() == false) & (count2<11));
if (SensorGNSS.begin() != false) { //Connect to the u-blox module using Wire port
if (millis() - g_lastTime > 1000)
{
g_lastTime = millis(); //Update the timer
// Data e hora
RAK12500.UNIXEpoch = SensorGNSS.getUnixEpoch(); // Recebe o horário no formato UNIX
// Posição
RAK12500.Latitude = SensorGNSS.getLatitude();
RAK12500.Longitude = SensorGNSS.getLongitude();
RAK12500.Altitude = SensorGNSS.getAltitude(); // Altitude em metros
RAK12500.Acuracia = SensorGNSS.getHorizontalDOP() / 100.0;
RAK12500.Velocidade = SensorGNSS.getGroundSpeed()/100.0;
RAK12500.Direcao = SensorGNSS.getHeading()/100000.0;
RAK12500.sats = SensorGNSS.getSIV();
if (CFG_DEBUG >= D_INFORMA) {
Serial.printf(" tempo em operação: %d\n",g_lastTime);
Serial.printf(" tamanho de UNIXEpoch: %d\n",sizeof(RAK12500.UNIXEpoch));
Serial.printf(" tamanho de Lat: %d\n",sizeof(RAK12500.Latitude));
Serial.printf(" tamanho de Long: %d\n",sizeof(RAK12500.Longitude));
Serial.printf(" tamanho de Alt: %d\n",sizeof(RAK12500.Altitude));
Serial.printf("Inteiros Lat: %d Lon: %d \n", RAK12500.Latitude, RAK12500.Longitude);
Serial.printf("Inteira Alt: %d M \n", RAK12500.Altitude);
Serial.printf(" UNIXEpoch: %d\n", RAK12500.UNIXEpoch);
Serial.printf("Lat: %9.6f Lon: %9.6f", RAK12500.Latitude / 10000000.0, RAK12500.Longitude/ 10000000.0);
Serial.printf(" Alt: %5.2f M \n", RAK12500.Altitude / 1000.0);
Serial.printf(" Acuracia: %3.2f %%\n", RAK12500.Acuracia);
Serial.printf(" Velocidade: %4.1f m/s \n", RAK12500.Velocidade);
Serial.printf(" Direção: %4.1f graus \n", RAK12500.Direcao);
Serial.printf(" Satélites: %3d\n", RAK12500.sats);
Serial.println("=======================================================");
vTaskDelay(pdMS_TO_TICKS(5000));
}
// Modo de economia de energia
SensorGNSS.powerOff(900000); // Turn off the GNSS module
// SensorGNSS.powerSaveMode(true);
}
}
RAK12500.h
#ifndef _RAK12500_H
#define _RAK12500_H
// Bibliotecas personalizadas
// Bibliotecas do Firmware
// RAK12500 GNSS
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
#include <iomanip>
void Acorda();
void IniciaRAK12500();
void LeGNSS();
struct GeoLocalizacao
{
public:
uint32_t UNIXEpoch = 0; // horário no formato UNIX
long Latitude = 0; // latitude em graus
long Longitude = 0; // Longitude em graus
int16_t Altitude = 0; // Altitude em metros
int32_t Acuracia = 0; // índice de precisão
int16_t HDop = 0; // dispersão horizontal
int32_t Velocidade = 0; // Velocidade em m/s
int32_t Direcao = 0; // Direção em graus
byte sats = 0; // número de satélites
} RAK12500;
SFE_UBLOX_GNSS SensorGNSS;
double g_lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
uint8_t count2=0;
#endif
The example is using my WisBlock-API-V2, which is close to RUI3, but it is for the open source Arduino BSP’s and is for nRF52 (RAK4631), ESP32 (RAK11200) and RP2040 (RAK11310).
It
supports 99% of the RUI3 commands to setup the device
like RUI3 includes the handling of
LoRa P2P
LoRaWAN
BLE
It is designed for low power consumption, e.g. there is no loop(), every thing is handled with semaphores.
Timers or external events like interrupts can wake-up the device with the g_task_event_type flag.
Some of these events are handled by WisBlock-API-V2, but the user can define his own events. They are handled in the app_event_handler();, where the user includes his event handlers.
Using this requires a re-thinking if you are used to Arduino setup() and loop(). They are no longer available.