I solved it with hardware watchdog.
My problem was that the Raspberry Pi would shut down and not turn back on. At first I used the built-in Watchdog in the Raspberry Pi 5 because I thought I could solve it in software, but while this solved a software problem such as the system not responding, it had no effect in case of sudden shutdown (short circuit, etc.). Therefore, I had to go for a hardware solution.
The product I used is Waveshare RTC Watchdog HAT B but there are many different watchdog hardware available. It simply cuts the power when it does not receive a signal from a specified pin (set as D4 but can be changed.) and re-energizes. You can also use it as an external RTC using the CR1220 battery. Since the Raspberry Pi already has an RTC, the external RTC will appear as
/dev/rtc1
You can find more information with
hwclock --help
Note that you need to use
sudo
for different settings.
reboot
command, the Raspberry Pi 5 is down with a red light on the button. I must press the button to boot the machine. Did you found any workaround?