HyperPixel which GPIO for power-on power-off

Hi.

I have a HyperPixel 4.0 screen working on a RPi2.

I would like to implement a button (or two) to turn-on and off the RPi.

According to HyperPixel Pinout, there is no free pin to do it. But I would like to ask if I could use any with minimal (or no) interference with normal functioning.

For example, could I use GPIO 3 (pin 5) and GND (pin 6) just to turn it on? After it, this GPIO 3 could be use for the HyperPixel. What would happen if it is connected to GND again while the screen is working?

In order to turn it off, which one could I use?

If this approach is completely wrong, what would you recommend instead?

Many thanks!

Grounding GPIO 3 will boot it up OK, assuming the power supply is plugged in etc.
If you edit the config.txt file and add dtoverlay=gpio-shutdown to it grounding GPIO 3 will have Raspbian do a proper shutdown. Normally that pin would be used for i2c, I have no idea what might happen with the way the Hyperpixel uses that pin? Or what might happen if you try to use another GPIO in use by the Hyperpixel? I don’t think you will damage naything but you might get some weird effects on the screen?
The dtoverlay entry can be set to use another GPIO pin for shutdown. I use the following with my Fan Shim
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up
The Fan Shim Button grounds GPIO 3 and 17 when pressed.

Hi @alphanumeric

I have the same question as @darioml , would like to either add a shutdown button and or use a UPS to auto-shutdown the rasberry pi (pi-zero W) by pulling down the pin (which seems to be the correct terminology), is you answer indicating that gpio pin5 OR pin17 will work if setup after setting up the dtoverlay setting? Or do both pins need to be used?

I am currently looking at low cost UPS options, and considering this idea:
http://www.hackerspace-ffm.de/wiki/index.php?title=Raspi_EDLC_UPS

dtoverlay=gpio-shutdown uses GPIO 3 physical pin 5 by default. And this only works if i2c is disabled. If you enable i2c, which uses GPIO 3 it won’t shut down, the dtoverlay entry in ignored.

dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up changes what pin is used to GPIO 17, it can be any GPIO you want, just change the 17 to the GPIO you want to use. This will work even if i2c is enabled, just don’t use GPIO 3 or GPIO 2.
It’s the BCM number not the physical pin number. And you don’t want to use one that’s already in use by something else. And only that one pin needs to be grounded.

1 Like

ok, thanks, I am using a raspberry pi zero w, with the Hyperpixel 4 (square) screen, so will need to be compatible with that? which pin can I use if I am using this screen? Havong rad some other posts, its seems the screen uses all the pins?

You can’t do what I posted above with the Hyperpixel, it uses “ALL” of the GPIO pins.

@alphanumeric: ok, thank for confirming that… this is a shame though.

It was the tradeoff for the performance of that screen. Or so I’ve been told.
I’ve been using the Pi Foundation 7 inch touch screen. It uses the DSI port so no issues with using the GPIO for pretty well what ever you want.
I wish it was 800 x 480 or higher though. There always seems to be some kind of trade off?

@alphanumeric: No problem, it is what it is, having the gpio pin only screen does have its merits. We need a square screen for the application we are prototyping and I have an idea for a UPS that doesn’t use GPIO, so will explore that.

Surprisingly there are not many square screen of that size available, or that I can find anyway…

Is it worth looking at providing some kind of API that could potentially switch off the screen to then gain access to gpio pins in some way?

Adafruit have a bunch of PiTFT GPIO connected screens. I don’t think they have anything bigger than 3.5 inches though, and most if not all of those are not square. Last time I had a look see anyway.
I use the Pi’s GPIO a lot. Almost every one of my builds has something connected to it. The only SPI displays I use are the little Breakout garden ones. Which if I’m honest, I wish were a little bigger.