Everything breaks at the most inconvenient time – that’s a fact of life. So it’s hardly surprising that I discovered my power bank was broken on a several-hour long train/bus journey. Once I got home, I decided I’d fix it.
Opening it up, I could see the circuit was divided into two boards: one with the battery and the charging and protection circuitry, and one with the boost converter. I didn’t do too much reverse-engineering of either board but I did discover that the boost converter board had a logic input from the charging/protection board, which enabled or disabled power to all of the circuitry.
The problem seemed to be that nothing would make the protection board drive this high. It has a button to switch it on and, even with the battery fully charged, it would just blink its LEDs to tell you the battery was flat when you pressed this button. Connecting the boost converter board to a bench power supply at 4V and pulling the enable input high, the converter was working fine. So the fault seemed to be with the battery protection.
Rather than bypassing it completely and sacrificing all protection on the battery, I figured an adequate protection for the battery would be an undervoltage cutout. It should cut out at around 3V. It should have some hysteresis too: once the load is removed the battery voltage will recover a bit. I don’t want this to cause oscillation. Once it trips, it shouldn’t reset until the battery’s recharged a fair bit. For this, I’d set a rising threshold of 3.6V.
To achieve this I’d need a low-power comparator and a reference. I thought my chances of finding something lying around were pretty slim – and I didn’t think this project was worth buying parts for. Power banks are easy to come by and if I couldn’t find the stuff to fix this right now, it would have just gone in the bin. So it’s lucky that, looking through a drawer of “Misc ICs”, I found a MAX931:
An ultra low-power comparator with internal reference was exactly what I needed! And the supply voltage range conveniently covers the 3V-4.2V range over which I need this to work. The circuit I used is a very simple comparator circuit with the inverting input fed from the internal reference. The “HYST” pin controls an internal hysteresis. I decided not to use that – the maximum hysteresis it can add is around 10% but I want closer to 20%. Instead, I achieve the hysteresis by adding a feedback resistor.
For the falling threshold of 3V and the rising threshold of 3.6V, I want a nominal 3.3V threshold (halfway between the two) with a 600mV hysteresis. R1 as 1M and R2 as 560k means the non-inverting input would match the 1.182V reference at the inverting input with an input voltage of 3.29V – pretty much spot on the nominal threshold I was looking for. Divider current will only be about 3.7V/1560kohm=2.4uA. Compare this with the typical input leakage of 10pA with a maximum of 5nA over temperature: this divider current is enough that input leakage can be ignored.
The low threshold is the most critical one, so I calculated the hysteresis based on this. We want to trip at 3V. At 3V, the Thévenin equivalent of R1 and R2 would be a 3*560/1560=1.077V source, with an impedance of 560||1000=359kohm. To bring this up to the 1.182V reference and make this trip, we need to deliver a current into it of (1.182-1.077)/359k=292nA. For output currents <1mA or so, the output will more or less be at the rail:
So the feedback resistor needs to be set to deliver that 292nA with 3V-1.182V across it. That means for R3 we’d like (3-1.182)/292n=6.23Mohm. 6.8Mohm was the closest value to this that I had so that’s what went in. The current draw of this circuit will be around 5uA, about equally split between the potential divider and the comparator quiescent current. The battery is supposedly 5Ah – if that’s the case this circuit will take around a million hours or 114 years to fully discharge the battery.
I threw the circuit together on breadboard:
I cranked the voltage up and down to check the trip points and as expected, the output would switch on at about 3.6V and off at about 3.0V.
This is far from my finest soldering job but I airwired all the components together:
I’m never going to need to charge four devices at once, so I removed a couple of USB ports to make space for this circuit:
I’m not sure that anyone actually needs to charge four devices at once from a powerbank. I suspect the number of USB ports is partly a historical thing: I remember a time when a lot of USB devices were very picky about what a charger did with the data lines. You can see in the above picture that the ports are labelled with different current ratings and have different resistor networks between D+ and D-. All of my devices charge fine from all of these ports so I just removed the two ports labelled with the lowest currents and wired the circuit in.
This was a real mess and I’d accepted that this is a total bodge job – hence the comparator wrapped up in insulation tape.
I found that the boost regulator, when idle, would draw around 24mA. This would run the (supposedly) 5Ah battery flat in a little over a week. For this reason I bodged a switch in series with the enable output, so that the power bank could be switched off when not in use.
The end result is a mess. But it works. And it has a switchy switch! It goes click! Waste not, want not – hopefully it will last me a little while longer now. Until it breaks at the most inconvenient time – but I guess that’s just a fact of life.