M
M
Meliborn2020-06-16 14:06:07
Hard disks
Meliborn, 2020-06-16 14:06:07

Uninterruptible for Raspberry 4 + HDD + WIFI router?

I made a so-called smart home in the country in the form of a home assistant with a bunch of automation. The electricity there is not very stable, so there are surges and sudden shutdowns. From the very beginning, I used the SD card as the main storage place, but after another power outage, it went to the other world, bringing a bunch of data recovery headaches.
After that, an external hard drive was purchased, and the SD card only stored the /boot folder, because. on 4 raspberries it was impossible to do otherwise. But here the problem is not bypassed. After another jump, raspberry refused to boot giving me Kernel Panic : VFS :Unable to mount root fs on unknown-block . I had to look for another SD card, install a clean OS and connect the disk. Fortunately, I got off with a fsck run.
In general, this situation shook me a little and it was decided to make a normal uninterruptible power supply.
Hence the question, how best to organize all this business? I want to power the raspberry, hdd and router (omni kinetic).
And I do not fully understand how to properly get around the situation when the power ends with UPS? Are there any events based on which you can turn off the raspberry "correctly" through shutdown? And if turned off, then how to turn it on, if the only way I know is to simply remove it and plug it into the power outlet.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Andrey Ermachenok, 2020-06-16
@eapeap

There are two options:
1. Or, when the charge drops, somehow turn off your equipment, then turn off the uninterruptible power supply. When power is applied, the uninterruptible power supply should turn on again, and then equipment
2 will turn on. Or put such a battery that your equipment is guaranteed to work until power is restored (I don’t know the specifics, this is a day or a week). In this situation, you can return to the SD card and not power the router from the uninterruptible power supply to save battery.

P
Puma Thailand, 2020-06-16
@opium

Uninterruptible power supplies have a usb date output, you can turn it off normally, at the expense of turning it on, it only comes to mind wake on lan

A
AiR_WiZArD, 2020-06-17
@AiR_WiZArD

One of the methods that I use on a 3d printer is a battery from an uninterruptible power supply + a 12v power supply + a DC-DC buck converter with current limiting to charge the battery + a buck converter for 5v + 2 Schottke diodes to switch to the battery. Perhaps this is redundant, but the system is working and has saved prints more than once.
The 12V power supply is configured for a voltage of 14-15v, any one is suitable for LED strips with a current of 3-4A.
1PC202003030-300x227.jpg
Further, DC-DC is connected to the PSU to charge the lead battery in buffer mode (13.5V, 0.1C). If it is possible to assemble an overdischarge protection circuit, do it. If this is not possible, take a battery with a larger capacity (an old car is ideal). I sketched out a diagram of how everything should look like:
5ee9b2a86b56a141106080.png
If the router can be powered by 5v, power it from 5v, in no case should the HDD be hung on the 12-15v power line, only from stable 5v.
If you need to precisely determine the moment of battery discharge, then there is a simple circuit on an operational amplifier in comparator mode and matching the logic levels with a voltage divider. The output of the comparator to any digital input of the raspberry and a script that implements a safe shutdown of everything when the state of the GPIO input changes.

2
20strannik08, 2020-06-18
@20strannik08

Yes, it's simple. If you don't plan on keeping your raspberries fed all the time, then what's the point of having a spare feed? Isn't it easier to mount the flash drive in read-only mode. Transfer dynamic data to RAM, at worst implement data synchronization over the network, etc. etc.
On the other hand, I constantly poke and turn off the raspberry in an unsafe way, 50 times exactly, and all the data is intact, as is the system. I have pi4, raspbian buster, MicroCD Sandisk UHS1 10class 16gb. FS ext4 with journaling. MicroCD lives for the second year.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question