# Pirate Audio Headphone Amp - why does the backlight stay on when the Raspberry Pi is powered down?

**URL:** <https://forums.pimoroni.com/t/pirate-audio-headphone-amp-why-does-the-backlight-stay-on-when-the-raspberry-pi-is-powered-down/22126>\
**Category:** Support\
**Created:** [May 7, 2023, 9:59am UTC](https://forums.pimoroni.com/t/pirate-audio-headphone-amp-why-does-the-backlight-stay-on-when-the-raspberry-pi-is-powered-down/22126 "2023-05-07T09:59:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bjoern](https://avatars.discourse-cdn.com/v4/letter/b/46a35a/32.png) [@Bjoern](https://forums.pimoroni.com/u/Bjoern)\
**Post date:** [May 7, 2023, 9:59am UTC](https://forums.pimoroni.com/t/pirate-audio-headphone-amp-why-does-the-backlight-stay-on-when-the-raspberry-pi-is-powered-down/22126/1 "2023-05-07T09:59:49Z")

</div>

I have a Pirate Audio Headphone Amp. When the Raspberry Pi Zero is on, you can turn the backlight off ([pirate-audio/README.md at master · bjohas/pirate-audio · GitHub](https://github.com/bjohas/pirate-audio/blob/master/build%20your%20own/README.md)).

However, when the Pi is powered down, the backlight comes back on. Is there any way of avoiding that? (Other than unplugging the Raspberry Pi.)

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [May 7, 2023, 10:22am UTC](https://forums.pimoroni.com/t/pirate-audio-headphone-amp-why-does-the-backlight-stay-on-when-the-raspberry-pi-is-powered-down/22126/2 "2023-05-07T10:22:23Z")

</div>

The backlight is turned off by a low signal on the backlight pin. When the Pi shuts down that pin is likely going to a floating state (not a low), thus the backlight goes back on.

---

<div class="post-metadata">

**Author:** ![Bjoern](https://avatars.discourse-cdn.com/v4/letter/b/46a35a/32.png) [@Bjoern](https://forums.pimoroni.com/u/Bjoern)\
**Post date:** [May 8, 2023, 7:53am UTC](https://forums.pimoroni.com/t/pirate-audio-headphone-amp-why-does-the-backlight-stay-on-when-the-raspberry-pi-is-powered-down/22126/3 "2023-05-08T07:53:38Z")

</div>

Thank you. That is to say that there isn’t really a solution for this… unless one constructed a ‘standby saver’ unit, that cuts power completely if the draw is very small.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [May 8, 2023, 8:49am UTC](https://forums.pimoroni.com/t/pirate-audio-headphone-amp-why-does-the-backlight-stay-on-when-the-raspberry-pi-is-powered-down/22126/4 "2023-05-08T08:49:59Z")

</div>

There is no easy solution. I have a switch wired up on a couple of my builds that have proto boards in the mix. In my case those Pi’s run 24/7 but I sometimes like to turn the displays off.  
There is also a dtoverlay that can set a pin low on shutdown, and keep it low. I tinkered with it in the past but it had other side effects that I didn’t like. The main one being the Pi would no longer boot up when GPIO 3 was grounded. I had to unplug the power supply, and plug it back in to get that Pi to boot up.

---

<div class="post-metadata">

**Author:** ![Bjoern](https://avatars.discourse-cdn.com/v4/letter/b/46a35a/32.png) [@Bjoern](https://forums.pimoroni.com/u/Bjoern)\
**Post date:** [May 8, 2023, 10:22am UTC](https://forums.pimoroni.com/t/pirate-audio-headphone-amp-why-does-the-backlight-stay-on-when-the-raspberry-pi-is-powered-down/22126/5 "2023-05-08T10:22:32Z")

</div>

This is really helpful @alphanumeric, thank you so much.

> [@alphanumeric](#):
>
> There is no easy solution. I have a switch wired up on a couple of my builds that have proto boards in the mix. In my case those Pi’s run 24/7 but I sometimes like to turn the displays off.

While the Pi is on (with this particular display), turning the display off while the Pi is on is not a problem:, as noted [above - dimming is harder though](https://github.com/bjohas/pirate-audio/blob/master/build%20your%20own/README.md).

> [@alphanumeric](#):
>
> There is also a dtoverlay that can set a pin low on shutdown, and keep it low. I tinkered with it in the past but it had other side effects that I didn’t like. The main one being the Pi would no longer boot up when GPIO 3 was grounded. I had to unplug the power supply, and plug it back in to get that Pi to boot up.

When you say ‘no longer boot’, what do you mean? No longer boot by pulling up a pin? I will only have the Pi on for part of the day, and am thinking of having one of those micro-usb cables with a switch. So fully disconnecting power / reconnecting power would not be an issue for me.

Were there other unintended side effects?

Also, do you have the code for this? I had a quick look, but I couldn’t see any standard overlays that would pull a gpio low or high. Any hints greatly appreciated!

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [May 8, 2023, 11:11am UTC](https://forums.pimoroni.com/t/pirate-audio-headphone-amp-why-does-the-backlight-stay-on-when-the-raspberry-pi-is-powered-down/22126/6 "2023-05-08T11:11:19Z")

</div>

I have some headless setups that I shut down with a button press.  
I use the following with my Fan Shim for example.  
`dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up`  
If you shutdown and leave the power on, grounding GPIO 3 will boot the Pi back up.  
On a stock fan shim the fan will just keep running on shutdown until you remove power. The fan control pin needs to be grounded. Thats where I had tried the overlay to keep the pin low on shutdown. It worked, the fan shut off, but I couldn’t boot back up with a button press. I had to unplug the power supply and plug it back in to get the Pi to boot up again.

```auto
Name: gpio-poweroff
Info: Drives a GPIO high or low on poweroff (including halt). Enabling this
        overlay will prevent the ability to boot by driving GPIO3 low.
Load: dtoverlay=gpio-poweroff,<param>=<val>
Params: gpiopin GPIO for signalling (default 26)

        active_low Set if the power control device requires a
                                high->low transition to trigger a power-down.
                                Note that this will require the support of a
                                custom dt-blob.bin to prevent a power-down
                                during the boot process, and that a reboot
                                will also cause the pin to go low.
        input Set if the gpio pin should be configured as
                                an input.
        export Set to export the configured pin to sysfs

```

---

<div class="post-metadata">

**Author:** ![Bjoern](https://avatars.discourse-cdn.com/v4/letter/b/46a35a/32.png) [@Bjoern](https://forums.pimoroni.com/u/Bjoern)\
**Post date:** [May 8, 2023, 2:27pm UTC](https://forums.pimoroni.com/t/pirate-audio-headphone-amp-why-does-the-backlight-stay-on-when-the-raspberry-pi-is-powered-down/22126/7 "2023-05-08T14:27:56Z")

</div>

That’s amazing, thank you! (I’ll try this and will post back.)

---

<div class="post-metadata">

**Author:** ![Bjoern](https://avatars.discourse-cdn.com/v4/letter/b/46a35a/32.png) [@Bjoern](https://forums.pimoroni.com/u/Bjoern)\
**Post date:** [May 9, 2023, 8:09am UTC](https://forums.pimoroni.com/t/pirate-audio-headphone-amp-why-does-the-backlight-stay-on-when-the-raspberry-pi-is-powered-down/22126/8 "2023-05-09T08:09:59Z")

</div>

Hi @alphanumeric - thank you again. All works! Written up here [pirate-audio/README.md at master · bjohas/pirate-audio · GitHub](https://github.com/bjohas/pirate-audio/blob/master/build%20your%20own/README.md).

---

<div class="post-metadata">

**Author:** ![joop](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@joop](https://forums.pimoroni.com/u/joop)\
**Post date:** [September 23, 2024, 1:29pm UTC](https://forums.pimoroni.com/t/pirate-audio-headphone-amp-why-does-the-backlight-stay-on-when-the-raspberry-pi-is-powered-down/22126/9 "2024-09-23T13:29:21Z")

</div>

I solved it with inspiration above as follows:

```auto
 cat displayoff.py 
from st7789 import ST7789

# Set your parameters
rotation = 0 # Change as needed
spi_port = 0
spi_chip_select_pin = 0
spi_data_command_pin = 23
backlight_pin = 13
spi_speed_mhz = 80 # Example speed, adjust as necessary

# Initialize the display
disp = ST7789(
    rotation=rotation,
    port=spi_port,
    cs=spi_chip_select_pin,
    dc=spi_data_command_pin,
    backlight=backlight_pin,
    spi_speed_hz=spi_speed_mhz * 1000000 # Convert MHz to Hz
)

# Begin communication with the display
disp.begin()

# Turn off the backlight
disp.set_backlight(0)
print("Backlight turned off.")

```
