I pulled the UPS out again last night l so I could get at things to investigate the problem. Here’s what I found:
- The battery voltage dropped to ~2.5V after the Pi started booting.
- It behaved the same when the Pi was powered directly from the 18650 boost circuit (with the rest of the circuit disconnected).
- Another 18650 cell was swapped in and the Pi booted fine and ran until I shut it down manually.
- With the new cell in place and the rest of the circuit connected it all functioned as expected.
So I've concluded that the cell had become discharged, as it is permanently powering the boost circuit, and wasn't able to support the Pi's power requirements for boot up. I knew that the on-off switch only disconnects the output to the USB socket, but underestimated the boost circuits drain and the impact it would have when used in this manner. Compounding the problem is the DC-DC converter supplying the Pi and the cell; it can't deliver enough current to both charge the depleted cell and allow the Pi to boot.
After my last post, I had a brief discussion with Bud Bennett and I began to re-evaluate my approach. I don't actually need the option of a keep-alive mode where I can choose to keep the Pi running for minutes/hours after main power loss instead of shutting down straight away. I added it because I could. So I don't need the selectable delay provided by the µC or the indicator LEDs, again, only included because I could. The Pi is quite capable of shutting down based on the state of a GPIO pin driven from a simple divider hanging off the main supply, I just had the µC do it for flexibility. I only have to provide enough power for ~30sec. So have I over complicated it? I do that sometimes.
I could use a beefier converter capable of providing more current and ensure the cell is also disconnected from the circuit at switch off, but that's a PITA. I want to keep it simple and low cost so it'd be easy to make another for any Pi project. I'm avoiding doing a custom PCB as I'd like to stick to off-the-shelf parts so it's quick and easy to duplicate. If you need me, I've gone back to the drawing board.