Power Failure to RPi 4B

Hi Everyone.

Following Tim’s excellent tutorial and video on creating an RPi NAS, mine is up and running. Although I have not mastered ‘port forwarding’ yet.

My question is, what happens to the RPi if there is a power failure?

We have the occasional power failure, sometimes short, sometimes long, always without warning!

I understand RPis don’t like being switched off incorrectly as it may harm the SD card.

I don’t want to setup the ‘openmediavault’ every time the power goes off !!

Must I invest in a UPS or need I NOT worry?

What do you think?

Regards, Stephen

1 Like

Never had damage to microSD or SSD. File system can screw up, reboot fails. There are mini UPS designs to give the Pi a few seconds to shut down. They do not handle external disks and other devices you might need.

The most problems appear to be when the power blips out for a fraction of a second then on then off/on/off/on. The OS and file system end up confused. A good UPS will count a delay before restarting.

I am using a solar panel to power a Pi through a battery and am looking at a similar system where a trickle charger tops up the battery. Sort of a DIY UPS. For OMV, the UPS will keep your machine recording that fantastic European movie on SBS or Backroads without missing a frame.

1 Like

Hey @Stephen25652,

Welcome back to the forum!

Peter makes some good points about the risks of power outages and the benefits of a UPS. If you’re interested, here are a few UPS options from Core Electronics that work well with Raspberry Pi:

These can help protect your Pi and keep your NAS running safely during outages.

Thanks Peter, Yes I like the battery supply system charged either by solar or mains. I have a similar system powering a ESP32 CAM, second hand panel from the tip shop and a tired car battery.

I’ve had a few UPSs which have all ended up needing new expensive batteries, and I don’t want to fit a hat.

Thanks for your ideas, Stephen

1 Like

Hi Ryan, as I mentioned to Peter, I’d rather not fit a hat and I have had good results using solar and battery.

Thanks for your input, Stephen

2 Likes

A UPS is highly recommended if you want to protect your RPi and prevent damage to the SD card during power outages. Even a small UPS can provide enough power to allow the Pi to shut down cleanly during a power failure, avoiding file system corruption. A UPS will also give you more time to safely back up any files and ensure that your NAS stays accessible even during short power outages.

2 Likes

Thank you all for your replies.

A UPS seems the only way to minimise damage to the NAS from power failurs.

A solar charged battery power source seems the simplest, cheapest and, even greenest, for my situation.

Thanks everyone,

Stephen

1 Like

I assume you’re using the SDcard for the OS, and different disk(s) for your NAS data. If your main concern is corrupting your SDcard, you should consider making a copy on a second SDcard.

All battery backups keep the RasPi running longer, avoiding brown-outs and short power cuts. However in a long power cut, the battery will eventually run down, and most will cut the power off - thus just postponing the problem they were supposed to fix. In a 5 hour power cut, will it matter whether your SDcard corrupted after 3 hours rather than 3 minutes ?

I was impressed that the PiJuice and Witty Pi 4 L3V7 - RTC & Power Management for Raspberry Pi HATS are able to initiate a clean shutdown before cutting the power off.

I now have my greenhouse running on an ESP32 with a solar panel and DFRobot Solar Power Manager - and hate that it “manages” the power by also just cutting power without warning. The answer is to :
(a) detect the battery’s voltage - can be an Analog Voltage Divider (couple of resistors if you’re happy soldering, or a board) connected to an analog pin; or a power monitor board like this which supplies a digital value
(b) provide the voltage value to the microcontroller (RasPi or ESP32)
(c) run a program on the microcontroller to take action when the battery voltage reaches a predefined low point. This is where the Witty’s supplied software shines.

It all comes down to how much risk vs how much expense you are comfortable with.

1 Like

Thanks for your reply Donald.

Yes, risk v expense is the question. As I am just experimenting at this stage, I will hook up a battery. I have recently replaced my old Land Cruiser starter battery which was failing but still has plenty of juice for my electronics projects and I also salvaged some solar panels from the tip shop to keep it topped up.

I will also make a copy of the SD card as you advised, thanks.

The Witty Pi 4 L3V7 module appears ideal for system reliability, not too dear either.

Regards,

Stephen

Hi Stephen

OK I suppose for a temporary measure but this is the wrong type of battery for anything permanent. Auto batteries are not designed for float charging and will sulphate fairly quickly. They need that few hundred Amps every so often (like in starting the engine) to keep them happy.
Cheers Bob

G’Day Robert.

Yes, you’re probably right, the setup is not ideal but it’s what I have on hand.

I have a smaller car battery set up to power an ESP32 CAM and charged by a 17V PV panel via a solar charge controller.

It has been running for about three years now, who knows for how much longer ??

When it finally fails I’ll see the local auto electrician and pick up another, not fully dead, car battery for probably $0.

FYI, the car batteries live outside so there’s no gas buildup in the house.

Thanks for your thoughts,

Stephen

1 Like

Hi Stephen

Probably OK as long as you keep an eye on the battery state.
I do know of one installation where a float charged car battery was installed as a DIY back up power for a security system. I am not sure if they even switch the mains power off now and again to check operation and exercise the system so when the premises gets burgled and the perpetrators turn the power off they probably will not have any video to look at.

When a car battery gets to the stage where it is no longer chargeable the modern mains power operated smart charger will indicate this and will not go ahead. At least mine does anyway. Even the older ones will just sit there with zero or very little charging current probably for ever if you don’t terminate the process.

Battery charging is not electricity storage, it is a chemical process and when this can no longer happen for whatever reason the whole operation stops and in practice that is usually the end of useful life.
Cheers Bob
PS. It is a bit academic but the only thing that can “store” electricity is a capacitor. Even if the term “store” is often used a battery is a chemical action that changes the chemical characteristics of the internal materials.

1 Like