5

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?

8

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

Use default-on to reverse it.

1
  • Thanks, this is exactly what I was looking for (and couldn't find via search engines, I'm still quite new to the Pi). – Melvin Roest May 6 '20 at 14:03
4

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.

0

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

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.