Cold Weather and LiPO Charging

Tags: #<Tag:0x00007fe21f158610>


If you live in the US, you are probably noticing the very low temperatures we are experiencing across most of the country. For the last couple weeks, I have been preparing for this first big cold snap by implementing something I should have done a long time ago - Temperature limits on LiPO battery charging. In searching the forum, I have seen this issue raised but I did not see anyone share their approach so, I thought I would post mine. As always, please weigh in with questions or - hopefully - suggestions on how to improve.

Requirement: Don’t allow the Electron to charge the LiPO battery when it is below 0°C or over 45°C according to this and many other references.

I put a simple and cheap temperature sensor (TMP-36) on the carrier board inside the enclosure as the Electron does not expose the thermister from the charge according to @rickkas7 in this post.

My device sleeps during the hour, waking only for a second or so to count a car / person who triggers a hardware interrupt. My current plan is to measure the temperature at the top of the hour when the device wakes to send data to Particle / Ubidots. I use a 3.5W 6V Voltaic panel and a 460uF capacitor to smooth things out.

I am using @rickkas7’s PowerCheck class which I got from this post and the temperature from the TMP-36. Here is the code:

// These are the functions that are part of the takeMeasurements call
void takeMeasurements()
  if (Cellular.ready()) getSignalStrength();                          // Test signal strength if the cellular modem is on and ready
  stateOfCharge = int(batteryMonitor.getSoC());                       // Percentage of full charge

  getTemperature();                                                   // Load the current temp

  if (temperatureF <= 32 || temperatureF >= 113) {                      // Need to add temp charging controls - 
    snprintf(powerContext, sizeof(powerContext), "Chg Disabled Temp");
    power.disableCharging();                                          // Disable Charging if temp is too low or too high
    if (Particle.connected()) Particle.publish("Alert", "Charging disabled Temperature",PRIVATE);
    return;                                                           // Return to avoid the enableCharging command at the end of the IF statement
  else if (powerCheck.getIsCharging()) {
    snprintf(powerContext, sizeof(powerContext), "Charging");
  else if (powerCheck.getHasPower()) {
    snprintf(powerContext, sizeof(powerContext), "DC-In Powered");
  else if (powerCheck.getHasBattery()) {
    snprintf(powerContext, sizeof(powerContext), "Battery Discharging");
  else snprintf(powerContext, sizeof(powerContext), "Undetermined");

  power.enableCharging();                                               // We are good to charge 

This works well with the devices disabling charging when it is freezing and then re-enabling charging at the next hour if it has warmed up. Here is a view of the past week across a group of devices, as you can see the cold does have a significant impact on the batteries but they do bounce back once they can charge.
as you can see, it is currently still cold so charging is disabled across most of the group now. I added this information to my Ubidots webhook so now I can see the battery level and the context.

I do have a couple ideas for improvement (such as checking temp during the hour if charging is disabled) which I will test. But, this works well enough that I thought I would share.

One question prompted by the dip in battery charge: When charging is disabled using the power.disableCharging(); command, does the electricity from the solar panel still get used to power the Electron? Please chime in if you know.

Thanks, Chip


Yes the power on VIN should offset the power pulled from the battery when the charging disabled command is being used.


Does this issue apply to a Boron as well?


Yes, same PMIC chip on both.