First, let me start by saying that I am very happy about Particle’s decision to pursue a long term support approach to deviceOS. If you want to read more, please see @vikram’s excellent post here:
https://blog.particle.io/long-term-support-lts-releases-for-device-os-are-now-available/
For devices in remote locations, like mine, having a focus on stability and reliability is a much apprecaited improvement. I plan to use the LTS approach for my devices as much as possible.
I am starting this thread as a continuation of this one given the move from 2nd Generation to 3rd Generation devices and the new LTS context:
If are you are using the Boron or Argon for outdoor applications and the temperature could go below freezing or above 113F (45C), you need to take care to disable charging based on temperature. As the disable charging feature did not make it into the LTS 2.x line, you have another year managing this in your firmware (If you are going to use the 3.x release, this feature is in the current beta).
I wanted to share my approach and see if anyone had ideas for improvement. I think this is worth discussion for two reasons which make this a little more challenging than simply calling pmic.disableCharging():
-
Using the PMIC API is not sticky and there may be times where your settings will be overwritten
-
Changes you make in the PMIC commands are not correctly reflected in the System.batteryState() and you can get incorrect reporting on what is going on with the battery.
Here is how I am currently handling this. I call the following function each hour when the device awakes to report and from Setup(). The context of the battery is passed in a WebHook to Ubidots so I can see what the devices’ battery is doing. I also increment an “alerts” flag so I can get automated reporting across the fleet.
if (!isItSafeToCharge()) current.alertCount++; // Increment the alert count
calls
bool isItSafeToCharge() // Returns a true or false if the battery is in a safe charging range.
{
sysStatus.batteryState = System.batteryState();
PMIC pmic(true);
if (current.temperature < 32 || current.temperature > 113 ) { // Reference: https://batteryuniversity.com/learn/article/charging_at_high_and_low_temperatures
pmic.disableCharging(); // It is too cold or too hot to safely charge the battery
sysStatus.batteryState = 1; // Overwrites the values from the batteryState API to reflect that we are "Not Charging"
return false;
}
else {
pmic.enableCharging(); // It is safe to charge the battery
return true;
}
}
I hope this is helpful, please let me know.
Chip