techskies11
Posts: 73
Joined: Sat Apr 02, 2016 8:45 am

Pi 4 with push button (power button)

Sun Jun 30, 2019 4:43 am

What’s the best way to add a push button (power button on the raspberry pi, I will be adding a sound card that sits on the GPIO and I also want a real time clock, but how can I add a power button on the pi yo turn it on etc, like a set top box

W. H. Heydt
Posts: 11666
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Pi 4 with push button (power button)

Sun Jun 30, 2019 5:05 am

First problem is that you're planning to use a HAT. Unless the HAT you're going to use allows pass-through on some pins, that's going to be a problem for both the RTC and--possibly--the "power" button.

The next issue is, what exactly do you mean by a power button? Do you intend to cut off power to the Pi completely? If so, it'll have to be something external to the Pi, like a line switch. If you just want to put it into a halt state, but with power still being provided to the board, there are ways to do that. The simplest is to use two GPIO pins and a dtoverlay for shutdown. If you pick the right pins (5 & 6, IIRC), you can use a button to shut down and the same button to restart. Note the above HAT, problem with this. IIRC, one of the pins on the PoE header can be shorted to ground to shut down, but I don't know if you can restart that way.

Every RTC for a Pi that I've seen uses the I2C interface, and again, see the point about using a HAT.

The fundamental question about an RTC on a Pi is: Why? If the Pi has network access it will use NTP to keep time, so unless the Pi either has no network connection, or the ports to use NTP are blocked, there is no need for an RTC.

techskies11
Posts: 73
Joined: Sat Apr 02, 2016 8:45 am

Re: Pi 4 with push button (power button)

Sun Jun 30, 2019 9:04 am

I wanted to create a set top box setup, the power button I would press and the pi would turn on or shit down etc, as for the real time clock i really wanted to have it remember the clock when not using it online or when online access is not possible. I think The rtc for my intended use is necessary,

fruitoftheloom
Posts: 22014
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Pi 4 with push button (power button)

Sun Jun 30, 2019 9:21 am

techskies11 wrote:
Sun Jun 30, 2019 9:04 am
I wanted to create a set top box setup, the power button I would press and the pi would turn on or shit down etc, as for the real time clock i really wanted to have it remember the clock when not using it online or when online access is not possible. I think The rtc for my intended use is necessary,

http://www.uugear.com/product/wittypi2/
Retired disgracefully.....
......to an uncomplicated life !

Rather than negativity think outside the box !

alphanumeric
Posts: 2383
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: Pi 4 with push button (power button)

Sun Jun 30, 2019 9:22 am

I have RTC's on several of my headless Pi A+'s. They are setup as weather "clocks" and don't always have WIFI access where they are, and or its a PITA to setup. I want a reliable time display with or without Internet access.
i2c is a shared bus so thats not that big a deal as long as no two devices have the same address. One Pi has a DS3231, BME680, Si1145, and a Sense Hat connected. They all use i2c. I have a Proto Hat mounted on a stacking header between my Pi and Sense Hat. The Proto Hat has the DS3231 RTC mounted to it and headers for all the other bits to connect to my Pi's GPIO. I also have a push button wired to the Proto hat to tell the Pi to shut down when its momentarily pressed. Once the shut down is complete I turn the power off. The shut down is done via my Python file.

alphanumeric
Posts: 2383
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: Pi 4 with push button (power button)

Sun Jun 30, 2019 9:26 am

There is also this, https://shop.pimoroni.com/products/onoff-shim May or may not work for your setup.
I haven't tried it myself but will likely buy one at some point.

techskies11
Posts: 73
Joined: Sat Apr 02, 2016 8:45 am

Re: Pi 4 with push button (power button)

Mon Jul 01, 2019 1:35 am

How to you turn on the pi without a power switch or button

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

Re: Pi 4 with push button (power button)

Mon Jul 01, 2019 1:39 am

techskies11 wrote:
Mon Jul 01, 2019 1:35 am
How to you turn on the pi without a power switch or button
The wall outlets in the UK have a switch (that's required with Part P, edition 18 of our building regulations). If you don't have a switched socket, pull the wart from the wall.
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.

techskies11
Posts: 73
Joined: Sat Apr 02, 2016 8:45 am

Re: Pi 4 with push button (power button)

Mon Jul 01, 2019 2:41 am

That sucks, I don’t have that, the pi desperately needs to have a pin out for a power button we can sodder on

plugwash
Forum Moderator
Forum Moderator
Posts: 3546
Joined: Wed Dec 28, 2011 11:45 pm

Re: Pi 4 with push button (power button)

Mon Jul 01, 2019 2:55 am

DougieLawson wrote:
Mon Jul 01, 2019 1:39 am
(that's required with Part P, edition 18 of our building regulations).
Fitting switched sockets has been "the done thing" in the UK for many years, but it's not actually a regulation.

chipace
Posts: 103
Joined: Sat Jun 29, 2019 2:56 am
Location: brown paper bag in a septic tank

Re: Pi 4 with push button (power button)

Mon Jul 01, 2019 5:09 am

It looks like a 2 pole button switch between GLOBAL_EN and 3.3V acts as a power-on switch. I am seeing 20mA after shutdown with the adapter still connected. No need for the dtoverlay=gpio-poweroff for the RPi 4.

Return to “General discussion”