HyFy
Posts: 63
Joined: Fri Aug 14, 2015 10:36 am

Can I switch one Pi off/on with another?

Thu Jul 12, 2018 8:03 pm

Hi,
I can hear the purists cringing already...
I have an "array of Pis" that sense various temperatures and RH and Pressure etc. They feed by MQQT to a central PiB3 which is a processor and server to provide me with all of this data in graph and CSV form even if I am elsewhere in the world. Amongst other things I can change the heating (by commercial means) to suit but I am also, like most of us, interested in the academic achievement.
But I regularly have a problem with the PiB3 in that it "locks up"/"freezes"/call it what you will after a month or so of running and I can get no reaction out of it except by interrupting the supply and then reconnecting it. I told you I could hear the purists cringing!! But what else can you do? The green light is burning permanently bright and nothing you do will alter things especially away from physical contact with it. After all if there was a "mains" cut from a storm, it would be the same thing. The reason for it freezing/locking could be the subject of another thread!! I suspect a memory issue. I do keep a regular image of the Pi.
Okay - having justified (at least to myself) that I need to switch the supply "off" and "on" again, how can I go about this? I came up with the idea to use another Pi suitably connected and on the internet. Perhaps I can use its 5v0 supply directly to supply the Pi3B and by rebooting the "supply Pi" it would interrupt the PiB3's supply long enough to re-start it. This idea relies on two Pis running continuously and one having enough eumph so that the supply to the Pi3B would not over exert the "supply Pi".
But what about using a form of relay? I've read "Z80Refugee"'s tome (yes - I can remember the Z80) and checked out the Pimoroni's " Automation pHat. That would do my job and a dozen more. It has NO and NC contacts and as I need to run in the NC state that would be fine but it just seems over the top in hardware.
Does anyone have simpler suggestions...
I fully accept that other issues could arise in the system to cause it to collapse like a pack of cards but the last time I went away it went down two days into a 5 week trip and nothing I could do to it would get it restarted as it was simply"offline". Frustrating? You bet...

Your thoughts?

hippy
Posts: 5935
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Can I switch one Pi off/on with another?

Thu Jul 12, 2018 8:55 pm

Just pulling the RUN pin low will reset / reboot a Pi which can easily be done from another Pi using just a wire from one of its GPIO pins.

It's not recommended but likely no worse than pulling the power if that's the alternative and it avoids having to actually disconnect the power, saves on mechanical wear and tear.

HyFy
Posts: 63
Joined: Fri Aug 14, 2015 10:36 am

Re: Can I switch one Pi off/on with another?

Thu Jul 12, 2018 10:11 pm

I've not tried the RUN pin but the PiB3 has the program that shuts it down by shorting BCMs 39 and 40 running from Boot and once it freezes shorting those two pins has no effect whatsoever. In fact nothing has any effect!!

Next time it freezes I will give the RUN pin a try - thanks. But that could be in a month's time...!!

Thanks

HyFy

User avatar
Burngate
Posts: 6002
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Can I switch one Pi off/on with another?

Fri Jul 13, 2018 9:40 am

Maybe an over-the-top suggestion ... a Pi zero beside the 3B, on the same power supply (so the grounds are the same) and on the same network, with a GPIO connected to the 3B's RUN, and running a short script that queries the 3B. If it doesn't get a reply it briefly pulls its GPIO low ...

Is it a 3B or 3B+?
Just be aware that, on the 3B+, the other pin on the 2-pin header is no longer GND - why they changed it I don't know!

User avatar
RaTTuS
Posts: 10456
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Can I switch one Pi off/on with another?

Fri Jul 13, 2018 10:12 am

use a watchdog on that RPi so it resets itself
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

HyFy
Posts: 63
Joined: Fri Aug 14, 2015 10:36 am

Re: Can I switch one Pi off/on with another?

Fri Jul 13, 2018 1:48 pm

Thanks Burngate
Maybe an over-the-top suggestion ... a Pi zero beside the 3B, on the same power supply (so the grounds are the same) and on the same network, with a GPIO connected to the 3B's RUN, and running a short script that queries the 3B. If it doesn't get a reply it briefly pulls its GPIO low ...
Nice neat Idea.
Is it a 3B or 3B+?
a 3B - so less of an issue. What is the other pin on the 3B+?

HyFy

HyFy
Posts: 63
Joined: Fri Aug 14, 2015 10:36 am

Re: Can I switch one Pi off/on with another?

Fri Jul 13, 2018 1:52 pm

Thanks RattuS
use a watchdog on that RPi so it resets itself
But...

...wassa "watchdog" and how would it work?

HyFy

HyFy
Posts: 63
Joined: Fri Aug 14, 2015 10:36 am

Re: Can I switch one Pi off/on with another?

Fri Jul 13, 2018 3:58 pm

Thanks again RaTTuS

I've now researched COP Timers. I have a reservation which will only be cleared once I can get the Pi to "freeze up" again and then see if it is still capable of operating it's own timer etc and resetting itself. Nothing on the GIU changes nor mouse nor keyboard nor shorting 39 and 40 to shutdown, etc etc.
If it isn't as I suspect then maybe Burngate's idea may work as the frozen PiB3 only needs to react to the reset command via the RUN "pin".

I guess that I may have to look at the program that is running to see if I can make it halt sooner rather than later.

Thanks again.

HyFy

User avatar
Burngate
Posts: 6002
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Can I switch one Pi off/on with another?

Fri Jul 13, 2018 5:25 pm

Actually, my idea was over the top - and not only that, but my hippocampus couldn't find the word "watchdog" - thanks, RaTTus

Still, because the Pi isn't responding to anything, it may not be able to reset itself.
So wire a 555 timer in resetable one-shot mode, and just keep resetting it. Once it's timed out it resets the Pi by pulling RUN low.

HyFy
Posts: 63
Joined: Fri Aug 14, 2015 10:36 am

Re: Can I switch one Pi off/on with another?

Fri Jul 13, 2018 6:17 pm

Thanks Burngate

But for the cost of a 555 (and etc.) I could buy a Zero W and use that to reset the Pi3B according to your original idea. MQTT is already in use so I can employ that to communicate. I'm more clued re that set up than re-learning about "555"'s (and etc.)!!!

I think that I am going to try to set that one up and then amend the program which is running so that it doesn't close all of the redundant graphics. It should freeze within a day or so and then I can see if it can be reset either manually or with the Pi Zero.

When I have something to report I will get back and raise a new thread.

Thanks

HyFy

User avatar
RaTTuS
Posts: 10456
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Can I switch one Pi off/on with another?

Mon Jul 16, 2018 7:00 am

The Watchdog should work fine as it's hardware inside the SOC
so it's always going to reset unless it is told not to - and the ARM is the thing that does the telling - I cannot find a good post to show how it's done ATM,
I'll see if I can fin one and get it working on my Pi3 b+ if I get time
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

HyFy
Posts: 63
Joined: Fri Aug 14, 2015 10:36 am

Re: Can I switch one Pi off/on with another?

Mon Jul 16, 2018 8:40 am

Thanks for that.

I tried to find some help but what there was was so old...

In the meantime by "hashing out" some of the coding, I can get the Pi3B to lock up in 48 hours. I can now say that whilst nothing else works the RUN pin does, i.e. it resets. While I look into the watchdog and await your kind offer I will use a Zero W to do the reset and then get it to ping the 3B to do it automatically.

Thanks again,

HyFy

mosespi
Posts: 508
Joined: Mon May 12, 2014 3:35 pm
Location: 34,-118
Contact: Website

Re: Can I switch one Pi off/on with another?

Wed Jul 18, 2018 7:18 pm

Here is the watchdog feature on a UPS of my design.

http://www.allspectrum.com/mopower-hw2/#WATCHDOG

It will automatically cut and reapply 5v power to the Pi if the watchdog timer expires. It's a full blown UPS, so you have that too if power fails.

Regards,
-Moses
Power problems? MoPower UPS for the Pi
http://www.allspectrum.com/mopower/

HyFy
Posts: 63
Joined: Fri Aug 14, 2015 10:36 am

Re: Can I switch one Pi off/on with another?

Wed Jul 18, 2018 7:34 pm

Wow thanks for that... I'll get to it and give it a try.
In the meantime I've been beavering away. I have semi-automatic system running as we speak but it somehow lost two days of records!!!
I'll let you know how I get on. I'm getting some grief about the time spent so it may be a day or two!!!
Thanks
HyFy

Return to “HATs and other add-ons”