Skip to content

Commit 9c88907

Browse files
committed
nicla-system: Make the safety timer configuration explicit.
1 parent e51a021 commit 9c88907

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

libraries/Nicla_System/examples/NiclaSenseME_BatteryChargingSimple/NiclaSenseME_BatteryChargingSimple.ino

+10
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,22 @@ void setup(){
2727
nicla::leds.begin(); // Start I2C connection to LED driver
2828
nicla::setBatteryNTCEnabled(true); // Set to false if your battery doesn't have a NTC.
2929

30+
/*
31+
Set the maximum charging time to 9 hours. This helps to prevent overcharging.
32+
To get an estimation of charging time, you can use the following formula:
33+
Charging time (in hours) = (Battery capacity in mAh) / (0.8 * Charging current in mA)
34+
This formula takes into account that the charging process is approximately 80% efficient (hence the 0.8 factor).
35+
This is just a rough estimate, and actual charging time may vary depending on factors like the charger, battery quality, and charging conditions.
36+
*/
37+
nicla::configureChargingSafetyTimer(ChargingSafetyTimerOption::NineHours);
38+
3039
/*
3140
A safe default charging current value that works for most common LiPo batteries is 0.5C,
3241
which means charging at a rate equal to half of the battery's capacity.
3342
For example, a 200mAh battery could be charged at 100mA (0.1A).
3443
*/
3544
nicla::enableCharging(100);
45+
3646
nicla::leds.setColor(blue);
3747
}
3848

libraries/Nicla_System/src/Nicla_System.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ bool nicla::enableCharging(uint16_t mA)
150150
// Also sets the input current limit to 350mA.
151151
_pmic.writeByte(BQ25120A_ADDRESS, BQ25120A_ILIM_UVLO_CTRL, 0x3F);
152152

153-
configureChargingSafetyTimer(ChargingSafetyTimerOption::NineHours);
154-
155153
return _pmic.getFastChargeControlRegister() == _fastChargeRegisterData;
156154
}
157155

libraries/Nicla_System/src/Nicla_System.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class nicla {
101101
* For example, a 200mAh battery could be charged at 100mA (0.1A).
102102
* This charging rate is generally safe for most LiPo batteries and provides a good balance between charging speed and battery longevity.
103103
* @note If your battery doesn't have an NTC thermistor, the charging speed will be limited to ~16mA.
104-
* @note There is a saftey timer that will stop the charging after 9 hours by default.
104+
* @note There is a saftey timer that will stop the charging after 3 hours by default.
105105
* This can be configured by calling configureChargingSafetyTimer().
106106
* @return true If the fast charging is enabled successfully. False, otherwise.
107107
* @see disableCharging()

0 commit comments

Comments
 (0)