Community
OpenEnergyMonitor

Community

emonBase power failure behaviour

Tags: #<Tag:0x00007f6e08effe70>

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 [email protected]
[email protected]’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?

I can’t really help you with your current boot problem, but the way I protect mine from power loss is I’ve got mine powered by one of these: https://www.adafruit.com/product/2465 combined with a 1 cell 10Ah LiPo battery (extracted from a cheap phone backup power pack).

There’s also these: https://www.crowdsupply.com/silicognition/lifepo4wered-pi-plus 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).

1 Like

I think some of this is dependent on how much IO is happening at the point of failure.

I’m with @Greebo and suggest investment in some form of UPS.

I also have a suspicion that Buster is not as resilient as Stretch was to power offs.

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 :frowning: 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.

I’ve not bothered with any detection on mine as the battery lasts ages, but according to the tutorial here: https://learn.adafruit.com/adafruit-powerboost-1000c-load-share-usb-charge-boost/pinouts you have two options.

  1. 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
  2. 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.

Thanks. I hadn’t looked anywhere else yet, so the link to the Adafruit page saves me some time :slight_smile:

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. :slight_smile:

1 Like