snake111
Posts: 2
Joined: Sun Oct 06, 2013 2:59 pm

Status LED - Redirecting

Mon Jun 30, 2014 4:31 pm

Not sure if I'm using the right terminology, but I'm building a case for my pi and would like to "export" the status led, so that I can see them on the front panel. The case will be painted black so I need a way to adding LED to the front panel.

What is the best way of doing this?

thx

User avatar
joan
Posts: 14747
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Status LED - Redirecting

Mon Jun 30, 2014 4:34 pm

A light pipe.

User avatar
rpdom
Posts: 16306
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Status LED - Redirecting

Mon Jun 30, 2014 4:35 pm

The easiest way would be to use light-pipes or fibre-optic cables to channel the light from the LEDs to the front panel.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Status LED - Redirecting

Mon Jun 30, 2014 7:40 pm

There's an even better way... :D

By editing some kernel parameters through /boot/cmdline.txt you can actually disable the green ACT LED and have it function on a GPIO of your choosing. In my example I just happen to be using GPIO17 but you should obviously change it to whatever GPIO your LED (and current-limiting resistor) is connected to.
  1. sudo nano /boot/cmdline.txt
  2. Keeping it all on one long line, add this to the end: bcm2708.disk_led_gpio=17 bcm2708.disk_led_active_low=0
  3. sudo reboot
  4. Do a happy dance ;)
Discovered by looking at /proc/cmdline on the Compute Module, and by looking at https://github.com/raspberrypi/linux/bl ... /bcm2708.c :ugeek:
As it's using kernel parameters this obviously only works while Linux is actually active, i.e. the multiple flashes you get after doing a "sudo poweroff" actually still flash the green ACT LED and not your 'external' status LED.

If you want to have both activity LEDs active at once, have a look at http://www.raspberrypi.org/forums/viewt ... 33&t=52893 and/or http://www.raspberrypi.org/forums/viewt ... 31&t=46517 (neither of which I've tried).

User avatar
DougieLawson
Posts: 37460
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Status LED - Redirecting

Mon Jun 30, 2014 7:42 pm

The hardware solution trumps that every time. It's not difficult to pipe the light in a piece of plexiglass.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

djdtime
Posts: 5
Joined: Wed Oct 29, 2014 3:19 am

Re: Status LED - Redirecting

Mon Nov 17, 2014 1:33 am

Hi!, to start off I am new in this, I am utilizing all the gpio in the pie, haw can I use the same command in the 23017 chip?

bcm2708.disk_led_gpio=17 bcm2708.disk_led_active_low=0

il_mix
Posts: 7
Joined: Mon Jul 30, 2012 7:07 am

Re: Status LED - Redirecting

Tue Jul 19, 2016 5:46 am

AndrewS wrote:There's an even better way... :D

By editing some kernel parameters through /boot/cmdline.txt you can actually disable the green ACT LED and have it function on a GPIO of your choosing. In my example I just happen to be using GPIO17 but you should obviously change it to whatever GPIO your LED (and current-limiting resistor) is connected to.
  1. sudo nano /boot/cmdline.txt
  2. Keeping it all on one long line, add this to the end: bcm2708.disk_led_gpio=17 bcm2708.disk_led_active_low=0
  3. sudo reboot
  4. Do a happy dance ;)
Discovered by looking at /proc/cmdline on the Compute Module, and by looking at https://github.com/raspberrypi/linux/bl ... /bcm2708.c :ugeek:
As it's using kernel parameters this obviously only works while Linux is actually active, i.e. the multiple flashes you get after doing a "sudo poweroff" actually still flash the green ACT LED and not your 'external' status LED.

If you want to have both activity LEDs active at once, have a look at http://www.raspberrypi.org/forums/viewt ... 33&t=52893 and/or http://www.raspberrypi.org/forums/viewt ... 31&t=46517 (neither of which I've tried).
BUMP this old thread.
I'm interested in having the trigger functionalities on GPIO. This solution looks promising and quite easy to implement and maintain (working on kernel means to recompile everything on kernel updates, that is quite time consuming).
Awfully, I'm not able to let it work... I'm on an RPi3; is there something different that have to be written on /boot/cmdline.txt for this board? I didn't catch any hint from /proc/cmdline

Many thanks!

il_mix
Posts: 7
Joined: Mon Jul 30, 2012 7:07 am

Re: Status LED - Redirecting

Wed Jul 20, 2016 5:33 am

I made some research.
@AndrewS mentioned bcm2708.c file; in this file there is a /* command line parameters */ section that lists the mentioned disk_led_gpio. BTW, on the kernel build readme https://www.raspberrypi.org/documentati ... uilding.md it is mentioned that RPi 3 uses bcm2709 configuration. In bcm2708.c the /* command line parameters */ section just lists boardrev, serial and reboot_part. Maybe this trick can't be done on RPi3? Strange thing is that RPi 2 also uses bcm2709, and given the date of this thread's posts I *suppose* that users was talking about RPi 2.
I'm probably missing something...

pdeschulthess
Posts: 2
Joined: Fri Feb 22, 2013 4:33 pm

Re: Status LED - Redirecting

Mon Oct 17, 2016 11:37 am

I Disagree with the hardware solution.

Sorry to be negative, but the hardware solution is much worse when the pi is embedded inside another box - fiber optics are fine for your custom "pi case" but what about a large scale media center inside a cabinet - I want a light that tells my wife - "Don't pull the plug until this light is off"

I love the low-level software approach - is there a way to mimic this "SD Active" light for an external hard drive? The idea being that my wife doesn't "pull the plug" while the external HD is still mounted either.

Love the work by the way...

il_mix
Posts: 7
Joined: Mon Jul 30, 2012 7:07 am

Re: Status LED - Redirecting

Mon Oct 17, 2016 1:30 pm

Whoa, an update!
@pdeschulthess , I have almost the same problem. I need to warn if it is safe to turn off the system, and I can't use the hardware solution since I'm using an RGB LED, and the 3 colors have different meaning, so I need a dedicated GPIO.
Awfully, still no luck with the sw solution...
If someone have more experience and/or find some documentation about this for RPi3 I'll be really thankful!

dgordon42
Posts: 782
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Status LED - Redirecting

Mon Oct 17, 2016 2:49 pm

@il_mix,
You can redirect the green activity LED signal to any GPIO on the Pi 3B using "dtoverlay=pi3-act-led" in your '/boot/config.txt' file.
The dt parameter for earlier models is "act_led_gpio"
Both are documented in the (long) file '/boot/overlays/README' file on your Pi.

Hope this helps,
Dave.

cpt
Posts: 8
Joined: Mon Oct 17, 2016 2:36 pm

Re: Status LED - Redirecting

Mon Oct 17, 2016 3:35 pm

Hi,

I've tried to add the following to /boot/config.txt:
dtoverlay=act_led_gpio,gpio=26

But my LED shows no indication what so ever.. :(
I have a Rpi B+.. Any ideas on how to troubleshoot?

Thanks

dgordon42
Posts: 782
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Status LED - Redirecting

Mon Oct 17, 2016 4:27 pm

@cpt,
Two things, first - you need to reboot for changes in '/boot/config.txt' to take effect and second - "gpio=26" is physical pin 37 on a B+. See here.

Also, on models before the Pi 3B (like your B+) you should use:

Code: Select all

act_led_gpio=26

in your '/boot/config.txt' file.

Hope this helps,
Dave.

cpt
Posts: 8
Joined: Mon Oct 17, 2016 2:36 pm

Re: Status LED - Redirecting

Tue Oct 18, 2016 1:30 pm

@dgordon42 - thanks, but I'm not sure if I follow.. It does not seem to make any difference...
My /boot/config.txt looks like this now at the end:

Code: Select all

act_led_gpio=26
I removed

Code: Select all

dtoverlay=act_led_gpio,gpio=26
Also, just to make sure, on the

Code: Select all

act_led_gpio=26
should it say 26 or 37?
Attached is an image with a red circle of which gpio pin I've connected my custom led to.

cheers
rpi-gpio-26.jpg
rpi-gpio-26.jpg (42.62 KiB) Viewed 7244 times

cpt
Posts: 8
Joined: Mon Oct 17, 2016 2:36 pm

Re: Status LED - Redirecting

Tue Oct 18, 2016 1:40 pm

I got it working by only having:

Code: Select all

dtparam=act_led_gpio=26
in my /boot/config.txt

dgordon42
Posts: 782
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Status LED - Redirecting

Tue Oct 18, 2016 1:44 pm

dgordon42 wrote:act_led_gpio=26
Sorry, this was incorrect, it should read:

Code: Select all

dtparam=act_led_gpio=26
Edit '/boot/config.txt', and reboot.
This should send the green activity led signal out on Physical Pin 37 which is GPIO 26 in Broadcom's numbering scheme (it's the one you circled in the post above).

Dave.

il_mix
Posts: 7
Joined: Mon Jul 30, 2012 7:07 am

Re: Status LED - Redirecting

Thu Oct 20, 2016 9:37 pm

Thanks @dgordon42 and @cpt !

I've put all the hints together, and now I can control an external LED as activity LED, forcing a given trigger mode at runtime.
I've added this to /boot/config.txt

Code: Select all

dtoverlay=pi3-act-led,gpio=22
dtparam=act_led_trigger=heartbeat
Activity LED is redirected to GPIO 22, and is set to heartbeat during boot.
The LED (actually GPIO 22) can be controlled via /sys/class/leds/led0. More precisely, one can set the trigger mode with command

Code: Select all

echo <desired_mode> | sudo tee /sys/class/leds/led0/trigger >/dev/null
where desired_mode can be anything listed by

Code: Select all

cat /sys/class/leds/led0/trigger
(current mode is the one between [ ] brackets).
In my application, LED is in heartbeat mode during boot, thanks to /boot/config.txt setting. Than a startup program (e.g. /etc/rc.local) set it to default-on (steady on). When I press the reset/shutdown button I've added to the system, the script that controls the reset/shutdown pin will set the LED to heartbeat again, to inform the user the system is rebooting/shutting down.

That's exactly what I was trying to achieve! ;)

cpt
Posts: 8
Joined: Mon Oct 17, 2016 2:36 pm

Re: Status LED - Redirecting

Fri Oct 21, 2016 4:45 am

Awesome!!

Killertechno
Posts: 195
Joined: Wed Jan 02, 2013 8:28 am

Re: Status LED - Redirecting

Tue Feb 20, 2018 3:26 pm

Hi to all.
Is this code for re-directing heartbeat from led to gpio.... or also to "clone" heartbeat?
On Raspberry B+ v1.2 with stretch lite image (2017-11-29) I set config.txt as follows:

Code: Select all

dtoverlay=pi3-act-led,gpio=18
dtparam=act_led_trigger=heartbeat
And now I have heartbeat on GPIO18.
Green led (act) is always off, but I would like to have heartbeat on BOTH green led and GPIO18.
Taking a look to sysfs code, I can see led0 is already set to "heartbeat", so I suppose heartbeat has moved from led GPIO to GPIO18.
How can I duplicate heartbeat?
Thanks.

boyoh
Posts: 1413
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Status LED - Redirecting

Wed Feb 21, 2018 9:13 am

I might be wrong with this Idea , A short light pipe with a photo transistor in the end of the pipe
A simple circuit switching a remote LED , using the 3.3vrail for power,
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

boyoh
Posts: 1413
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Status LED - Redirecting

Thu Feb 22, 2018 10:47 am

boyoh wrote:
Wed Feb 21, 2018 9:13 am
I might be wrong with this Idea , A short light pipe with a photo transistor in the end of the pipe
A simple circuit switching a remote LED , using the 3.3vrail for power,
Might work might not Give it a try You research parts
Attachments
remotw led.jpg
remotw led.jpg (46.21 KiB) Viewed 4732 times
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

Return to “Beginners”