Solar power and raspberry pi safe shutdown

ahoy pirates i’m making a solar solution for my pirate radio and im trying to work out how to safely shutdown my raspberry pi zerow when battery power/solar is low like the zero lipo module does!

i currently have an adafruit USB DC Solar Lithium Ion Polymer charger set up like this

I also have the zero lipo module… which has a nice clean shutdown script https://github.com/pimoroni/clean-shutdown so i was wondering if i could get these two kits to play nice together to safely shut it down when power is running out.

i was wondering if anyone has achieved anything like this?

Looks like the charger/power supply has a low voltage LED fixed at 3.1v. You could potentially splice a wire from that LED onto the Pi GPIO, but you’d want to measure what voltage the LED is lit at first.

From the store page, I can’t determine the output voltage. Is it just the battery voltage? <=3.7v?

some info here https://cdn-shop.adafruit.com/datasheets/MCP73871.pdf

i was thinking i could connect this https://www.adafruit.com/products/2190 directly to your zero lipo with a JST cable and let that do the shut down work?

I think a boost/buck would output a constant 5v though, which would both be out of the Zero LiPo’s input range (it takes 3.7v and boosts it to 5v) and would never drop below the low voltage threshold.

good point possibly only at last minute! :)

same issue here - https://forums.adafruit.com/viewtopic.php?f=19&t=112117&p=560498&hilit=USB+DC+Solar+Lithium+Ion+Polymer+charger+raspberry+shutdown#p560498

I’m actually quite surprised by how useless the responses are.

Do you have any idea what the output voltage range on the solar doodad is? Do you have any tools to measure it? Does it even change at all?

I guess most of the time you’d want to shut down under a low voltage condition, but then also somehow start back up again when the low voltage condition is cleared…

BUT

If you start back up too quickly once the low voltage condition is cleared, and before the battery has fully charged (or sufficiently charged), you’re going to have a bad time- you’ll end up ping-ponging in and out of shutdown as the battery wavers on the edge of low voltage.

I think what they’re getting at is, that to do this properly you would need to monitor the input voltage from the solar panel, plus the voltage from the battery and make some decisions about what to do in various cases- most likely requiring a microcontroller to arbitrate the power supply.

IE:

  • Battery is low, and is being charged by 2v from the panel, we can calculate we need to wait X hours before it’s safe to turn on
  • Battery is low, and is being charged by 12v from the panel, we know there’s enough headroom to run the Pi and charge the battery so we keep going
  • Supply from panel was sufficient to run and charge but drops out suddenly while the battery is still being charged and is still low voltage… guess we’re straight into a hard shutdown

And that’s just three cases I can contrive off the top of my head.

In your case, if you just want to shut it down, you can watch the low voltage indicator and do so. Then you can use the very powerful computer in your brain, and set of sensors in your head to solve all the edge cases and make an informed decision about whether to turn it back on :D