Hi I am working on development of a new device after being absent from the Particle world for a few years. I have been reading about pmic and charge management for cold weather applications on the Boron (5.7.0). Right now I have a NTC thermistor which disables charging below 33 degrees F. Something like:
My question is about making this 'sticky'. I don't sleep the device right now and evaluate the code above every minute or so. This post talks a little about how to do this but is a few years old. A few questions:
Do I use pmic.lock() or PMIC pmic(true) or something else?
How do I make this sticky for a long time?
Right now I use pmic.lock() and plugging the Boron into a charger with battery eventually causes the LED to flash green and the device to be not connected anymore. - I have a feeling it has to do with calling lock(). Maybe the solution is to create a power config with .batteryChargeCurrent(0) instead?
I know there are lots of use cases out there but nobody wants to break their battery. I think it could really great to have the option to just tell the power configuration a pin for a simple NTC thermistor input or feed a temperature variable to the power configuration somewhere. I am actually surprised something like this isn't supported from a liability perspective.
The PMIC charging setting will be overwritten by the system unless you disable power management, but you can change it in the system power manager instead. This is from Tracker Edge, which manages charging itself based on its thermistor.
int Tracker::pmicEnableCharging() {
auto powerConfig = System.getPowerConfiguration();
if (powerConfig.isFeatureSet(SystemPowerFeature::DISABLE_CHARGING)) {
powerConfig.clearFeature(SystemPowerFeature::DISABLE_CHARGING);
return System.setPowerConfiguration(powerConfig);
}
return SYSTEM_ERROR_NONE;
}
int Tracker::pmicDisableCharging() {
auto powerConfig = System.getPowerConfiguration();
if (!powerConfig.isFeatureSet(SystemPowerFeature::DISABLE_CHARGING)) {
powerConfig.feature(SystemPowerFeature::DISABLE_CHARGING);
return System.setPowerConfiguration(powerConfig);
}
return SYSTEM_ERROR_NONE;
}
The reason you can't just connect a thermistor is that the bq24195 PMIC doesn't have the ability to turn off temperature charge control in software. When the Electron first came out (the first device with that PMIC), the LiPo packs with built-in thermistors weren't as common, and other vendors like Adafruit and Sparkfun used the non-sensor packs with 2-pin JST-PH connectors so we did the same.
Since the PMIC doesn't have the ability to turn temperature sensing on and off, the only way is to make sure the TS pin is of the correct voltage to allow charging. We put a fixed voltage divider to force charging to always stay on. Once you do this, there is no combination of resistors that could also make it work with or without a real thermistor, and it would require a switch or trace cut or something, which we did not do.
Some newer devices like the Monitor One use a 3-pin LiPo with a temperature sensor, and some future devices may both require a sensor battery and use the PMIC TS pin. Because the Monitor One uses the Tracker SoM, and the Tracker SoM TS pin has the force on voltage divider, it can't use the PMIC temperature sensor.
Thanks for the background and code. I will try this out and see how it works.
Yes - I have one of those Electron's which has been running continuously in a remote location for many years. Still working great.