10

I have an RPI 4 in my room. When I sleep the red light fills a big part of the room. I don't want to turn the pi off as I want 24/7 availability. Its ability to be quiet and always available is why I find it appealing to use.

I thought about ducktaping it, but I find hardware solutions to be brutal (+ I can always do it if I get too fed up with it).

Is there a script I can write to turn it off?

6 Answers 6

14

Should work by writing the appropriate value to /sys/class/leds/led1/trigger

To switch it off use none, e.g.:

sudo su
echo none > /sys/class/leds/led1/trigger
#OR: 
echo none | sudo tee /sys/class/leds/led1/trigger 

Use default-on to reverse it.

3
  • Thanks, this is exactly what I was looking for (and couldn't find via search engines, I'm still quite new to the Pi). May 6, 2020 at 14:03
  • Clever! May I ask where you found the values (i.e. none and default-on) documented?
    – Seamus
    Jun 11, 2021 at 5:59
  • Even better: add @reboot echo none > /sys/class/leds/led1/trigger in root's crontab. Mar 12 at 20:24
5

There's a bunch of controls you can use in /boot/config.txt

    act_led_trigger         Choose which activity the LED tracks.
                            Use "heartbeat" for a nice load indicator.
                            (default "mmc")

    act_led_activelow       Set to "on" to invert the sense of the LED
                            (default "off")
                            N.B. For Pi 3B, 3B+, 3A+ and 4B, use the act-led
                            overlay.

    act_led_gpio            Set which GPIO to use for the activity LED
                            (in case you want to connect it to an external
                            device)
                            (default "16" on a non-Plus board, "47" on a
                            Plus or Pi 2)
                            N.B. For Pi 3B, 3B+, 3A+ and 4B, use the act-led
                            overlay.

    pwr_led_trigger
    pwr_led_activelow
    pwr_led_gpio
                            As for act_led_*, but using the PWR LED.
                            Not available on Model A/B boards.

And

Name:   act-led
Info:   Pi 3B, 3B+, 3A+ and 4B use a GPIO expander to drive the LEDs which can
    only be accessed from the VPU. There is a special driver for this with a
    separate DT node, which has the unfortunate consequence of breaking the
    act_led_gpio and act_led_activelow dtparams.
    This overlay changes the GPIO controller back to the standard one and
    restores the dtparams.
Load:   dtoverlay=act-led,<param>=<val>
Params: activelow               Set to "on" to invert the sense of the LED
                            (default "off")

    gpio                    Set which GPIO to use for the activity LED
                            (in case you want to connect it to an external
                            device)
                            REQUIRED

For example my Zero has

dtparam=act_led_activelow=on

so that the LED isn't a power LED, but works like a activity LED (on other RPis)

Take a look at /boot/overlays/README for details.

You probably want

dtparam=pwr_led_activelow=on

to turn your RED LED off. I don't have a RPi4B, so I can't test that and confirm it does what you want. This does the same thing as @Dirk's answer but without needing a script run at boot time.

1
  • I've tried your answer, but it does not seem to work on my RPi 4B. I've tried from the command line (as you seem to suggest), and in /boot/config.txt using a dtparam line, and the dtoverlay as it suggests in /boot/overlays/README. It also seems that there is no dtoverlay for pwr-led as there is for act-led. It's fairly confusing in there - perhaps I've made a bodge of it?
    – Seamus
    Jun 12, 2021 at 6:31
2

I wanted to confirm and abbreviate Dougie's answer in that putting these lines in /boot/config.txt worked for me in accomplishing this goal:

dtparam=act_led_trigger=none
dtparam=act_led_activelow=on
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=on

Note that act_led_trigger/pwr_led_triger can be set to "none." There are various other options for these parameters, including "heartbeat." When you change this file, you will need to reboot the Pi in order to see the changes take effect; there might be a shortcut to avoid having to reboot that I'm not aware of.

1
  • Although it is derived from Dougie's answer, this is different enough to stand on it's own with a little editing.
    – goldilocks
    Sep 28, 2021 at 15:06
1

If you (like me) are using Ubuntu 20.04 server 64 bit, the file to edit is:

/boot/firmware/syscfg.txt

By adding the line:

dtparam=pwr_led_activelow=off

In order to deactivate the LED permanently

0

on ubuntu 22.04 server-lts it is the: /boot/firmware/config.txt

dtparam=pwr_led_trigger=none

dtparam=pwr_led_activelow=off

dtparam=act_led_trigger=none

dtparam=act_led_activelow=off

dtparam=eth_led0=4

dtparam=eth_led1=4

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    yesterday
-1

[pi4 /boot/firmware/syscfg.txt]

Disable the PWR LED

dtparam=pwr_led_trigger=none

dtparam=pwr_led_activelow=off

Disable the Activity LED

dtparam=act_led_trigger=none

dtparam=act_led_activelow=off

Disable ethernet port LEDs

dtparam=eth_led0=4

dtparam=eth_led1=4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.