carloratm
Posts: 2
Joined: Sat Oct 11, 2014 1:04 pm

ON/OFF Switch DIY

Sat Oct 11, 2014 3:34 pm

Hi all,
I would like to do an ON OFF *switch* for the B+.

Is that possible?
Is it enough to connect the switch to 2 pins on the GPIO ? If so, what are the pins to connect?
Or do I need some other circuitry? If so, may i retrieve the scheme online?

klricks
Posts: 5917
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: ON/OFF Switch DIY

Sat Oct 11, 2014 11:35 pm

It is possible and there is much information on line Google search.

Powering on from halt state is easy and can be done with a simple momentary switch connected to the run pin and ground.
http://www.raspberrypi.org/forums/viewt ... 00&t=82963
Note you do not want to push the switch when the RPi is running or else it will reset just as if you pulled the power plug and put back

Powering down properly (halt) with a switch is not as easy. You need to make a program that monitors a GPIO of your choice. When the program detects that the switch connected to that GPIO has changed, then it will issue a shutdown command.: sudo shutdown -h now

If you want to have the switch shutdown AND remove all power to the RPi then that is much more complicated and takes external circuitry.
There are various ON/OFF switches you can buy ready to go.
Again Google........
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

fruitoftheloom
Posts: 17838
Joined: Tue Mar 25, 2014 12:40 pm

Re: ON/OFF Switch DIY

Sun Oct 12, 2014 7:06 am

carloratm wrote:Hi all,
I would like to do an ON OFF *switch* for the B+.

Is that possible?
Is it enough to connect the switch to 2 pins on the GPIO ? If so, what are the pins to connect?
Or do I need some other circuitry? If so, may i retrieve the scheme online?
http://mausberry-circuits.myshopify.com
Adieu

carloratm
Posts: 2
Joined: Sat Oct 11, 2014 1:04 pm

Re: ON/OFF Switch DIY

Sun Oct 12, 2014 7:23 am

klricks wrote: There are various ON/OFF switches you can buy ready to go.
Again Google........
Clear.
I bought that: http://mausberry-circuits.myshopify.com ... own-switch
That seem perfect.

Thank you!

RepublicanSwag
Posts: 21
Joined: Tue Oct 28, 2014 9:15 pm

Re: ON/OFF Switch DIY

Thu Nov 06, 2014 1:11 am

Will this slick-looking power switch http://mausberry-circuits.myshopify.com ... own-switch fit within this case https://www.modmypi.com/blog/introducin ... berry-pi-b ?

Also, does this switch cover all of the USB ports?

And would this work with the B+ model?

Thanks!

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: ON/OFF Switch DIY

Thu Nov 06, 2014 12:46 pm

RepublicanSwag wrote:Will this slick-looking power switch http://mausberry-circuits.myshopify.com ... own-switch fit within this case https://www.modmypi.com/blog/introducin ... berry-pi-b ?

Also, does this switch cover all of the USB ports?

And would this work with the B+ model?

Thanks!
the case you linked is form fitting, there is no way to fit a switch inside it without having micro usb extension cables looping around from outside to in.
the switch you liked is designed for direct mounting on the front of the B, as the B+ has the power input in a different place the switch won't look quite as good if fitted directly to the B+ (but with Micro USB extension cables you could change its position).
Doug.
Building Management Systems Engineer.

karthik sriram
Posts: 1
Joined: Mon Mar 14, 2016 2:00 pm

Re: ON/OFF Switch DIY

Mon Mar 14, 2016 2:11 pm

Hi,I am karthik pursuing my BE 3rd year. I bought a new raspberry pi 2 model B with 1 GB ram.
I connected it to my pc with rasbian OS.Its was working well,but when i connected a small dc motor to its i/o pin 5v and gnd,the motor \was running .suddendly the red and green led switched off and now i cant able to on my raspberry pi,when i connect my micro usb to power supply it,there is no response from it.no red n green light blinking.but when i disconnect the supply,the green led blinks once.can anyone help me please.

generatorlabs
Posts: 12
Joined: Wed Mar 25, 2015 1:39 am

Re: ON/OFF Switch DIY

Wed Mar 30, 2016 10:53 pm

karthik sriram wrote:Hi,I am karthik pursuing my BE 3rd year. I bought a new raspberry pi 2 model B with 1 GB ram.
I connected it to my pc with rasbian OS.Its was working well,but when i connected a small dc motor to its i/o pin 5v and gnd,the motor \was running .suddendly the red and green led switched off and now i cant able to on my raspberry pi,when i connect my micro usb to power supply it,there is no response from it.no red n green light blinking.but when i disconnect the supply,the green led blinks once.can anyone help me please.
It is not a good idea to run anything noisy like a DC motor from any pin of the Pi. First the Pi pins cannot support the load requirements of a motor. 2nd the electrical noise imposed on the clean power rail of the Pi is certainly disastrous. Always drive loads with current bearing devices like a driver board, a Darlington transistor array of even a simple transistor circuit. There are millions of examples of this on the net. Furthermore motors will create back currents from the rapid collapsing of the windings as the armature spins. These backward currents can easily exceed the voltage you apply to the motor and will certainly exceed the ratings of a fragile device like the Pi. I hate to say it but I think you are going to need to get a new Pi.

If

tomtibbetts
Posts: 1
Joined: Tue May 09, 2017 12:13 am

Re: ON/OFF Switch DIY

Tue May 09, 2017 12:18 am

There's a nice little board at: https://www.tindie.com/products/tomtibb ... pberry-pi/
It provides clean power down and it back powers the Pi using an ATX desktop supply. Check it out!

asahero
Posts: 1
Joined: Thu Jun 01, 2017 4:22 am

Re: ON/OFF Switch DIY

Thu Jun 01, 2017 4:46 am

Hi, all
im using pi3(KODI). it has a power switch made by me.

first, need a tv that has a usb port. Theory is same. If you turn on TV, usb port has 5V, if you turn off TV, usb port has 0V. So in case of turn on TV, 5V makes a pulse to booting pi3. In case of turn off TV, CEC command to pi3 shutdown.

second, make a 5V module that generates single pulse. if you supply 5V to this module, it delays some seconds and then makes a single 0.3 second length pulse and then that makes pi3 booting.

that works good!
Attachments
img.jpg
img.jpg (35.11 KiB) Viewed 24126 times

tigerduck
Posts: 1
Joined: Mon Feb 05, 2018 3:32 pm

Re: ON/OFF Switch DIY

Mon Feb 05, 2018 5:00 pm

asahero wrote:
Thu Jun 01, 2017 4:46 am
second, make a 5V module that generates single pulse. if you supply 5V to this module, it delays some seconds and then makes a single 0.3 second length pulse and then that makes pi3 booting.
Hi @asahero,
I had exactly the same Idea to use the TV USB-Port to switch on/off my raspberry.
The problem is that I have no idea how to realize this circuit.
Can you explain the electrical part? And do you use the same gpio for power on and off the rpi?
Thanks

mpember
Posts: 22
Joined: Tue Aug 15, 2017 12:39 am

Re: ON/OFF Switch DIY

Thu Apr 19, 2018 5:32 am

My TV has a USB that turns off when the TV is in standby. It also doesn't provide enough power via the built-in USB port to power the Pi. So, I bought a relay that operates on 5V and used it to switch an external power supply for the Pi. One component and a few leads is all I needed.

Since the Pi will automatically boot when power is connected, there is no additional work needed to turn the Pi on. The only thing to keep in mind is that you must wait for the Pi to cleanly shut down prior to turning the TV off.

Return to “HATs and other add-ons”