Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New to GPIO and RaspPi - how to implement an on/off button? #444

Closed
derOger opened this issue Jan 15, 2019 · 24 comments
Closed

New to GPIO and RaspPi - how to implement an on/off button? #444

derOger opened this issue Jan 15, 2019 · 24 comments
Labels

Comments

@derOger
Copy link

derOger commented Jan 15, 2019

Hello, can you help me with that? I want to build a Jukebox myself and think about the hardware needed.
I would prefer to use a small screen for informations or at least some 8-segment-displays for track number if possible.
Also since I want to use a powerbank I wonder how to implement a power button. For shutdown a simple halt would be enough but I think since there are speakers and other involved maybe this isn't enough. So there are cables which cut of the power via power switch so maybe using this between bank and RaspPi would be an option - but would that harm the OS when used often since they just cut of the power to the Pi while running.
How do you solved this?
Regards and sorry for posting on issues - I don't know where to ask elsewhere ...

@derOger
Copy link
Author

derOger commented Jan 15, 2019

OK, as far as I read - sorry, I was to fast to post, I just connect Pin 5 and 6 with a button for shutdown?

@splitti
Copy link
Contributor

splitti commented Jan 15, 2019

Hello and welcome,

Yeah, with These Pins you could Shutdown, but the power goes to Pi in Standby Mode. That's why most users are using some ATX Board like OnOff Shim.
I am currently working on an easy to use OLED Display Script. Please visit
https://github.com/splitti/oled_phoniebox
for more Informations.
General i am just only a few steps before you, maybe my Blog will help you
https://splittscheid.de/selfmade-phoniebox/.

And please Look at the Raspberry Forum, there are most questions answered:
https://forum-raspberrypi.de/forum/thread/13144-projekt-jukebox4kids-jukebox-fuer-kinder/?postID=363576#post363576

@derOger
Copy link
Author

derOger commented Jan 15, 2019

Thank you. Can you recommend a ATXBoard which is easy available in germany?
Regards

@MiczFlor
Copy link
Owner

Hi @splitti
Wouldn‘t it be a great contribution to create a pull request with your code for the oled to the develop branch?
And I really like your blog post(s) by the way!

Sent with GitHawk

@MiczFlor
Copy link
Owner

@derOger
I can‘t find the link, bit there was a recommended hardware on/off shim in another thread - sent from the UK via ebay.

Sent with GitHawk

@splitti
Copy link
Contributor

splitti commented Jan 15, 2019

Look in my Blog Post, there are different solution for the ATX Boards. But i also wait for YKRUD3 and OnOff Shim because of the prices...
Micz, Yeah of course, but i am really New to Github, maybe you can help me

@derOger
Copy link
Author

derOger commented Jan 17, 2019

Thank you, So I connect the Shim with the button and with the power input of the PI? The power supply is my biggest problem at the moment because I want it be easy to turn of and on. Especially when using the power bank.

@splitti
Copy link
Contributor

splitti commented Jan 17, 2019

Yeah, the OnOff Shim goes on different GPIOs, because you have to communicate with the OS. It is not just pressing on or off, maybe you want to idle Shutdown? And the Controller Shutdown means, that the OS will halt before the power cut. That's why you need different GPIOs.

@puked79
Copy link

puked79 commented Jan 17, 2019

I used onoffshim and supercaps (and a small resistor - without one my powerbank would detect a short immediately when switched on)

Powerbank------switch(4 pin on/off switch - 1 for the shim, the other one to cut the power)----supercaps---raspi

The (my) Problem with the shim was - if I only power down the pi with the shim, my powerbank will go into standby after some time, and that causes some unwanted behaviour.

wired like this, the pi has enough time to power down after it gets the signal from the shim due to the supercaps, And it will turn on again.

@splitti
Copy link
Contributor

splitti commented Jan 17, 2019

@puked79
which Powerbank?

@puked79
Copy link

puked79 commented Jan 18, 2019

@splitti
Xiaomi 2C 20000mAh

same "problem" as the one you mentioned in your (nice - i read it before I started my build) blog.
It "cuts" the voltage when connected/disconnected and the pi reboots. Well - it does indeed NOT cut the power completely - that would be no problem - it pulls down the voltage :( - that`s why I also used a XL6009 DC-DC Boost Modul (between supercaps and Pi) - I can connect and disconnect the powercord without any reboots now.

A better and easier solution would be to find a suitable powerbank. Well - maybe not easier ;)

edit - I see, you found one that works.

@splitti
Copy link
Contributor

splitti commented Jan 18, 2019

Ok, ty for the Info. I just search for other Powerbanks. So, i am interested, if the problem is also there with my Bank an the Shim.

@puked79
Copy link

puked79 commented Jan 18, 2019

Try it, I guess :/
And give feedback when you did :) (I am confident, my first phoniebox was not my last...)

@iwishitwassummer
Copy link

I used onoffshim and supercaps (and a small resistor - without one my powerbank would detect a short immediately when switched on)

Powerbank------switch(4 pin on/off switch - 1 for the shim, the other one to cut the power)----supercaps---raspi

The (my) Problem with the shim was - if I only power down the pi with the shim, my powerbank will go into standby after some time, and that causes some unwanted behaviour.

wired like this, the pi has enough time to power down after it gets the signal from the shim due to the supercaps, And it will turn on again.

Hi @puked79, could you add a link to the supercaps please? Do you have a photo of the wiring by chance? Many thanks

@puked79
Copy link

puked79 commented Jan 21, 2019

@iwishitwassummer
I used 2 of these:
https://www.ebay.de/itm/VINATech-VEC3R0256QG-Doppelschicht-Kondensator-25-F-3-V-Ø-x-L-16-mm-x-25-mm-1/362444127855

no photos of the wiring - its all under a thick layer of electrical tape. But here is a video thatll help:
https://www.youtube.com/watch?v=m20o3P-S5s8

@iwishitwassummer
Copy link

@puked79 thanks. Just that I get your wiring right: the powerbank is plugged with USB into the shim, the OnOff shim is placed at the top of the GPIO pins (pin 1 to 12). You added the supercaps one after the other on raspi pins 1,4,6 and 12?
Thanks

@puked79
Copy link

puked79 commented Jan 22, 2019

@iwishitwassummer no - that wont work. The raspi would not shut down - or it shuts down and restarts (I tried that, but dont remember 100% what exactly was the problem).

the shim triggers a script that shuts down the raspi and afterwards it cuts the power.
You have two options -

first:
the shim has to be plugged in all the time (5 Volts), else it wont work. This will not work with most powerbanks - they go into standby when no electrical consumer (is this the correct term?!) draws power. thus the shim wont work. That was a big letdown for me, when I found out...
second:
that`s what I did - I used a 4 pin on/off switch one circuit cuts the power at cable between powerbank and raspi - directly behind the powerbank, the other one triggers the shim (You have to change a line in the script to make this work).

like this: Powerbank---switch circuit 1-------small resistor---supercaps------XL6009 DC-DC boost module-----shim at switch circuit 2------raspi

I connected the shim via jumper cable - you only need 4 pins connected - you`ll find the used pins on their homepage in the comments (or via google i guess)

@puked79
Copy link

puked79 commented Jan 22, 2019

supercaps have to be in row!

@Feuer-sturm
Copy link

I am using ATXRaspi instead of on / off shim. Here are my experience with this product:
https://forum-raspberrypi.de/forum/thread/41534-powerbank-versorgt-pi-und-shutdown-ueber-atxraspi/

I had the same problem that my powerbank went in standby and I wasn't able to wake the powerbank by using the ATXRaspi.
My soloutin is this little boad: https://forum-raspberrypi.de/forum/thread/28272-powerbank-zur-versorgung-kleiner-lasten-nutzen-grundlast-fuer-powerbank/
It is plugged in the powerbank and every 5s the little board consumes 200mA. With the hack the powerbank doen't go to sleep an my ATXRaspi is working fine.

@derOger
Copy link
Author

derOger commented Jan 23, 2019

Hello, do you experience a real power drop by that? And is there a way to get such a stick? I don't have the equipment to build it myself (or is there a blueprint for - ehr - Lochplatinen (?!?)?

Edit: The powerbank / powersupply is the last part I need to solve before getting all together for a casing.

@Gelegenheitsbastler
Copy link

Hi,
there is no blueprint available. Ask the user "Neueinsteiger". He will build one for you.

@Feuer-sturm
Copy link

@derOger My Powerbottun is connected to the ATXRaspi board. When I press the button longer then 2s the ATXRaspi will shutdown the Pi and if this is finised the ATXRaspi board disconnect the power supply to the pi.
The stick is just for keeping the powerbank alive.

@derOger
Copy link
Author

derOger commented Jan 24, 2019

@SpookyFishes Thank you. I fear that I will run into the same problems (Powerbank goes to sleep) so I want to bypass this problem early on. So I search for a prooved solution I can use.

Repository owner locked and limited conversation to collaborators Dec 11, 2023
@s-martin s-martin converted this issue into discussion #2154 Dec 11, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

8 participants