View: 17028|Reply: 8

LED SD Card indicator

[Copy link]

3

threads

10

posts

62

credits

Registered member

Rank: 2

credits
62
QQ
Published in 2016-7-30 03:46:51 | Show all floors |Read mode
Hello guys.
the fact is, in armbian LED indicators on the board are useless somehow !
in mine red LED won't turn on and green LED blinks and stays on, so i made a use from them
i will write here how to make red LED like SD Card indicator LED so at SD Card activities LED would blink (Like green LED in Raspberry Pi)
i did try to do this for green LED, it worked but when i put the code in startup it didn't affected the green LED and it only worked for red LED. so in this guid we will use green LED as ON/OFF status of device and red LED as SD Card activty indicator.

1- Open terminal and login with root user or use this command to login as root
  1. su
Copy code
2- Type this command to open rc.local with nano text editor
  1. nano /etc/rc.local
Copy code
3- add this before exit 0
  1. echo none >/sys/class/leds/red_led/trigger
  2. echo mmc0 >/sys/class/leds/red_led/trigger
  3. echo 1 >/sys/class/leds/green_led/brightness
Copy code
4- then press Ctrl + X then Y
5- It's Done ! Reboot now to test how this works
  1. reboot
Copy code
Enjoy.


www.m3ni.com [url=http://www.orangepi.org/orang

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2016-7-30 06:25:38 | Show all floors
I got an idea in your post.
I made the script which checks a package update.

1.Change in /etc/sudoers
$ sudo visudo

The following 1 line is added to the end.

orangepi ALL=(ALL) NOPASSWD: ALL

2.Create this script(pkg_checker.sh) in $HOME

  1. #!/bin/bash
  2. sudo apt-get -s upgrade > /tmp/apt.log
  3. #grep -c "The following packages will be upgraded" /tmp/apt.log
  4. check=`grep -c "The following packages will be upgraded" /tmp/apt.log`
  5. #echo $check
  6. rm /tmp/apt.log
  7. if [ $check -ne 0 ] ; then
  8. # Update package EXIST
  9.   sudo sh -c "echo 0 > /sys/class/leds/red_led/brightness"
  10.   sudo sh -c "echo heartbeat > /sys/class/leds/red_led/trigger"
  11.   sudo sh -c "echo 1 > /sys/class/leds/red_led/brightness"
  12. else
  13. # Update package NOT EXIST
  14.   sudo sh -c "echo none > /sys/class/leds/red_led/trigger"
  15.   sudo sh -c "echo 0 > /sys/class/leds/red_led/brightness"
  16. fi
Copy code

3.Add execute permission to this script.
chmod 777 pkg_checker.sh

4.Execute this script.
If there is update package,RED-LED become blink.

5.Add crontab
0 * * * * /home/orangepi/pkg_checker.sh




3

threads

10

posts

62

credits

Registered member

Rank: 2

credits
62
QQ
 Author| Published in 2016-7-30 18:37:59 from mobile | Show all floors
Thanks! I will test it on my pi when i got home, also could you manage to make green LED blink for sd card activity? When i attempted to do that on startup it would just get stock and would be on. Not blinking. I think we have to find the original command in armbian to disable the "heartbeat" trigger for it that starts at startup, unfortunately i didn't found it

1

threads

5

posts

92

credits

Registered member

Rank: 2

credits
92
Published in 2016-11-23 06:03:18 | Show all floors
Actually M3NI I had fixed that already, if you run your program at that boot level if you pay attention, actually works... But! After it continues booting (I don't know why or when honestly) the system itself changes it function for it default (Default-ON), so the solution is to start the green LED just when your start your GUI, any of them, so my solution is (if you are using xserver ofcourse).
- Test you have all x servers dependencies (you must try a "startx" command into a terminal and it should open your GUI.
- At your home direction (usually in armbian is /home/pi/) check your .xinitrc file and if you don't have it create it
- Edit that text starting your graphical interface and sending the GREEN LED FUNCTION together.

FOR EXAMPLE if you are starting XFCE4
  1. exec echo heartbeat >/sys/class/leds/green_led/trigger &
  2. exec startxfce4
Copy code

if your xserver goes to that file for your personal configuration, and you are using Orange Pi's defauilt GUI, xfce4, it should start your graphical interface AND start beating your led, obviously you should use any function you want there.

Cheers!

3

threads

20

posts

163

credits

Registered member

Rank: 2

credits
163
Published in 2017-8-16 09:00:32 | Show all floors
Could the original script of blinking red on SDCard access have the same problem?  It is in my /etc/rc.local but it never seems to work.  Should I maybe put it in one of the rcn.d directories?  Oh wait all those are 777 and rc.local is 755.  Maybe I should chmod 777 rc.local.  I'll give that a try.

I know it should work somehow becuase if I SU then execute the two echo statements the LED starts working as defined.

5

threads

11

posts

341

credits

Intermediate member

Rank: 3Rank: 3

credits
341
Published in 2017-8-22 04:12:46 | Show all floors
Very nice, i used it :-)

2

threads

10

posts

150

credits

Registered member

Rank: 2

credits
150
Published in 2017-12-15 15:08:01 | Show all floors
How to blink red led when access USB SSD ?

0

threads

51

posts

148

credits

Registered member

Rank: 2

credits
148
Published in 2024-3-13 14:45:07 | Show all floors
Forums I've read say that the has fun and interesting ideas for people to find. nytimes crossword

16

threads

227

posts

898

credits

Senior member

Rank: 4

credits
898
Published in 2024-6-8 15:56:26 | Show all floors
This post was finally edited by HOlson012 at 2024-7-24 19:00

The SightLED holographic transparent LED display is revolutionizing visual technology by offering a captivating blend of transparency and high-definition imagery. This innovative display allows content to appear as if it's floating in mid-air, providing an immersive experience without obstructing the view behind it. Ideal for advertising, exhibitions, and interactive applications, the SightLED display merges functionality with aesthetic appeal. Its transparent nature ensures that it seamlessly integrates into any environment while delivering vivid, eye-catching visuals that engage and captivate audiences in new and exciting ways.
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list