Get Informed out of Data

Full width home advertisement

Raspbian

DataScience

Post Page Advertisement [Top]

Control the Power and ACT led of Raspberry pi 4

Control the Power and ACT led of Raspberry pi 4



Normally, whenever the Pi is powered on—except if the power supply dips below something like 4.5VDC—the red PWR LED remains lit no matter what. If you wanted to 'disable' the LED, you'd have to put a piece of tape or something else over the LED, or get out a soldering iron and modify the hardware a bit.
But, the main reason for controlling LED in raspberry pi 4 is being the lack of power to the hardware.
If you can Off the Led's the screen blinking, I/O ports can gain more stable power thus, imporves working.
you can control the LEDs in software, in a few different ways. The simplest way to change the way these LEDs work is to modify the trigger for each LED by setting it in /sys/class/leds/led[LED_ID]/trigger, where you replace [LED_ID] with 0 for the green ACT LED, and 1 for the red PWR LED.
For example:
# Set the PWR LED to GPIO mode (set 'off' by default).
echo gpio | sudo tee /sys/class/leds/led1/trigger

# (Optional) Turn on (1) or off (0) the PWR LED.
echo 1 | sudo tee /sys/class/leds/led1/brightness
echo 0 | sudo tee /sys/class/leds/led1/brightness

# Revert the PWR LED back to 'under-voltage detect' mode.
echo input | sudo tee /sys/class/leds/led1/trigger

# Set the ACT LED to trigger on cpu0 instead of mmc0 (SD card access).
echo cpu0 | sudo tee /sys/class/leds/led0/trigger

If you want to disable both LEDs permanently, add the following to /boot/config.txt:
# Disable the ACT LED.
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off

# Disable the PWR LED.
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=off

3 comments:

  1. This does not work for the power led (red).

    ReplyDelete
    Replies
    1. may be changed in recent update on eeprom - so will let you know tomorrow after testing.

      Delete
    2. Tested it, works fine for me. Sometimes on reboot the config.txt won't respond quick.Hence add the commands on cron to run @reboot

      Delete

Bottom Ad [Post Page]