[Guide] Graceful shutdown switch without Pololu [RETIRED]

Various user-contributed guides for hardware-related things
User avatar
HoolyHoo
Posts: 766
Joined: Sat Jul 09, 2016 9:34 pm
Has thanked: 206 times
Been thanked: 741 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by HoolyHoo » Mon Sep 19, 2016 7:44 am

@RxBrad if your still in the testing mood, try leaving popcorns script as is meaning don't change anything. Then on your power switch instead of wiring the 3.3v from switch to pi, try wiring that switch leg to ground. Use layout #2.

User avatar
Camble
Posts: 885
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 488 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by Camble » Mon Sep 19, 2016 7:48 am

@HoolyHoo That would work, except GPIO27 will be grounded when the switch is in the on position. You can use the other side of the DPDT switch, but 3.3v was used to make the circuit compatible with the DMG-01 switch.

User avatar
HoolyHoo
Posts: 766
Joined: Sat Jul 09, 2016 9:34 pm
Has thanked: 206 times
Been thanked: 741 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by HoolyHoo » Mon Sep 19, 2016 7:52 am

Camble wrote:@HoolyHoo That would work, except GPIO27 will be grounded when the switch is in the on position. You can use the other side of the DPDT switch, but 3.3v was used to make the circuit compatible with the DMG-01 switch.
Yes but script calls for it to be pulled high until the circuit is open which is what we want, isn't it?

User avatar
Camble
Posts: 885
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 488 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by Camble » Mon Sep 19, 2016 7:56 am

@HoolyHoo The switch will pull it to ground and override the internal pull-up. The Pi will think you want to shut down.

myPiZero
Posts: 30
Joined: Mon Aug 15, 2016 11:34 pm
Been thanked: 5 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by myPiZero » Mon Sep 19, 2016 8:11 am

I finished my build without this feature eventually. It worked great, but after 4 turn offs something failed. Don't know what.
I think that a much easier solution is to use a tiny normally closed relay. With no voltage applied the relay will shorten the enable to ground. On power on the switch will disconnect the enable from ground and the pi will signal the relay to open. Now even if the switch will return to off position the enable pin is floating and the pi can control the relay.

User avatar
HoolyHoo
Posts: 766
Joined: Sat Jul 09, 2016 9:34 pm
Has thanked: 206 times
Been thanked: 741 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by HoolyHoo » Mon Sep 19, 2016 8:13 am

@Camble so then changing line 64 to 0 and line 87 to 1 should do it.

User avatar
Camble
Posts: 885
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 488 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by Camble » Mon Sep 19, 2016 8:23 am

@RxBrad A JFET is a "tiny normally-closed relay".

@HoolyHoo Correct, but that's not leaving Popcorn's script as is. ;)

User avatar
HoolyHoo
Posts: 766
Joined: Sat Jul 09, 2016 9:34 pm
Has thanked: 206 times
Been thanked: 741 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by HoolyHoo » Mon Sep 19, 2016 8:29 am

Ok so may be @RxBrad can try it with those changes. My thinking is with your current circuit perhaps sending voltage to the gpio before it has been initialized in script is causing erratic behavior.

User avatar
RxBrad
Posts: 278
Joined: Fri Jul 22, 2016 9:10 am
Has thanked: 125 times
Been thanked: 160 times
Contact:

Re: [Guide] Graceful shutdown switch without Pololu

Post by RxBrad » Mon Sep 19, 2016 8:41 am

I can try later today when I'm back home.

Is there maybe an issue because I'm using a DPDT switch to test (the same one Camble recommends near the beginning of this thread)? I assume the pins are laid out similarly to the DMG.

On the top row, for the OFF position, I have EN and the FET attached to the 2 leftmost pins. (Does the order matter here?)

On the bottom row for the ON position, GPIO 27 and 3.3 volt are attached to the two rightmost pins. (Again, does the order matter?)
Last edited by RxBrad on Mon Sep 19, 2016 8:59 am, edited 2 times in total.
Image
Image Image

User avatar
Camble
Posts: 885
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 488 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by Camble » Mon Sep 19, 2016 8:44 am

HoolyHoo wrote:Ok so may be @RxBrad can try it with those changes. My thinking is with your current circuit perhaps sending voltage to the gpio before it has been initialized in script is causing erratic behavior.
Unlikely. The script is what monitors the GPIO pin, so the voltage on the pin before the script runs is irrelevant.

@RxBrad The DPDT switch is fine and so is your pin layout. You're at the point now where something really really silly is preventing this from working. As I've said, you'd be better to jump on Discord (link in my signature) and send me a PM instead of this back and forth on the forum.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest