[Guide] Graceful shutdown switch without Pololu [RETIRED]
- johnny-bert
- Posts: 27
- Joined: Tue Aug 02, 2016 3:36 pm
- Location: Lower Franconia
- Has thanked: 26 times
- Been thanked: 5 times
Re: [Guide] Graceful shutdown switch without Pololu
@Camble:
Hi,
My wiring will not feature a powerboost, because I will use 4 NiMH batteries (14500 aka AA) with a Step-Up/Down Voltage Regulator (https://www.pololu.com/product/2123).
Is it possible to use your graceful shutdown for this make, too?
Hi,
My wiring will not feature a powerboost, because I will use 4 NiMH batteries (14500 aka AA) with a Step-Up/Down Voltage Regulator (https://www.pololu.com/product/2123).
Is it possible to use your graceful shutdown for this make, too?
- 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
@johnny-bert The BangGood version of my shutdown board will work with any supply which doesn't have an ENable pin.
Thread for info.
Thread for info.
- KrxXxiT
- Posts: 25
- Joined: Sat Jun 18, 2016 3:13 am
- Location: Croatia
- Has thanked: 27 times
- Been thanked: 6 times
Re: [Guide] Graceful shutdown switch without Pololu
Hey I have an Issue:
I've copied this layout (image below) for the circuit and it just shuts down immediately when I flip the power off switch to what should be on. When the DMG switch is in the normal off state (able to remove the cartridge) the pi turns on as soon as I plug in the micro usb (I am plugging into the micro usb female port that is extended off the powerboost from pins USB and GND), and when I flip the switch to what should be the "on" state, it cuts the power instantly.
I've added this to the config.txt file as specified:
I am using an original Game Boy DMG switch, I've wired the gate to GPIO 22 and changed line 25 in popcorn's code:
to
I even changed line 14:
to
When I launch:
to test it manually it tells me there is some sort of error on line 100 and line 93
I also tried moving the 100K resistor across gate and source, as I had it set up over gate and drain.
What am I doing wrong?
Should I ditch popcorns script and just set GPIO.PUD_DOWN in the cmdline.txt file? and if so, how to do that?

I've copied this layout (image below) for the circuit and it just shuts down immediately when I flip the power off switch to what should be on. When the DMG switch is in the normal off state (able to remove the cartridge) the pi turns on as soon as I plug in the micro usb (I am plugging into the micro usb female port that is extended off the powerboost from pins USB and GND), and when I flip the switch to what should be the "on" state, it cuts the power instantly.
I've added this to the config.txt file as specified:
Code: Select all
dtoverlay=gpio-poweroff,gpiopin=22,active_low="y"
Code: Select all
GPIO.setup(powerGPIO, GPIO.IN, pull_up_down=GPIO.PUD_UP)
Code: Select all
GPIO.setup(powerGPIO, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
Code: Select all
batteryGPIO = 17 # GPIO 17/pin 0
Code: Select all
batteryGPIO = 22 # GPIO 22/pin 0
Code: Select all
python ~/GBZ-Power-Monitor/gbz_power_monitor.py
I also tried moving the 100K resistor across gate and source, as I had it set up over gate and drain.
What am I doing wrong?
Should I ditch popcorns script and just set GPIO.PUD_DOWN in the cmdline.txt file? and if so, how to do that?

- 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
@KrxXxiT
If you're using the Vishay Siliconix brand FET specified in the first post, note that the pinout is different than the one in my drawing you referenced. You'd need to reestablish the copper strip where it was cut on the top row, and remove the jumper wire from the top two rows.
Also, I may be wrong, but I don't think you'd need to modify Line 14 of Popcorn's script.
If you're using the Vishay Siliconix brand FET specified in the first post, note that the pinout is different than the one in my drawing you referenced. You'd need to reestablish the copper strip where it was cut on the top row, and remove the jumper wire from the top two rows.
Also, I may be wrong, but I don't think you'd need to modify Line 14 of Popcorn's script.
Re: [Guide] Graceful shutdown switch without Pololu
batteryGPIO In popcorns script is for monitoring low battery. You should not change the variable to 22 as you have set that to go high on pi boot. That's why your getting the error in the script. Also you cannot set GPIO.PUD_DOWN in the cmdline.txt file.KrxXxiT wrote:Hey I have an Issue:
I've copied this layout (image below) for the circuit and it just shuts down immediately when I flip the power off switch to what should be on. When the DMG switch is in the normal off state (able to remove the cartridge) the pi turns on as soon as I plug in the micro usb (I am plugging into the micro usb female port that is extended off the powerboost from pins USB and GND), and when I flip the switch to what should be the "on" state, it cuts the power instantly.
I've added this to the config.txt file as specified:I am using an original Game Boy DMG switch, I've wired the gate to GPIO 22 and changed line 25 in popcorn's code:Code: Select all
dtoverlay=gpio-poweroff,gpiopin=22,active_low="y"
toCode: Select all
GPIO.setup(powerGPIO, GPIO.IN, pull_up_down=GPIO.PUD_UP)
I even changed line 14:Code: Select all
GPIO.setup(powerGPIO, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
toCode: Select all
batteryGPIO = 17 # GPIO 17/pin 0
When I launch:Code: Select all
batteryGPIO = 22 # GPIO 22/pin 0
to test it manually it tells me there is some sort of error on line 100 and line 93Code: Select all
python ~/GBZ-Power-Monitor/gbz_power_monitor.py
I also tried moving the 100K resistor across gate and source, as I had it set up over gate and drain.
What am I doing wrong?
Should I ditch popcorns script and just set GPIO.PUD_DOWN in the cmdline.txt file? and if so, how to do that?
- 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
You can use whatever pins you like, but by default:
17 is the low battery signal GPIO (input)
27 is the shutdown signal GPIO (input)
22 is the keep alive GPIO (output)
Use Popcorn's power monitor to watch for low battery and shutdown signal, but also add this to /boot/config.txt to keep the JFET gate high.
I've added a methodical approach to wiring up this circuit to the guide.
17 is the low battery signal GPIO (input)
27 is the shutdown signal GPIO (input)
22 is the keep alive GPIO (output)
Use Popcorn's power monitor to watch for low battery and shutdown signal, but also add this to /boot/config.txt to keep the JFET gate high.
Code: Select all
dtoverlay=gpio-poweroff,gpiopin=22,active_low="y"
- 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
I've been speaking with @myPiZero and he was able to get a J175 to work in his circuit. So I've went back to the drawing board with some Fairchild JFETs I was mistakenly sent this week.
When I was first working on this and finally got a working circuit, I'd tried everything I could think of. The result of this was a P-Channel JFET with the Source wired to ground. While a JFET should work with the Drain and Source reversed, it seems they are more finicky than that. It seems that Vishay JFETs are actually the special snowflake here.
When I first posted the guide, I went through troubleshooting of this circuit with several people who were using various different JFETs. Motorola, Fairchild, 2N5460, J175... We tried everything we could think of. Nothing worked.
Five minutes of playing around on the breadboard tonight with Fairchild JFETs, and I have a working circuit.
There's not much point in uploading an alternative schematic, as it's practically the same. I've added a troubleshooting section to the guide instead. Hopefully this will help alleviate some more of the problems people may have.
When I was first working on this and finally got a working circuit, I'd tried everything I could think of. The result of this was a P-Channel JFET with the Source wired to ground. While a JFET should work with the Drain and Source reversed, it seems they are more finicky than that. It seems that Vishay JFETs are actually the special snowflake here.
When I first posted the guide, I went through troubleshooting of this circuit with several people who were using various different JFETs. Motorola, Fairchild, 2N5460, J175... We tried everything we could think of. Nothing worked.
Five minutes of playing around on the breadboard tonight with Fairchild JFETs, and I have a working circuit.
There's not much point in uploading an alternative schematic, as it's practically the same. I've added a troubleshooting section to the guide instead. Hopefully this will help alleviate some more of the problems people may have.
- 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
Well, then...
My Vishay (I hope) FET is taking its sweet time getting here from China. Maybe I'll play around with the breadboard and see if I can get any of this stash of Fairchild FETs to do actually something... I'm guessing that moving the resistor is the key to this problem, because that's the only thing you list that I hadn't already tried...
My Vishay (I hope) FET is taking its sweet time getting here from China. Maybe I'll play around with the breadboard and see if I can get any of this stash of Fairchild FETs to do actually something... I'm guessing that moving the resistor is the key to this problem, because that's the only thing you list that I hadn't already tried...
- KrxXxiT
- Posts: 25
- Joined: Sat Jun 18, 2016 3:13 am
- Location: Croatia
- Has thanked: 27 times
- Been thanked: 6 times
Re: [Guide] Graceful shutdown switch without Pololu
I got fed up with screwing around trying to get this to work. I tried everything in the guide and nearly broke my screen, I soldered too much and the stuff nearly shorted out something on the other circuit board.
Anyways decided to just order one off you @Camble
Anyways decided to just order one off you @Camble
- 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
I think I may have spent $30 on various online orders of parts trying to get this switch alone to work. At this point I feel obligated to get it working.
Who has gotten it working besides Camble?
(If you could post a working Fairchild FET diagram, @Camble, I think a lot of us in the States would appreciate it. That seems to be all we have available this side of the pond.)
Who has gotten it working besides Camble?

(If you could post a working Fairchild FET diagram, @Camble, I think a lot of us in the States would appreciate it. That seems to be all we have available this side of the pond.)
Who is online
Users browsing this forum: No registered users and 1 guest