20

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?

Jason Whitehorn
  • 12,933
  • 9
  • 51
  • 68
Mauro Midolo
  • 1,575
  • 2
  • 12
  • 30
  • You can disable the red power led, if thats what you mean? See here: http://www.raspberrypi-spy.co.uk/2013/05/how-to-disable-the-red-led-on-the-pi-camera-module/ –  Nov 21 '14 at 11:47

5 Answers5

27
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

pfnuesel
  • 10,855
  • 11
  • 51
  • 63
Salvo Neutron
  • 286
  • 3
  • 2
26

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.
3

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)

Community
  • 1
  • 1
Ben Voigt
  • 260,885
  • 36
  • 380
  • 671
3

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\"")
2

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.

skypanther
  • 925
  • 7
  • 17