User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Safe shutdown button

Sat Sep 27, 2014 8:11 pm

I was wondering if there was a way to have a push button to safely shutdown the pi since it will sometimes be running headless. I am a Noob at hardware so can you please explain it? Thank you in advance!

p.s. I am running xbian on a Model B
There are 10 types of people: those who understand binary and those who don't.

User avatar
DougieLawson
Posts: 37133
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Safe shutdown button

Sat Sep 27, 2014 8:32 pm

Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
PeterO
Posts: 5470
Joined: Sun Jul 22, 2012 4:14 pm

Re: Safe shutdown button

Sat Sep 27, 2014 8:38 pm

kusti8 wrote:I was wondering if there was a way to have a push button to safely shutdown the pi since it will sometimes be running headless. I am a Noob at hardware so can you please explain it? Thank you in advance!

p.s. I am running xbian on a Model B
All you need is a Push button and a means to connect it to a GPIO pin. A small bit of python can check the button once a second and shut down the PI if the button is pressed. No need to spend £15.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Safe shutdown button

Sat Sep 27, 2014 8:47 pm

PeterO wrote:
kusti8 wrote:I was wondering if there was a way to have a push button to safely shutdown the pi since it will sometimes be running headless. I am a Noob at hardware so can you please explain it? Thank you in advance!

p.s. I am running xbian on a Model B
All you need is a Push button and a means to connect it to a GPIO pin. A small bit of python can check the button once a second and shut down the PI if the button is pressed. No need to spend £15.

PeterO

Thank you! Can you provide a guide for me to follow. This is the first I have used GPiO
There are 10 types of people: those who understand binary and those who don't.

User avatar
PeterO
Posts: 5470
Joined: Sun Jul 22, 2012 4:14 pm

Re: Safe shutdown button

Sat Sep 27, 2014 8:49 pm

kusti8 wrote:
PeterO wrote:
kusti8 wrote:I was wondering if there was a way to have a push button to safely shutdown the pi since it will sometimes be running headless. I am a Noob at hardware so can you please explain it? Thank you in advance!

p.s. I am running xbian on a Model B
All you need is a Push button and a means to connect it to a GPIO pin. A small bit of python can check the button once a second and shut down the PI if the button is pressed. No need to spend £15.

PeterO

Thank you! Can you provide a guide for me to follow. This is the first I have used GPiO
Can't do it now. I'll do something for you tomorrow.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Safe shutdown button

Sat Sep 27, 2014 9:22 pm

Thanks!
There are 10 types of people: those who understand binary and those who don't.

rgrbic
Posts: 128
Joined: Thu Jun 12, 2014 1:07 pm
Contact: Website

Re: Safe shutdown button

Sun Sep 28, 2014 7:10 am

Here you can find information how to make shutdown/reset button for RPi. Short button press resets RPi, longer (more than 3 sec) press shutdowns RPi.
At 127.0.0.1
Twitter: @rgrbic
IoT-projects.com

User avatar
PeterO
Posts: 5470
Joined: Sun Jul 22, 2012 4:14 pm

Re: Safe shutdown button

Sun Sep 28, 2014 7:43 am

rgrbic wrote:Here you can find information how to make shutdown/reset button for RPi. Short button press resets RPi, longer (more than 3 sec) press shutdowns RPi.
:D That's neater than I would have produced :D

However there is no need for either of the resistors if the pull-up is enabled on the GPIO pin.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Safe shutdown button

Sun Sep 28, 2014 12:20 pm

PeterO wrote:
rgrbic wrote:Here you can find information how to make shutdown/reset button for RPi. Short button press resets RPi, longer (more than 3 sec) press shutdowns RPi.
:D That's neater than I would have produced :D

However there is no need for either of the resistors if the pull-up is enabled on the GPIO pin.

PeterO
This looks great. Thanks!
There are 10 types of people: those who understand binary and those who don't.

Gorgar
Posts: 1
Joined: Thu Oct 02, 2014 4:10 pm

Re: Safe shutdown button

Thu Oct 02, 2014 4:19 pm

You could get the RemotePi Board, it lets you shut down the Pi with a pushbutton or your remote.

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Safe shutdown button

Thu Oct 02, 2014 7:22 pm

Gorgar wrote:You could get the RemotePi Board, it lets you shut down the Pi with a pushbutton or your remote.
I would rather build it myself, save the money and learn how to do it rather than buy an already made package.
There are 10 types of people: those who understand binary and those who don't.

Return to “Beginners”