Hi
I’m powering my electron from VIN with a 12V power source without a LiPo connected. I run in MANUAL mode.
In deep sleep the electron still uses ~2mA.
So I wonder why since it is much more than the 130 µA the data sheet states for deep sleep from LiPo?
When I started my electron actually used even more than 10mA in deep sleep. I found the following two improvements in the forum and applied it to my code the get down to the 2mA:
- Electron SLEEP_MODE_DEEP tips and examples
- Disabling the Electron red charging LED when not using the LiPo
My code looks like this
#include "Particle.h"
STARTUP(System.enableFeature(FEATURE_RETAINED_MEMORY));
SYSTEM_MODE(MANUAL);
//===
retained uint8_t sState = 0;
retained uint32_t sLoopCounter = 0;
//===
int sBlueLed = 7;
Serial1LogHandler sLogHandler(115200,LOG_LEVEL_ALL);
void setCharging(bool enable);
void measure();
void setup() {
Log.info("*** setup [%u] ***",(uint16_t)sState);
pinMode(sBlueLed, OUTPUT);
digitalWrite(sBlueLed, LOW);
if (sState == 0) {
Log.info("First boot ... ");
Log.info(" - Cellular off ");
Cellular.on();
Cellular.off();
Log.info("... First boot DONE ");
sState = 1;
}
Log.info("Charging off ... ");
setCharging(false);
FuelGauge().sleep();
Log.info("... Charging off DONE");
}
void loop() {
digitalWrite(sBlueLed, HIGH);
sLoopCounter++;
Log.info("loop %lu ... ", sLoopCounter );
measure();
Log.info("... loop %lu DONE ", sLoopCounter );
Serial1.flush();
digitalWrite(sBlueLed, LOW);
System.sleep(SLEEP_MODE_DEEP, 2);
}
// just some placeholder will actually do some I2C sensor reads
void measure() {
delay(20);
}
void setCharging(bool enable) {
PMIC pmic;
// DisableCharging turns of charging. DisableBATFET completely disconnects the battery.
if (enable) {
pmic.enableCharging();
pmic.enableBATFET();
}
else {
pmic.disableCharging();
pmic.disableBATFET();
}
// Disabling the watchdog is necessary, otherwise it will kick in and turn
// charing at random times, even when sleeping.
// This disables both the watchdog and the charge safety timer in
// Charge Termination/Timer Control Register REG05
// pmic.disableWatchdog() disables the watchdog, but doesn't disable the
// charge safety timer, so the red LED will start blinking slowly after
// 1 hour if you don't do both.
byte DATA = pmic.readChargeTermRegister();
if (enable) {
DATA |= 0b00111000;
}
else {
// 0b11001110 = disable watchdog
// 0b11000110 = disable watchdog and charge safety timer
DATA &= 0b11000110;
}
// This would be easier if pmic.writeRegister wasn't private (or disable
// charge safety timer had an exposed method
Wire3.beginTransmission(PMIC_ADDRESS);
Wire3.write(CHARGE_TIMER_CONTROL_REGISTER);
Wire3.write(DATA);
Wire3.endTransmission(true);
}
It’s also interesting that the stop mode sleep uses 2.5 mA. So if there is no way to get the current lower in deep sleep the deep sleep makes no sense if you sleep for short periods. In my setup I would use less power with the stop mode than in deep sleep because it adds a time and current overhead to wake up in contrast to the stop mode.
Deep Sleep
Means it sleep for 2000ms at 2mA and runs for about 125ms at ~23mA = 6857 mA*ms
Stop Mode Sleep
Means it sleep for 2000ms at 2.5mA and runs for about 40ms at ~21mA = 5800 mA*ms
I would appreciate any insights in the deep sleep when powering from VIN without LiPo and hints on how to get the current lower than the 2 mA I already reached.
Thanks