Please include the following information, in order for us to help you as effectively as possible.
-
What product do you wish to discuss? RAK4631, RAK3372, RAK11200, RAK11310, RAK11722? RAK 4631
-
What firmware are you using? (RUI3 or Arduino BSP or other IDE (e.g. STM32CubeIDE)? Arduino BSP
-
What firmware version? Can it be obtained with AT+VER=?
-
Computer OS? (MacOS, Linux, Windows) Windows
-
What Computer O
Preformatted textS version? Windows 11 -
How often does the problem happen? With every node I’ve tried
-
How can we replicate the problem? My setup is the RAK 19001, RAK 4631, RAK12002, RAK 13009, RAK 15002. I have an Adafruit ADS1115 connected via QWIIC to the RAK 13009. Every time I upload, the ADS is no longer powered. It seems to be a conflict with the RTC. It stays powered on until I upload the unix time to the RTC. After that I can’t get the ADS to power back on. When I use a RAK 1920 this isn’t an issue.
-
Provide source code if custom firmware is used or link to example if RAKwireless example code is used.
main.ino
#include "config.h"
#include "storage.h"
#include "sensors.h"
#include "lora.h"
#include <Arduino.h>
#include "Melopero_RV3028.h"
#include "battery.h"
//#include <Wire.h>
Melopero_RV3028 rtc;
uint32_t lastSendSlot = 0;
#ifndef LED_BUILTIN
#define LED_BUILTIN 35 // green LED
#endif
#ifndef LED_BUILTIN2
#define LED_BUILTIN2 36 // blue LED
#endif
static uint32_t count = 0;
static uint32_t count_fail = 0;
void setup() {
Serial.begin(115200);
pinMode(WB_IO2, OUTPUT);
digitalWrite(WB_IO2, HIGH); // Enable 3V3_S sensor rail
delay(100);
initBattery();
initSensors();
initSD();
lora_init();
joinLoRa(); // Start Join procedure
// RTC setup
rtc.initI2C();
delay(100);
rtc.writeToRegister(0x35, 0x00);
rtc.writeToRegister(0x37, 0xB4); //Direct Switching Mode (DSM): when VDD < VBACKUP, switchover occurs from VDD to VBACKUP
/****************
Set unix time once or if the time needs reset then comment out
after it is set on all other uploads!
****************/
//rtc.setUnixTime( 1778528440 );
// LED setup
pinMode(LED_BUILTIN, OUTPUT);
pinMode(LED_BUILTIN2, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(LED_BUILTIN2, LOW);
time_t timeout = millis();
while (!Serial) {
if ((millis() - timeout) < 5000) {
delay(100);
} else {
break;
}
}
Serial.println("Setup complete");
}
void loop() {
uint32_t now = rtc.getUnixTime();
uint32_t currentSlot = now / SEND_INTERVAL;
uint16_t battery_mv = readBatteryMV();
if (currentSlot != lastSendSlot) {
Serial.print("Battery: ");
Serial.print(battery_mv);
Serial.println(" mV");
readSensors();
logToSD(now, pressure, battery_mv);
if (isLoRaJoined()) {
sendLoRaFrame(pressure, battery_mv);
} else {
Serial.println("Not joined yet, data logged locally only");
}
lastSendSlot = currentSlot;
}
delay(5000);
}
sensor.cpp
#include "sensors.h"
//#include <Wire.h>
#include <Adafruit_ADS1X15.h>
// ========================
// Sensor objects
// ========================
Adafruit_ADS1115 ads1115;
// ========================
// Sensor state
// ========================
int16_t pressure = 0;
bool adsPresent = false;
bool shtPresent = false;
// ========================
// Init sensors
// ========================
void initSensors()
{
//Wire.begin();
// -------- ADS1115 --------
if (ads1115.begin())
{
Serial.println("ADS1115 detected.");
adsPresent = true;
ads1115.setGain(GAIN_ONE);
}
else
{
Serial.println("ADS1115 not found.");
adsPresent = false;
}
}
// ========================
// Read sensors
// ========================
void readSensors()
{
// -------- Pressure sensor --------
if (ads1115.begin())
{
ads1115.setGain(GAIN_ONE);
pressure = ads1115.readADC_SingleEnded(0);
adsPresent = true;
Serial.print("pressure: ");
Serial.println(pressure);
}
else
{
pressure = 0xFFFF; // sentinel value
adsPresent = false;
Serial.println("ADS missing → LW invalid");
}
}