The 3V3 pin will have 0.460 V when in standby mode with LiPo power (only) and EN pin grounded.
Battery power capability is measured in C's. A C is the Amp-hour capacity divided by 1 hour (C = 2 Ah / 1 = 2A). DC power is defined in terms of watts, or the power that is delivered to sustain a voltage at a specified current. W-h (Watt-hours) is the measure of voltage * Amp-hours. A 300 mAh battery sustaining 3.6 V (nominal) will deliver 1080 mWh.
#include "Particle.h"
#if (PLATFORM_ID == PLATFORM_XENON)
SYSTEM_MODE(MANUAL);
#endif
/////////////////////////////////////////////////////////////////////////
// Battery charging status
// Source: https://github.com/rickkas7/DiagnosticsHelperRK
#include "DiagnosticsHelperRK.h"
const unsigned long TIMER_INTERVAL_MS = 1000;
unsigned long timerLast = 0;
int lastPowerSource = -1;
int powerSource = -1;
#if PLATFORM_ID == PLATFORM_BORON
#define PWR -1 // Fake assignment to avoid error
#endif
/////////////////////////////////////////////////////////////////////////
void setup() {
pinMode(D7, OUTPUT);
Serial.begin(9600);
waitFor(Serial.isConnected, 30000);
delay(1000);
Serial.printlnf("System version: %s", System.version().c_str());
Serial.printlnf("Free RAM %d", System.freeMemory());
} // setup()
void loop() {
if (timerLast > millis()) timerLast = millis();
if ((millis() - timerLast) > TIMER_INTERVAL_MS) {
if (PLATFORM_ID == PLATFORM_ARGON || PLATFORM_ID == PLATFORM_XENON) {
pinMode(PWR, INPUT);
byte pwr = digitalRead(PWR); // PWR: 0=no USB power, 1=USB powered
// NOTE: Need to test with VIN power
if (pwr == 0)
powerSource = 5; // POWER_SOURCE_BATTERY
else
powerSource = 2; // POWER_SOURCE_USB_HOST
} else if (PLATFORM_ID == PLATFORM_BORON) {
// DiagnosticsHelper works on Boron LTE (the Argon and Xenon don’t have a PMIC chip)
powerSource = DiagnosticsHelper::getValue(DIAG_ID_SYSTEM_POWER_SOURCE);
}
if (powerSource != lastPowerSource) {
lastPowerSource = powerSource;
// POWER_SOURCE_UNKNOWN = 0,
// POWER_SOURCE_VIN = 1,
// POWER_SOURCE_USB_HOST = 2,
// POWER_SOURCE_USB_ADAPTER = 3,
// POWER_SOURCE_USB_OTG = 4,
// POWER_SOURCE_BATTERY = 5
if (powerSource == 1 || powerSource == 2 || powerSource == 3 || powerSource == 4) {
Particle.publish("PWR", String::format("USB %d", powerSource), PRIVATE);
} else if (powerSource == 5) {
Particle.publish("PWR", String::format("battery %d", powerSource), PRIVATE);
} else
Particle.publish("PWR", String::format("%d", powerSource), PRIVATE);
}
timerLast = millis();
} // timer
} // loop()
Boron battery life/use estimates by Rftop
As of version 1.5.0 a new API System.sleep() exists to assist with low power operation. The two sleep modes are STOP and HIBERNATE.
The command System.sleep() can be configured to monitor a digital output and cause a device to wake up from sleep mode.
AF TPL5110 Low Power Breakout (trigger EN pin)
AF TPL5111 Low Power Reset Timer (break power input)
Adafruit USB, DC, & Solar LiPoly Charger
A very small 6V 1W solar charger has a size of 3.5" x 4.4" x 0.2" (89mm x 113mm x 5mm).
Connection to USB pin rather than USB connector
errors in analogRead(BATT) are significantly reduced at a Li-Po voltage of 3.9V or above
Adafruit USB, DC, & Solar LiPoly Charger
Low-Poser Boron LTE using EN pin (great data)
More AF FeatherWing products from Adafruit and from Particle
Do you need help developing or customizing a IoT product for your needs? Send me an email requesting a free one hour phone / web share consultation.
The information presented on this website is for the author's use only. Use of this information by anyone other than the author is offered as guidelines and non-professional advice only. No liability is assumed by the author or this web site.