buzzard
Posts: 2
Joined: Mon Sep 14, 2020 12:36 pm

Turn off cyclically for one minute without damaging the data in the SD

Sun May 02, 2021 4:01 pm

I need to turn off the Raspberry 3 every day at midnight for one minute, this operation I do with the use of an external timer. How can I proceed to avoid damaging the data in the SD card?

MiscBits
Posts: 249
Joined: Wed Jan 27, 2021 12:48 pm

Re: Turn off cyclically for one minute without damaging the data in the SD

Mon May 03, 2021 4:01 am

Deleted - see post below.

I am intrigued as to why you need to turn off each day? This is not a Windows machine :-)
Last edited by MiscBits on Sun May 09, 2021 4:06 pm, edited 1 time in total.
Is a computer language with goto's totally Wirth-less?

ghp
Posts: 1976
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Turn off cyclically for one minute without damaging the data in the SD

Mon May 03, 2021 4:59 am

One option is to make the file system read only. https://hallard.me/raspberry-pi-read-only/

Or provide a UPS which keeps the raspberry running while power off. Small UPS are available for 25W, keeping systems up an hour or more.

Or provide a small UPS which allows the pi to gracefully shut down. Something like https://sixfab.com/power/

Or as MiscBits proposed shut down some time before the external switch takes action. Add a few minutes for extra time needed when services run up to their timeout value. You should think about time sync between internal time and external timer, also the summer/winter time changes twice a year.

Or deposit some ready to be used sd cards close to the pi and in case of breakdown swap sd.

buzzard
Posts: 2
Joined: Mon Sep 14, 2020 12:36 pm

Re: Turn off cyclically for one minute without damaging the data in the SD

Sun May 09, 2021 6:25 am

MiscBits wrote:
Mon May 03, 2021 4:01 am
Make sure the Pi is turned off in software first.

You could set a simple cron job to run a few minutes before the timer kicks in that executes the shutdown command.

Any programs running will need to exit cleanly and leave their database / files in a clean state (all commits done / files closed etc) and temporary files tidied up. This area is too big to give general advice as you could be running anything.

I am intrigued as to why you need to turn off each day? This is not a Windows machine :-)
I will have to install the RPI on the top of a mountain where to reach it I will have to climb for at least a couple of hours. The RPI will need to receive the glider's FLARM signals to share the received data. I fear that due to frequent thunderstorms, electrostatic shocks may be triggered that could alter the settings of both the WiFi (equipped with a parabolic antenna in order to ensure the flow at 4km with the advantage of seeing it as a local network) and the RPI although the system is protected, powered by a photovoltaic panel and a small wind generator that will keep an accumulator plugged in, nevertheless it may no longer respond to commands. I see no other solution than to turn off the station for a few seconds, I thought about 00:00 every night via an external timer. When I turn it back on I would be sure that everything will start with the default data, other ideas?

epoch1970
Posts: 6520
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Turn off cyclically for one minute without damaging the data in the SD

Sun May 09, 2021 8:00 am

Perhaps use a hardware watchdog instead of a fixed daily reset. There is one in the Pi, an external one may be slightly more effective, on condition that device is perfectly reliable itself.
Read only root filesystem definitely recommended.
Perhaps 2 independent systems working in parallel?
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

MiscBits
Posts: 249
Joined: Wed Jan 27, 2021 12:48 pm

Re: Turn off cyclically for one minute without damaging the data in the SD

Sun May 09, 2021 4:05 pm

Eeek - a quick Google shows:
FLARM is the traffic awareness and collision avoidance technology for General Aviation, light aircraft, and UAVs. With FLARM installed, you are alerted of both traffic and imminent collisions with other aircraft, so you can take action before it is too late.
I would be concerned that the Pi may not be reliable enough for this / the OS good enough and your skills capable for this (as the reboot is a real brute force solution) - sorry to be blunt but folks lives can be at stake here.

Not a subject I want to get involved with.
Is a computer language with goto's totally Wirth-less?

User avatar
bensimmo
Posts: 5334
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Turn off cyclically for one minute without damaging the data in the SD

Sun May 09, 2021 4:54 pm

Use and ESP32 or similar, have it rigger the Pi's shut down sequence and then go in to deep sleep and wake up when needed.
If you're using 'Timer' already, what are you using, if something like a SmartPlug then you can have that trigger the shutdown, look for ESP8266 based ones and use Tasmotta or similar and see how to use the extra GPIO on it.

drtechno
Posts: 246
Joined: Fri Apr 09, 2021 6:33 pm

Re: Turn off cyclically for one minute without damaging the data in the SD

Sun May 09, 2021 4:58 pm

MiscBits wrote:
Sun May 09, 2021 4:05 pm
Eeek - a quick Google shows:
FLARM is the traffic awareness and collision avoidance technology for General Aviation, light aircraft, and UAVs. With FLARM installed, you are alerted of both traffic and imminent collisions with other aircraft, so you can take action before it is too late.
I would be concerned that the Pi may not be reliable enough for this / the OS good enough and your skills capable for this (as the reboot is a real brute force solution) - sorry to be blunt but folks lives can be at stake here.

Not a subject I want to get involved with.
In a system like that, it would have to be designed so it has total system redundancy per DOT standards. Besides other little hurdles it would have to pass (like lightening strike recovery test). Is it possible? maybe but there would be a lot of tests included in the R&D stage. It would be possible to user two raspberry pi 4b as the main, then a pi zero for a redundant controller. Trick would be is to make it pass the standards it would need to conform to. I would also build a cdrom image instead of relying on the sd card. But even then all would have to pass lightening, emi, and temperature extreme tests to meet the equipment standards.

Return to “Other projects”