We had a power failure during Ciara and we’ve just had another during Dennis. Apart from general annoyance I feel a particular annoyance about raspberry pis and my emonBase in particular. I’m wondering if there’s anything I can do to improve its behaviour and reduce my annoyance?
I have various pis and they mostly come back after a power failure but my emonBase in particular doesn’t. Last time it dodn’t come back and I had to disconnect the power and reconnect it to get it to work. I’ve just done that again and its now responding to pings but
$ ssh pi@emonpi
pi@emonpi’s password:
it’s just hanging here.
So how do I recover it? And how do I prevent it happening again? And why does this happen to an emonBase in particular?
There’s also these: LiFePO4wered/Pi+ | Crowd Supply for a more compact option that can automatically do a clean shutdown, but you’d need to check the pins used by the EmonBase don’t conflict (and get the one with the stackable headers).
Thanks chaps. I’ve ordered some of the Adafruit parts. Is there a good way to detect either when the mains goes, or when the battery is about to be exhausted?
Funnily enough, emonpi is still on stretch. I have another identical pi that is on buster and it comes back but with no network Fortunately it has a screen and keyboard so I can reboot it, after which it comes back as normal. emonpi has no screen or keyboard, so I have to unplug it to reboot, which is not good.
Lately my desktop machine has gone cranky as well. It fails to boot so I have to go into the BIOS then Save and Exit without making any changes and usually it then finds grub, but sometimes it finds an old grub that no longer works and occasionally it just doesn’t boot again. Very tiresome, I think I’ll have to reinstall it at some point.
get yourself an ADC of some kind to connect between the Pi and the Vs pin and watch the voltage level on the Vs pin. It will drop from USB voltage (approx 5V) to BAT voltage (probably around 4.2V) when the mains goes off. OR
Connect the LDO pin to a GPIO pin on the Pi and look for a low signal, which is when the battery is about to go flat.
Then write yourself a watchdog of some kind that does a clean shutdown at the appropriate time.
That looks really neat, I’ve been thinking the same about mine, the power cut here 4-5 times with storm Dennis, the pi came back each time and reconnected to the heatpump and EV charger without any corruption this time but still feels unsatisfactory, would have been nice to have kept all the emonTH data that still comes in through out the power cuts too…
That same pi is also my weather station and that was another reason for keeping it alive for as long as practical without mains power as all my sensor “nodes” are either battery powered or battery backed mains powered as well.