Forum

Advanced On/Off Circuit Question  

  RSS

GeorgeIoak
(@georgeioak)
New Member
Joined:2 weeks  ago
Posts: 3
December 27, 2017 7:29 pm  

I'm trying to understand the circuit used and have a question on the power off function when GP2 goes low. What is the sequence that happens which causes the power to be cutoff after the shurdown command is issued when GP1 goes low?


ReplyQuote
othermod
(@othermod)
Reputable Member Admin
Joined:1 year  ago
Posts: 273
January 8, 2018 4:17 pm  

The OS is watching the pin attached to GP1, so pressing the button issues the shutdown command. After shutdown completes, GP2 is pulled low by the OS. It's attached to a p-mosfet because the pin is only weakly pulled low. This causes the 10uf capacitor to charge, pulling the gate n-mosfet part of the dual mosfet low. This causes everything to shut off once the gate pin pulls low enough.


ReplyQuote
GeorgeIoak
(@georgeioak)
New Member
Joined:2 weeks  ago
Posts: 3
January 8, 2018 6:34 pm  

So the 300k pull down on the gate of the GP2 P-FET isn't enough to turn that FET ON and only when the system takes GP2 low it's enough to turn that P-FET on?

As a side note, I've been experimenting with overlays and it seems you can control this circuit without needing a python program. Adding

dtoverlay=gpio-poweroff,gpiopin=21,active_low="y"
dtoverlay=gpio-shutdown,gpio_pin=20

to /boot/config.txt seems to be working. Adjusting the value of the 10uF cap was needed in my case because the power off pin was taking a little long to go low after the halt was issued.

Edited: 4 days  ago

ReplyQuote
othermod
(@othermod)
Reputable Member Admin
Joined:1 year  ago
Posts: 273
January 8, 2018 7:30 pm  

Correct. The 300k pulldown can't overcome the 40k pullup from the GPIO pin. As soon as the GPIO switches to pulldown or nopull, the 300k pulls the gate low and causes the poweroff.

Yes the new shutdown overlay works, but it's not functional (at least not without changing a bunch of things) in the newest version of Raspbian RetroPie. Most people use RetroPie, and it's still on Jesse. As soon as RetroPie Stretch gets released I'll be updating the guide.

Edited: 2 days  ago

ReplyQuote
GeorgeIoak
(@georgeioak)
New Member
Joined:2 weeks  ago
Posts: 3
January 8, 2018 7:57 pm  

I'm running the latest Stretch and updated firmware and it is working for me by just adding the 2 overlays.

I could greatly reduce the time to pull up the pins using a dts-blob but when I did that the power down circuit failed. You can find my discussion on the Raspberry Pi forum


ReplyQuote
  
Working

Please Login or Register