The Adafruit Feather M4 Express is a lovely piece of kit. It has just one flaw – the yellow “charging” LED flickers constantly whenever the Feather is powered by USB. This is because of the Li/poly charger on board – if you have no battery, the charger attempts to charge the stray capacitance of the board, turning on the “charging LED”; when it reaches the critical voltage (4.2V) it turns off, turning off the LED; once the charge leaks away the charger starts charging again, turning on the LED and restarting the cycle. This is all very sad, and very annoying. Especially since you cannot disable the on-board charger.
The datasheet makes clear that the charger does have battery detection – so why is it attempting to charge even when there is no battery connected to the Feather?
The answer is in section 4.2. The chip sources 6µA on the Vbat pin; if the voltage of that pin goes over the target voltage Vreg (4.2V, see section 1) plus 100mV, the device assumes a battery is not present; if below, a battery is present. But why is this not working?
The schematic shows that the Feather connects the Vbat pin to more than just the battery: in order to monitor the charge of the battery, it connects Vbat to ground via 2 × 100kΩ resistors forming a voltage divider (the midpoint is taken to Ain13 (=A6) on the SAMD51 chip – we assume the sink current here is negligible). That means that at 4.2V we expect a current of 21µA – more than enough to trigger battery detection! Oh dear.
Drastic solutions are possible – e.g., cutting the charge LED resistor R2, or the voltage divider R96. But I’d rather not cut my board.
All we need to ensure is that Vbat is over 4.3V. We can do this with a pull-up resistor from Vbat to Vbus (USB). With Vbus at a nominal 5V, and a current of 21µA, we need a resistor of less than 33kΩ. Since Vbus is likely lower (I measured 4.85V with my setup), we’ll give it a 3× safety margin and use a 10kΩ resistor. At the cost of a leakage current (Vbus to ground) of just 24µA (1/40th of a milliamp), this should disable the charger correctly when no battery is fitted!
DO NOT USE THIS IF A BATTERY IS CONNECTED!
DO NOT USE ANY PULL-UP RESISTOR IF A BATTERY IS CONNECTED!
What will happen if a battery is fitted?
The minimum value of the lowest permitted battery voltage (UVlo) is 3.2V (section 1); with a 10kΩ resistor to 5V we will charge this at a rate of 0.2mA. Even at full charge (4.2V), we will continue to charge at around 0.1mA. Even though this seems like a tiny current, lithium batteries do not saturate and have no safe trickle current – even at 0.1mA, your battery will eventually catch fire and explode. You do not want this to happen. In any case, you don’t need the resistor – if you have a battery fitted, the charge LED will not flicker.
Summary: to stop the flicker when no battery is connected, connect a 10kΩ resistor between the BAT and USB pins. REMOVE THE RESISTOR IF A BATTERY IS CONNECTED, OR YOUR BATTERY WILL EVENTUALLY EXPLODE.
I hope this has been useful! I’d love to hear about your experiences – please comment below.