Momentary On/Off Switch with soft shutdown

Raspberry Pi related support

Re: Momentary On/Off Switch with soft shutdown

Postby PeteB » 21 Apr 2016, 04:47

Probably, with one small change. The mosfet latching circuit is connected to one of the GPIO pins on the Pi through a resistor to 5V. This forms what is basically a voltage divider with the internal pullup so as not to be too incompatible with 3.3V logic. To work with a user selectable voltage, I think the resistor would have to be replaced with something else. 12V is too far from 3.3V to be safe for the Pi. (Simon may have a better answer)

A latching relay would work either way, b/c the contact is isolated from the control voltage.

I assume your DAC has a 12 V supply, but feeds the Pi a regulated +5?
PeteB
 
Posts: 421
Joined: 06 Feb 2016, 05:07

Re: Momentary On/Off Switch with soft shutdown

Postby Dohmar » 21 Apr 2016, 06:29

Yeah spot on. It has an input that provides 5v/3amp to the Pi, and uses (x) amount to feed the onboard mosfet (I dont know how much).
The dac has a 2.54pitch header that puts out 5v, though I dont know if it has its own converter or if its drawn from the 5v rail that feeds the pi and the amplifier). It also puts out whatever it is being fed - in my case I'm feeding it 12v/5amp, total of 60 watts. I'm guessing that if the amplifier is 2x 20 watts (40 watts/5v = 8amp+the 3amp the pi is fed for 11amp @ 5v = 44 watts, which if we assumed 48 watts, that'd leave 12 watts/12v@1amp leftover for me to tap with the 12v to 5v converter) to power the hdd, optical drive, touchscreen, dab tuner and usb ADC.

The circuit you've designed could still tap 3.3v/5v via the duplicated GPIO's on the HAT. Effectively I'd just want a single button which;
a) when pressed while pi is on, executes the halt script and then cuts the 12v feed to the HAT.
b) when pressed while pi is off, simply provides the 12v to the hat until pressed again.

B) is simple enough, and I've read this forum but confess I haven't followed it all - under condition a) how would the button/circuit know when to turn off - would the pi indicate when the system is ready for physical power out, or would you just add a timer that would give it 5-10 seconds to shutdown and then cut the power?

Sorry but EE is really not my strong part

-D
Dohmar
 
Posts: 79
Joined: 14 Mar 2016, 12:27

Re: Momentary On/Off Switch with soft shutdown

Postby ingohz » 21 Apr 2016, 07:36

ingohz
 
Posts: 45
Joined: 22 Feb 2016, 12:11

Re: Momentary On/Off Switch with soft shutdown

Postby PeteB » 21 Apr 2016, 15:07

Just to be clear, I did NOT design that circuit, it is published on the website that Simon has linked above, I would just add it to what I was planning already, and replace the relay, or make the relay an option for the sake of isolation.

a) Power On->Orderly Shutdown->Power Off, we already have this part. I cut and pasted other scripts, and tested it with the button you see hanging in the air in my pics. The button I was going to mount on the PCB turned out to be crap, so I have ordered the smallest Alps switch I could find, from Mouser (still only about $1).

b) is what the circuit Simon posted is really for. The latching is done by the pair of complementary mosfets, instead of the relay.

The challenge is not the engineering so much as coming up with something that is actually useful, and does not end up costing more than a Pi (!).
PeteB
 
Posts: 421
Joined: 06 Feb 2016, 05:07

Re: Momentary On/Off Switch with soft shutdown

Postby Wizzer » 23 Sep 2016, 15:32

It's been a while since anyone last posted about the shutdown circuit. Has this progressed any further? I need to do the exact same thing and I'm hoping someone has designed it already.

Wizzer
Wizzer
 
Posts: 1
Joined: 23 Sep 2016, 15:24

Re: Momentary On/Off Switch with soft shutdown

Postby moocowe » 25 Sep 2016, 15:13

moocowe
 
Posts: 2
Joined: 25 Sep 2016, 14:13

Re: Momentary On/Off Switch with soft shutdown

Postby hondagx35 » 25 Sep 2016, 21:43

User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Momentary On/Off Switch with soft shutdown

Postby moocowe » 25 Sep 2016, 23:12

Hi Frank,

Yes, the script "cutpower.sh" is executable, and owner is root. Is the system still able to write to /sys/class/ at the end of the shutdown sequence? I'm really not sure why systemd isn't running it otherwise.

Thanks,
Andrew
moocowe
 
Posts: 2
Joined: 25 Sep 2016, 14:13

Re: Momentary On/Off Switch with soft shutdown

Postby Tall Person » 31 Oct 2017, 00:20

-Raspberry Pi B rev 2, Hifiberry DAC
-Raspberry Pi Zero W, Hifiberry DAC, Runeaudio 0.4
Tall Person
 
Posts: 16
Joined: 16 Sep 2017, 19:43

Re: Momentary On/Off Switch with soft shutdown

Postby Tall Person » 31 Oct 2017, 00:41

Would this procedure work with Runeaudio on a raspberry pi with a Hifiberry DAC anyone?

Sorry if it's a dumb question - from a relatively inexperienced perspective it seems straightforward.
-Raspberry Pi B rev 2, Hifiberry DAC
-Raspberry Pi Zero W, Hifiberry DAC, Runeaudio 0.4
Tall Person
 
Posts: 16
Joined: 16 Sep 2017, 19:43

support RuneAudio Donate with PayPal

Previous

Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 25 guests