Electron Power Management - not indicating charge on reset

OK, I am still toying around with my new Electron, and I noticed something and cannot seem to figure out the solution from the PMIC Documentation.

Using the basic program below, I notice that sometimes the electron will power up (Power Attached and present) and start to sleep() with the red LED charging indicator ON, and other times, the red LED charging indicator is OFF.

It seems to correspond with battery discharging when no LED lit (when attached to power over USB) and charging when it is illuminated.

Must I get into Power Management with a simple software reset?

A hard reset doesn’t seem to consistently guarantee a charging state (i.e. red LED illuminated) either.

Confusion and lack of documentation on Power Management… takes away from the awesome.

const int triggerPin = D1;

FuelGauge fuel;

char publishString[128] = "";

void setup()
{
  pinMode(triggerPin,INPUT);  // External Pulldown Resistor attached
  int startupTime = millis();
  while(millis() - startupTime < 2000UL)  // allowing time to take digitalRead()
  {
      Particle.process();
  }
  sprintf(publishString, "Power %s, Fuel:%.1f%%", (digitalRead(triggerPin) == HIGH) ? "Restored" : "NOT Detected", fuel.getSoC() );
  Particle.publish("pushover", publishString);
}

void loop()
{
  System.sleep(triggerPin, CHANGE);
  System.reset();
}

:disappointed:

The red charging LED is only lit when the battery is accepting a charge of more than 50mA or something close to that.

1 Like

Thanks!

My power supply must have been on the hairy edge!

1 Like