Dead man‘s switch for ReefPi

  • Thread starter Thread starter Sral
  • Start date Start date
  • Tagged users None

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
978
Location
Germany
What state or country do you live in
Other International
Rating - 0%
0   0   0
I‘ve been thinking of adding some kind of dead man‘s switch to my Setup.

My current idea goes along the lines of using a small reliable microcontroller, like an ATtiny85 or similar, that receives a ping from ReefPi every minute or so. If no signal is detected for e.g. 3-5 minutes, the power to the RaspberryPi is cut for a few seconds (I’m thinking a p-channel MOSFET in the +5V line).

What are your thoughts about this ?
Most importantly: What are your experiences with the reliability of ReefPi on Raspberry PIs ?

If reliability is good, the added complexity of such a setup might actually cause more problems than it solves, after all.
 
I have no experience with ReefPi or raspberryPi at all, however I spent several years doing embedded programming.
The concept you explain is known in the embedded world as a "watch dog timer" and is included in many microcontrollers (so you might not need another device).
I suggest you research whether raspberryPi have a watchdog timer and how to use it if they do.
 
Yup I say this feature in the raspberry Pi! But I didn't try it.
 
I‘ve been thinking of adding some kind of dead man‘s switch to my Setup.

My current idea goes along the lines of using a small reliable microcontroller, like an ATtiny85 or similar, that receives a ping from ReefPi every minute or so. If no signal is detected for e.g. 3-5 minutes, the power to the RaspberryPi is cut for a few seconds (I’m thinking a p-channel MOSFET in the +5V line).

What are your thoughts about this ?
Most importantly: What are your experiences with the reliability of ReefPi on Raspberry PIs ?

If reliability is good, the added complexity of such a setup might actually cause more problems than it solves, after all.


The RPi does have a watchdog, but it does depend on more functionality working.

I built a SMC on the Pico board.

https://github.com/blueacro/pcb-reefpi-pico/blob/master/reefpi_pico_v2.pdf See page 3 (power switch) and page 4 (SMC controller).

Firmware and command set for reset is here: https://github.com/blueacro/reefpi-firmware-pico-smc
 
The RPi does have a watchdog, but it does depend on more functionality working.

I built a SMC on the Pico board.

https://github.com/blueacro/pcb-reefpi-pico/blob/master/reefpi_pico_v2.pdf See page 3 (power switch) and page 4 (SMC controller).

Firmware and command set for reset is here: https://github.com/blueacro/reefpi-firmware-pico-smc
The I2C command is likely send by a service, right ?
I was thinking about whether a GPIO flank triggered by ReefPi itself might be better, since the second service doesn’t necessarily mean that ReefPi itself is running.

Thanks a lot for the link, I found that my LM2596 module also has an enable pin that I can use to cycle power to my Pi Zero. Thankfully I have 2 DC/DC converters, so I can run the watchdog chip from the second one.
 
The I2C command is likely send by a service, right ?
I was thinking about whether a GPIO flank triggered by ReefPi itself might be better, since the second service doesn’t necessarily mean that ReefPi itself is running.

Thanks a lot for the link, I found that my LM2596 module also has an enable pin that I can use to cycle power to my Pi Zero. Thankfully I have 2 DC/DC converters, so I can run the watchdog chip from the second one.

Using a GPIO is also ok, aka "must be toggled every N seconds". You could also slide the watchdog resets as a I2C sensor read action.

The most important part is the watchdog should only be reset if the control loop is totally functioning (no paniced go routines, no hung sensors, etc). Its tricky.
 
Using a GPIO is also ok, aka "must be toggled every N seconds". You could also slide the watchdog resets as a I2C sensor read action.

The most important part is the watchdog should only be reset if the control loop is totally functioning (no paniced go routines, no hung sensors, etc). Its tricky.
Good idea ! I could simply use the robo-tank pH driver and reset the timer every time I get an "r". That saves me a GPIO pin.

What exactly did you mean with the second paragraph ? Which "control loop" are you referring to ? I'm also not versed in what you mean with "paniced go routines" and "hung sensors" and why that would be important. Can you please elaborate a bit more on that ?
 
Which "control loop" are you referring to ?
They mean the main loop of the program - as opposed to an interrupt handler, timer handler, or a separate thread or anything like that because you want the watchdog to time out if the main loop hangs.

If you put the watchdog reset in a timer or interrupt handler the main loop can hang and the watchdog will keep resetting just fine because the timer or interrupt (or whatever) is a separate entity that is not hung.
 
@fishyjoes and @theatrus :
If I understand correctly this would need an understanding of how ReefPi handles its jobs.

Do you know if there is ReefPi functionality that is incompatible with this ? I‘m thinking whether for example timers are handled like this, vs running in the main ReefPi loop.
 
I‘ve been thinking of adding some kind of dead man‘s switch to my Setup.

My current idea goes along the lines of using a small reliable microcontroller, like an ATtiny85 or similar, that receives a ping from ReefPi every minute or so. If no signal is detected for e.g. 3-5 minutes, the power to the RaspberryPi is cut for a few seconds (I’m thinking a p-channel MOSFET in the +5V line).

What are your thoughts about this ?
Most importantly: What are your experiences with the reliability of ReefPi on Raspberry PIs ?

If reliability is good, the added complexity of such a setup might actually cause more problems than it solves, after all.
My reef-pi has been running two years without crashing once. I virtually never reboot it.
A hardware watchdog is something I thought about, but I considered it a solution looking for a problem in my case.
 
My reef-pi has been running two years without crashing once. I virtually never reboot it.
A hardware watchdog is something I thought about, but I considered it a solution looking for a problem in my case.
Great to hear ! What version and features are you using ?
 
Great to hear ! What version and features are you using ?
  • running 5.0, on Raspberry Pi 3 Model B Rev 1.2
pi@fluval-evo135:~ $ uptime
20:45:17 up 137 days, 34 min, 1 user, load average: 1.04, 0.75, 0.68

Using Temp sensors, and controlling power outlets for auto feeding, etc
 
I‘ve been thinking of adding some kind of dead man‘s switch to my Setup.

My current idea goes along the lines of using a small reliable microcontroller, like an ATtiny85 or similar, that receives a ping from ReefPi every minute or so. If no signal is detected for e.g. 3-5 minutes, the power to the RaspberryPi is cut for a few seconds (I’m thinking a p-channel MOSFET in the +5V line).

What are your thoughts about this ?
Most importantly: What are your experiences with the reliability of ReefPi on Raspberry PIs ?

If reliability is good, the added complexity of such a setup might actually cause more problems than it solves, after all.
raspberry pi can use the hardware watchdog thats available on the board and exposed via systemd, i think. you have to do some investigation.
 

IF YOU HAD TO TAKE A REEFING EXAM, WOULD YOU PASS?

  • Yes!

    Votes: 32 45.7%
  • Not yet, but I have one that I want to buy in mind!

    Votes: 9 12.9%
  • No.

    Votes: 26 37.1%
  • Other (please explain).

    Votes: 3 4.3%
Back
Top