A Button to Switch your Pi Safe On and Off
HTML-код
- Опубликовано: 2 июл 2024
- 🚀 Ready to master the Raspberry Pi 5? Join our comprehensive online course today! Whether you're a beginner or an experienced enthusiast, our course has everything you need to innovate and excel. Dive into advanced Python programming, hardware integration, and practical projects that bring your ideas to life.
👉 Enroll now and start your journey: Guides4Tech.com
Unlock exclusive course materials, including a detailed 90-page E-Book, and take advantage of a limited-time discount for early sign-ups. Don't miss out on transforming your technical skills!
---------------------------------------------------------------
In this Video i explain how to connect a power button to your raspberry PI that ensure that your raspberry will shut Off safe. I will exlain where to connect it and how to configure the /boot/config.txt to use it right.
if this does not work, update your bootloader:
sudo apt update
sudo apt full-upgrade
sudo apt install rpi-eeprom
sudo rpi-eeprom-update
-------------------------------------------------------------
Tools i use:
Wires: amzn.to/3Etm4Nl *
bread board kit: amzn.to/3PvUTrk *
LED set : amzn.to/3P94pzo *
transisotrs: amzn.to/44LrEVZ *
Pi Pico W: amzn.to/467nAR3 *
*affiliate link
--------------------------------------------------------------- Наука
Short, simple, sweet! Thanks mate :)
Exactly what I was looking for, thanks!😁
Wow, that was simple! I was trying to use some scripts that I found elsewhere for this power button but they didn't work (error messages), this worked great and it was fast and easy!
Thank you 😀 i also found thos not working Scripts in the preperation of this Video 😂😂
im going to find the hugest comedy sized button ever to shut down my pi 👍😂
Hahaha, would Love to See a picture of it 😀😀😂
Maybe for this Project your Button would also fit:
ruclips.net/video/jqCa5RZWT9s/видео.html
😉
Very useful video! Thank you very much!
Bruce Dickinson is teaching us electronics. Great video
Thanks :-)
Thanks! Now I can use 1 button to turn on and off raspberry instead of 2!
and when you click on the button, the raspberry power up ? or this button is only used to shutdown the raspberry ?
Worked perfectly, thanks!
Your welcome :-)
Im I am running Batocera for my arcade cabinet on my SD card, do I remove the SD card before proceeding?
I really appreciate the help. And no need to git clone. Thanks 👍🏿
Your welcome :-)
Excellent, thanks. Another question re sound: I got the small screen with a 4pin connector plugged into the back to get sound, which worked okay. However the screen was too small and I got myself a HDMI switch where I can share a larger screen between Windows 11 and the Raspberry Pi 4B. The problem is: no sound because I disconnected the small screen. Is there a way where I can plug the 4Pin connector into the Pi's GPIO?
yayy it works! Thanks! :D
this worked great !
Hi! Its possible to use a button of type switch (two state, not holding/push button) ? Its convinient and safe? Great video too.
Hi. is there anyway to do this on Dietpi with Amiberry??
Do you need to do the software if you have Android installed on the Raspberry Pi?
thank you!
I did it exactly like shown in the video, but nothing happens when I press the button
I have followed the steps but when I press the button, Kodi shows the shutdown menu . Is there any command to force shutdown directly?
I take this back. This does no more or less than the python code projects offered. It still keeps my fan powered on. It doesn't start up if I hit the button again. If I need to power off I still have to unplug the usb power supply manually.
Can i do this with dietpi with dac hat?
Thanks, worked like a charm.
Ps. My use of the pi4 is quiet stupid, I use it as a smart tv box under android tv instead of buying the chinese crap.
i just need code, what need make or were have code, reset/safe shutdown. i has before but new image not have and not found old code anywere. bush button short shutdown and if want only reset bush logtime about 5-10 sec.
On the 64 bit version you need to press the button twice unlike on the 32 bit version of pios. How can I fix that?
Its the same for orange pi
thanks
great vid!
Thank you 😀
Hey, I am trying to add the same functionality but I am running Ubuntu 20.04 on the pi instead of Raspbian, will it still work?
Hey, lets say it this way: i have no Idea why it should not work, but i didn't tried it.
Let my know If it works or not, others are propably interested too. Thanks in advance.
Can use for raspberry pi 2?
its working, but not as expected:
For shutdown, I need to trigger the button twice.
1) trigger button once: it opens up the log-off window(shutdown, reboot...),
2) trigger button again: it does the shutdown.
Is this a feature? Maybe version related (Raspberry Pi OS Oct. 2023 release)?
That's exactly what the Pi 5 power button does. I'm looking for the same functionality in a Zero 2 W
Same issue here on my Pi5, but no solution (yet).
@@hermetheuscoffee There are broken out pins next to the RTC port for the button on the Pi 5.
@@Obsidianxenon yes, I’m actually soldered to those pads and not the GPIO, but that irritating “press twice” behavior is still there. There has to be a way in configuration to skip the “reboot/shutdown” screen, but for the life of me, I can’t find it.
@@hermetheuscoffee I'd say the second press feature is good especially if you press it accidentally.
not working on rpi 3b v1.2
May I know specifically what kind of switch to use here? I'm afraid I might pick the wrong one lol
In General there is Not much you can do wrong by choosing a Button. You can use Something Like this
a.co/d/6K4q1aO
Enjoy your Project
you want a switch of the type "momentary". most are of the correct type contacts "normally open". (or just "N.O." or "NO") Do not get it if it says "normally closed" / NC.
I’m using a Soviet-era switch to turn mine on and off 😎😎
Lutz, amazing!! The button turns on my raspberry pi 3B+ and turns it off but then it automatically reboots. Any quick idea why?
Thanks for your Feedback. At my 3b+ it Works without a Problem. Did you Update the bootloader? May this can Help.
Just to make it clear you use a Button not a switch?
@@lutz4tech Thank you. I will follow the boot loader instructions. Yes it is a switch. Is this compatible with running Retropie?
@@mattrosen1839 please use a Button instead of the Switch.
Never Tried retropi, but in my Unserstanding it should Work.
HI! I appreciate all you feedback. How do you remove the code? It is still causing me issues. No worries if it is not an easy process. Appreciate you
How do you not cause a short-circuit ?
The Button is Connected to a gpio, Not 5v. Gpio Pins are made to "pull" Thema to gnd. They are protected inside of the IC.
Will this work with my RPi2B?
r u dumb? it works on any rpi
Does this work for the Pico?
No, only Zero and the big ones. On a Pico should it normaly Not a Problem to Switch the Power off, If your not writing to Files.
@@lutz4tech Thanks, that's what I was thinking, but good to get confirmation.
My button is connected but it doesn't do anything, but if I disconnect the cables from it, it boots up the pi. What is going on?
Hmm, sounds strange. Is your Button maybe opening If you Push it?
@@CsoszGergo this Sounds Like a non-bouncing Switch. So is different to use, you need To Power it with a voltage and then its switching the Signal on the "Out" Pin to gnd (its an Open collector propably). If you supply it with (propably 3v3 or 5v) it should Work as well.
AS a try what i explain in the Video use instead of this Button a Wire. This you can Close and Open it. For the Pi it Looks Like a Button.
@@lutz4tech I connected the VCC to 3x3 and even 5v, and then the OUT to the GND. Now it resets the pi, like when pressing the reset button on a computer. So it looks like it's still not the way to connect these. I try asking around in the rasp discord to see if someone can help out. But thanks for the vid!
@@CsoszGergo i think you get me wrong. Vcc to 3v3, Out to Pi Button pin, gnd to gnd.
Or use the wire ;-)
@@lutz4tech I tried this as well, but that does nothing.
What you mean by wire?
How can I make it work for the pi5?
Pi5 has a own Button, on the side of the PCB.
My pi5 will be in a housing so would this still work?
sadly this does not seem to work with retro pie, and yes im using a button and not a switch
I googled a bit, there is a RUclips Video explaining it for retro pie. I didn't Check it, so i don't know If it helps you but i Hope so.
m.ruclips.net/video/4nTuzIY0i3k/видео.html
Greetings lutz
@@lutz4tech thanksan it helped!!
Why can't we use a switch? Why does it need to be a button?
You can use a Switch in the supply, but this would directly Turn Off the Pi. So the software has No Change to Finish its writing Tasks and you can get corrupt Data.
If you mean in the Same was as i described but usw a Switch. The Interface of the Pi is Made for a Button, so you would need to toggle the Switch fast (On/Off/on) like a Button would to it.
can i use different pin?if yes. please do some tuto please
yes, he shows you how to use another pin in this tutorial
didnt work
I can switchon the system however i cant shutdown after pressing the power button. Can anyone help me.
Hi sorry for late response. Did you do the Update as i described in the Video description?
What is wen the gpio Pins are used by a hat?
Used by a hat? Typo?
If the gpios are used you can try an Other one (need to Change the nimber in Software, but Not erveryone Work). Or you use an Other gpio for your application.
*CTRL-Y X Enter*