The project I’m just completing has the possibility of having the power to the plug pack switched off and on randomly (I’m trying to kid proof the project).
I have no problem adding a debounced on/off push button to GPIO3 (pin 5) and GND. But I’m more worried about the power to the actual plug pack being turned on and off randomly!
Is this a problem anyway?
If so, is there some way to safeguard against corrupting the SD card or damaging the Pi itself?
I’m not about to use a UPS which is probably the best solution?
Any tips appreciated!
One possible solution may be to set the Pi up as a read-only system so the microSD card can’t be corrupted by losing power mid-write. There are some limitations to this method, but it won’t require any extra hardware.
We’ve got a guide to how to set it up I’ll link it below.
Honestly, an UPS is way to go.
Some source of power in between the plug pack and the Pi.
Pi recognises power loss and shuts down nicely.
Power fluctuations are the bane of electronics. Rapid changes causes spikes, easily exceeding the nominal power supply level.
The suggestion by @Trent5487676 is excellent. Read only SD card.
Also backing up the SD card allows activation again in a short space of time when the running card becomes corrupt. Have adopted that for my projects using Pi and SD card. Much quicker than rebuilding a SD card.
If your application needs to write data use a SD card reader/writer connected to the Pi with the Pi SD set to read only.
Anyway, haven’t had a power fail corruption yet, might just be lucky.