pimoroni / clean-shutdown

Python daemon to watch a GPIO pin and trigger a clean shutdown.
MIT License
126 stars 39 forks source link

Start up using pins ( from another pi) #18

Closed bortek closed 5 years ago

bortek commented 5 years ago

I understand that OnOffShim can be used to cut the power off but is there a way to start up pi using Pins and not a buttom? My intention is to use another pay to control "main" pi both cutting power and starting it up (cold reset).

Gadgetoid commented 5 years ago

There's no reason why this couldn't work- the + and - terminals for an external button on OnOff SHIM are merely the power button signal and Ground. Tie the - to Ground on your controlling Pi, and the + to a spare GPIO pin and pulling that pin LOW should have exactly the same result as a button press.

bortek commented 5 years ago

OK that sounds like it could work. Need to get the board and test it.

Do I need any resistors between spare GPIO and + or can I connect it directly ?

Gadgetoid commented 5 years ago

Looks like the power button + terminal is pulled up to the +5v pin so a 2k Ohm resistor between the + line and Ground (ergo a 2k resistor across the + and - terminals of the button) should be added to protect your Pi's GPIO pin. You could use 1.8k in a pinch.

I might have to grab an OnOff SHIM and test this, though!

bortek commented 5 years ago

Would be good if you could test and add some pics :)

Gadgetoid commented 5 years ago

I'm not having much luck getting it to work via the power button contacts- the latching switch used on the OnOff SHIM can be a little finickity. I suspect you'd need either a transistor or a relay, at which point the OnOff SHIM starts to become a little redundant.

For example the relays on Automation HAT are good for 2A so they could switch the power to another Pi directly and completely at will.

A Darlington Array should work, too.

My setup is frustratingly weird because my HDMI display keeps back-powering the Pi! grumble

bortek commented 5 years ago

Thanks for testing. Automation HAT would still be more expansive and bulky than OnOffShim and a transistor. I would love to lab with it but my local store is out of stock. Need to wait for some time before I can get it and will report the progress.

bortek commented 5 years ago

Is there any schematic available for this board ?

Gadgetoid commented 5 years ago

We don't publish them (because we need to spend the time cleaning them up) but here's a screengrab:

onoff-shim-schematic

bortek commented 5 years ago

Thanks for the screen shot. I received my shim yesterday and will be labbi g in weekend!

bortek commented 5 years ago

An update. All is good. :) I have managed to get it working with shim just as I wanted it to work.

I can turn on and off Pi2 using Pi1. Done by sending high or low signal from Pi1 to Shim using GPIO4 which turns on or off Pi2. I have cross connected GND between Pi1, Pi2 and shim. 5V is connected to Pi2. I never needed to use the buttons.

bortek commented 5 years ago

For the benefit to the community I am updating the docs and will soon make a PR. I made a drawing of OnOffShim Fritzing and will submit it the parts DB shortly.

Closing this Issue now.

bortek commented 5 years ago

Can @Gadgetoid or someone else take a look at this PR https://github.com/pimoroni/clean-shutdown/pull/20 ?

yuergen commented 3 years ago

I made a drawing of OnOffShim Fritzing and will submit it the parts DB shortly.

Do you have a link to the part? I cannot seem to find it. Thank you! :)