There are 5 LEDs on the RPi: OK, PWR, FDX, LNK, 10M.

I'd like to know if it's possible to control any of these from software i.e. turn them on, or change intensity (or even change colour gasp).

And if so, where can I read up about it? The LEDs could be quite handy way of signalling user application status when they are not required for the original use.

  • 2
    And yes - I know I can add LEDs easily onto the GPIO outputs - but I'm curious what can be done without external hardware. – Maria Zverina Jun 25 '12 at 20:10
  • 1
    LEDs are generally single colour (especially when required for one purpose), so you can forget about that part :) – Jivings Jun 26 '12 at 0:11
  • 2
    @Jivings Agree that they're probably single colour given RPi's cost ... but it never hurts to ask :) – Maria Zverina Jun 26 '12 at 8:19

The OK LED can be controlled from user space software. Details here: Re: Can we control the on-board leds

Summarised from the above (all credit to BrianW):

The OK LED is available as /sys/class/leds/led0/.

The kernel LED driver has "triggers" which let some other part of the kernel control the LED. The default trigger for the LED is 'mmc0', which makes it come on when the SD card is accessed.

root@raspberrypi:~# cat /sys/class/leds/led0/trigger
none [mmc0]

You can deactivate the mmc0 trigger as follows:

echo none >/sys/class/leds/led0/trigger

The LED can be turned on and off using the 'brightness' file. The minimum brightness is 0, and the maximum is 255. As there is no variable brightness support, any value greater than 0 will turn the LED on.

echo 1 >/sys/class/leds/led0/brightness
echo 0 >/sys/class/leds/led0/brightness

Setting the brightness to 0 automatically sets the trigger to "none".

If you want the LED to go back to its default function:

echo mmc0 >/sys/class/leds/led0/trigger

There are a couple of kernel modules you can load up (ledtrig_timer and ledtrig_heartbeat) which will flash the LED for you.

modprobe ledtrig_heartbeat
echo heartbeat >/sys/class/leds/led0/trigger

Once you have turned off the mmc0 trigger, you can use GPIO16 to control the LED. It's active-low, so you need to set the pin low to turn the LED on, and high to turn it off.

From Python, you can use the module RPi.GPIO to control pin 16. There is also a C# driver.

Sample code


import RPi.GPIO as GPIO
from time import sleep

# Needs to be BCM. GPIO.BOARD lets you address GPIO ports by periperal
# connector pin number, and the LED GPIO isn't on the connector

# set up GPIO output channel
GPIO.setup(16, GPIO.OUT)

# On
GPIO.output(16, GPIO.LOW)

# Wait a bit

# Off
GPIO.output(16, GPIO.HIGH)
| improve this answer | |
  • 4
    FYI on the Raspberry Pi 2, you can finally control the PWR LED as well! Switch it to GPIO mode with echo gpio | sudo tee /sys/class/leds/led1/trigger, then on or off with echo [0|1] | sudo tee /sys/class/leds/led1/brightness. – geerlingguy Mar 12 '15 at 2:59
  • 2
    For anybody wondering on how to do this from command line (without super user privileges required to write to /sys/class...), first set the LED to trigger on gpio, and then install WiringPi learn.sparkfun.com/tutorials/raspberry-gpio/c-wiringpi-setup after that you can just "$ gpio -g mode 16 output && gpio -g write 16 0" to turn the led ON (and 1 for off) – joonas.fi Feb 17 '17 at 11:37

None of the on board LEDs can be controlled in software - they are all used for other things.

  • OK - indicates SD card access
  • PWR - indicates power to the micro USB connection
  • FDX - Full Duplex LAN
  • LNK - LAN Activity
  • 10M - 10M/100M connection speed - if it is lit, the RPi is connected at 100M.

Now, that's the official answer... Let's study the schematic.

Page 4 The PWR LED is connected directly to the power supply, so we can't control that in software.

Page 3 FDX, LNK and 10M are all connected to the Ethernet chip, so again we can't control them in software (without some funky traffic hack...).

Page 4 BUT OK is actually controlled by GPIO 16, so there is the possibility of a hack...

| improve this answer | |
  • 1
    @AlexChamberlain Nice definition of the LEDs. But are we really sure they can't be controlled by software? Are network LEDs under firmware control or the actual hardware? And if they are firmware controlled, can we reverse engineer this somehow? – Maria Zverina Jun 26 '12 at 9:38
  • 6
    Check out the schematic - PWR is directly connected to the power, and FDX, LNK & 10M to the ethernet chip. As I said, you might be able to hack the OK LED. – Alex Chamberlain Jun 26 '12 at 9:43
  • Alex is correct. the BCM chip has no control (excpet for GPIO16) over those LED's; so no software can access them, not even low level kernel code. You would have to hack the LAN chip or create your own short cut circuit to these LED's- BUt that is really not a great idea. Why not just add your own? – Piotr Kula Aug 9 '12 at 10:13
  • 4
    It seems to me that this other answer shows at least part of this answer (and some comments) to be false. Am I reading things correctly? It may be accurate that only OK (labeled "ACT" on my Rev B. board) can be controlled, but it seems like that one can be. (I haven't tried to actually do it yet, though.) – lindes Oct 28 '13 at 19:01
  • Just confirming that the statement "None of the on board LEDs can be controlled in software - they are all used for other things" is false. I tested the accepted response on raspberry pi 3 and 4s. Here are the commands I used while verifying above... Turn on both LEDs echo 1 | sudo tee /sys/class/leds/led{0,1}/brightness Turn off both LEDs echo 0 | sudo tee /sys/class/leds/led{0,1}/brightness Attach the "heartbeat" trigger to both LEDs echo heartbeat | sudo tee /sys/class/leds/led{0,1}/trigger – Andrew Allbright Jan 13 at 0:01

You can control all leds (except PWR in older Pi models, as said in other answers).

But for ethernet leds you will need to patch the driver and recompile the kernel.

Information of how recompile can get here: http://elinux.org/RPi_Kernel_Compilation

Patch and more information here(google translate if need): http://everpi.tsar.in/2013/11/patch-para-controlar-os-leds-ethernet-do-raspberrypi.html

After done, you be able to control over: /sys/class/smsc95xx_leds and eth_fdx, eth_lnk e eth_spd.

Example: echo 0 > /sys/class/smsc95xx_leds/eth_fdx echo 1 > /sys/class/smsc95xx_leds/eth_fdx

| improve this answer | |

There is a simpler way to control the LAN LEDs from userland. Source code is available from


The program needs to be run with sudo.

| improve this answer | |

I can confirm that with the Raspberry Pi 2 it's possible to control the PWD LED as well!

The power LED is controlled by the files in:


You can turn it off just like the Status LED using:

echo 0 > /sys/class/leds/led1/brightness # Power LED
echo 0 > /sys/class/leds/led0/brightness # Status LED

See Guy's answer for more ways to control the LEDs

| improve this answer | |
  • On raspberry pi zero the "echo 0 ..." turns it on! Not off. – NilsB Apr 27 '18 at 7:54

I wrote a userspace program which let you control the Ethernet LEDs.

The program requires the more recent libusb-1.0 (NOT the older 0.1). It works with LAN9512 (e.g. on the older Raspberry B) as well as LAN9514 chips (e.g. on Raspberry B+ or Raspberry 2)

Details can be found here: LAN951x LED control

| improve this answer | |
  • As the content of your link is quite small, it would be better to include it here in your answer, in blockquotes, as the link may die in the future. If it does then your answer will not be much use. Also, provide the github link here as well. – Greenonline Aug 17 '18 at 20:47

With the Pi 2, you can control both the red and green onboard LED's.

The Windows 10 IoT documentation lists the red power LED and the green Ok LED on GPIO 35 and 47, respectively.


I tried with the Windows 10 IoT and with Python on Raspbian. Both can control the LED's, although Raspbian does override the LED whenever something accesses the SD card. Presumably, clearing the trigger would remove this behavior.)

Here's a sample. (Note that this does not override the trigger as mentioned in prior posts)

print ("Program Start")
import RPi.GPIO as GPIO
import time

channels = [35, 47]

print ("Turning off LED's")
GPIO.setup(channels, GPIO.OUT)
GPIO.output(channels, GPIO.LOW)

print ("Turning on LED's")
GPIO.output(channels, GPIO.HIGH)


print ("Program End")
| improve this answer | |
  • On a Raspberry Pi 3 this sample program seems to consistently crash/hang the operating system. – centic Jun 21 at 16:37

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.