I would like to turn off the leds of my Raspberry Pi.
I tried modifying the file echo none >/sys/class/leds/led0/trigger
but nothing changed.
Is this possible?
I would like to turn off the leds of my Raspberry Pi.
I tried modifying the file echo none >/sys/class/leds/led0/trigger
but nothing changed.
Is this possible?
RaspberryMediaCenter:/sys/class/leds # echo 0 >/sys/class/leds/led1/brightness
RaspberryMediaCenter:/sys/class/leds # echo 0 >/sys/class/leds/led0/brightness
led0
green one
led1
red one
According to the RaspberryPi forums:
echo 1 >/sys/class/leds/led0/brightness #Turn on
echo 0 >/sys/class/leds/led0/brightness #Turn off
Though I think some kernel hacking may be involved to control all of them, I believe this only works with the OK LED.The documentation is located here, but it may or may not be up to date:
/boot/overlays/README
The README is a rather choppy document, but you can find enough to get started. The parameters of interest are act_led_*
, and pwr_led_*
. There are three device tree parameters (dtparam
) for both act_led
and pwr_led
: _trigger
, _activelow
and _gpio
, but the documentation doesn't mention all possible values for them. Through guesswork, I learned the following values will turn the activity/green and power/red LEDs OFF:
To turn both act_led
and pwr_led
OFF, add these two lines to the file /boot/config.txt
, and then reboot:
dtparam=act_led_trigger=none
dtparam=pwr_led_trigger=none
Changes made on Aug 8, 2022 to the Raspberry Pi's proprietary closed-source firmware have rendered the above configuration ineffective on some models of RPi:
For these models, with firmware versions issued since Aug. 8, 2022, the following configuration is needed to extinguish the Red Power LED (pwr_led
):
dtparam=pwr_led_trigger=default-on # The default
dtparam=pwr_led_activelow=off
There are also parameters for extinguishing the Ethernet LEDs also, but they only work for the 3B+ & 4B models: eth_led0
& eth_led1
. Fortunately, the documentation does enumerate a set of values for the 3B+ and the 4B.
UPDATE, 3/22/22: Additional details are now posted on GitHub
UPDATE, 8/27/22: A recent software/firmware change by The RPi Organization seems to have broken the device tree configuration (dtparam
) that disabled the Red Power LED. A bug report was filed on 2022/08/21. I won't attempt to characterize the maintainer's responses; you may review them & draw your own conclusions.
As of now, I feel that the answer to the OP's question is that "it depends on the Raspberry Pi model"
. I've edited my answer above based on the latest information, but this saga will likely have more episodes! FWIW, the sysfs
interface - deprecated ~ 2 years ago - still seems to be working if the correct file & value are used; the details are presented in another Q&A on the same subject.
UPDATE, 12/27/22:
Any further updates to this answer will be posted to this GitHub repo.
On the Pi you can control the 2 Leds (red and green) by editing the files located under:
/sys/class/leds/led[num]
For example to turn off the usual blinking of the green led when the Pi is accessing the sd card, you can run (as admin):
echo none > /sys/class/leds/led0/trigger
And to turn on or off one led, you can change the status of the brightness file (as admin):
echo 1 > /sys/class/leds/led0/brightness # turn on
echo 0 > /sys/class/leds/led0/brightness # turn off
This is my very inelegant workaround in Python to actually control the status:
import time
import os
# turn off the default trigger of the green LED
os.system("sudo bash -c \"echo none > /sys/class/leds/led0/trigger\"")
# turn on the green LED
os.system("sudo bash -c \"echo 1 > /sys/class/leds/led0/brightness\"")
# keep it on 5 seconds
time.sleep(5)
# turn off the green LED on PI
os.system("sudo bash -c \"echo 0 > /sys/class/leds/led0/brightness\"")
Depending on which LED you are talking about, it looks like it is not possible.
For more information, read How can I turn the lights off on my pi? (and that's also a good place to ask RPi questions)
I realize that this is an old question. But, it was the first in the Google results for me, and it didn't work for my Raspberry Pi2 B+. For anyone else like me finding this now, the techniques at http://www.jeffgeerling.com/blogs/jeff-geerling/controlling-pwr-act-leds-raspberry-pi did work.