Advanced On/Off Cir...
 
Notifications
Clear all

Advanced On/Off Circuit Question


GeorgeIoak
(@georgeioak)
New Member
Joined: 4 years ago
Posts: 3
Topic starter  

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?


Quote
othermod
(@othermod)
Reputable Member Admin
Joined: 6 years ago
Posts: 350
 

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: 4 years ago
Posts: 3
Topic starter  

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.


ReplyQuote
othermod
(@othermod)
Reputable Member Admin
Joined: 6 years ago
Posts: 350
 

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.


ReplyQuote
GeorgeIoak
(@georgeioak)
New Member
Joined: 4 years ago
Posts: 3
Topic starter  

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