How to turn off by software? while the battery level is under 2.0V (with LDO)
Hi there,
AFAIK , Doesn’t exist or isn’t supported by Xiao?
I’m doing this in some code, maybe one of the other folks can comment?
void goToPowerOff() {
setLedRGB(false, false, false);
Serial.println("Going to System OFF");
u8x8.clearDisplay();
u8x8.setCursor(0, 3);
u8x8.print("SLEEP");
setupDoubleTapInterrupt(); // not needed here, if already applied..
delay(1000); // delay seems important to apply settings, before going to System OFF
//Ensure interrupt pin from IMU is set to wake up device
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(int2Pin), NRF_GPIO_PIN_PULLDOWN, NRF_GPIO_PIN_SENSE_HIGH);
delay(2000); // Required delay
// Trigger System OFF
NRF_POWER->SYSTEMOFF = 1;
}
HTH
GL
It looks just power saving sleep. Doesn’t it comsum the battery anyway?
I need real power off. Can it be possible?
To turn off a device by software when the battery level is under 2.0V using a Low Dropout Regulator (LDO), you’ll need to implement a voltage monitoring mechanism. Continuously measure the battery voltage using an analog-to-digital converter (ADC). Ensure the ADC is connected to the battery voltage through appropriate voltage dividers if needed. Within your software, periodically read the ADC values to monitor the battery voltage. When the read voltage drops below 2.0V, trigger a software-controlled shutdown sequence. This sequence should initiate a controlled power-down process, saving any critical data or settings and gracefully shutting down the device’s operations. After the shutdown sequence, you can use the LDO to completely cut off power, ensuring the device is fully turned off, conserving the battery and preventing damage due to undervoltage.
I believe we know the sequence, However There is no Command or Hardware pin to do what you Hypothesize. You have any “Code” to give example which is what the Op was asking.
HTH
GL PJ
Hey folk, When it comes to safely shutting down a device with an LDO when the battery level dips below 2.0V, implementing a robust voltage monitoring system is key. Make sure you are regularly checking the battery voltage using an ADC, with the appropriate connections and dividers in place for accurate readings. In your software, keep a watchful eye on those ADC values. Once they signal a drop below 2.0V, kick off a well-coordinated shutdown sequence. This sequence should handle crucial tasks like saving data and adjusting settings before gracefully shutting down the device. Post-shutdown, leverage the LDO to cut off power entirely, ensuring a complete and secure shutdown. This not only conserves battery life but also safeguards against potential under voltage issues.
Hey PJ, it seems like you’re referring to a specific sequence or action within
Summary
. While there may not be a direct command or hardware pin for the hypothesized action, providing code examples could certainly offer clarity. Sharing code snippets relevant to the discussion could help illustrate the process better.
Once the voltage below the 2.0V execute the shut down routine in your system. The routine should include basic function like politely close the active app, save necessary data.