chteuchteu
Posts: 22
Joined: Mon Oct 08, 2012 11:38 am

CPU load monitoring using GPIO and leds

Fri Oct 26, 2012 7:32 am

Hello !
I wrote today an article on my blog about CPU load monitoring (using GPIO and leds) on Raspberry's. It is really simple (written in a little shell script), but I think it can be useful (for people who want to learn leds stuff on their R. Pi)

There are 5 leds turning on and off regarding the CPU load:
- CPU < 20%: 1 led
- CPU < 40%: 2 leds
- CPU < 60%: 3 leds
- CPU < 80%: 4 leds
- CPU < 90%: 5/5 leds
- CPU >= 90%: 5 leds flashing

Here is the article: it is written in French, but you can just watch the Youtube video and download the code at the bottom of the article.
http://www.chteuchteu.com/2012/10/26/ra ... e-au-gpio/

If you find any errors in the code, you can post a comment on the article. Thanks ! :)
Articles à propos du Raspberry Pi sur mon blog: http://www.chteuchteu.com/tag/raspberry-pi/

chteuchteu
Posts: 22
Joined: Mon Oct 08, 2012 11:38 am

Re: CPU load monitoring using GPIO and leds

Mon Oct 29, 2012 11:54 am

Up :)
Any code enhancements ?
Articles à propos du Raspberry Pi sur mon blog: http://www.chteuchteu.com/tag/raspberry-pi/

bgirardot
Posts: 517
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland

Re: CPU load monitoring using GPIO and leds

Fri Nov 02, 2012 2:20 pm

My only comment is: Thank you very much, I found the code to be educational. I like doing things from shell scripts and found your approach far superior to my current approach.

chteuchteu
Posts: 22
Joined: Mon Oct 08, 2012 11:38 am

Re: CPU load monitoring using GPIO and leds

Mon Nov 05, 2012 8:02 am

bgirardot wrote:My only comment is: Thank you very much, I found the code to be educational. I like doing things from shell scripts and found your approach far superior to my current approach.
Thank you ! :)

The article is now available in english ! (comments are also in english):
http://www.chteuchteu.com/2012/11/05/ra ... sing-gpio/
Articles à propos du Raspberry Pi sur mon blog: http://www.chteuchteu.com/tag/raspberry-pi/

jagoda
Posts: 40
Joined: Fri Nov 02, 2012 8:46 am

Re: CPU load monitoring using GPIO and leds

Mon Nov 05, 2012 8:43 am

Thank you for your article ...
I will try and incorporate it and expand on it in the various RaspberryPi workshops and courses I am
involved in developing
(http://ftt/co.uk)
(http://www.absolutebeginners.uk.com)

chteuchteu
Posts: 22
Joined: Mon Oct 08, 2012 11:38 am

Re: CPU load monitoring using GPIO and leds

Wed Mar 06, 2013 7:05 pm

Thanks ! :D
Articles à propos du Raspberry Pi sur mon blog: http://www.chteuchteu.com/tag/raspberry-pi/

gridrun
Posts: 46
Joined: Mon Feb 18, 2013 12:26 pm
Contact: Website

Re: CPU load monitoring using GPIO and leds

Fri Mar 08, 2013 9:22 pm

Yeah! Blinkenlights! :D Reminds me of the BeBox, pretty cool.
Find more info on Raspberry Pi, Virtualization and all things cloudy on my blog: http://niston.wordpress.com

User avatar
MattHawkinsUK
Posts: 538
Joined: Tue Jan 10, 2012 8:48 pm
Location: UK
Contact: Website

Re: CPU load monitoring using GPIO and leds

Fri Mar 08, 2013 10:50 pm

The script is great. I'm modifying it to work with my BerryClip 6 LED board.

One thing I noticed is that the script does not flash the LEDs. The function is defined to flash the LEDs but it is not referred to in the script.
My Raspberry Pi blog and home of the BerryClip Add-on board : http://www.raspberrypi-spy.co.uk/
Follow me on Google+, Facebook, Pinterest and Twitter (@RPiSpy)

chteuchteu
Posts: 22
Joined: Mon Oct 08, 2012 11:38 am

Re: CPU load monitoring using GPIO and leds

Sat Mar 09, 2013 10:36 am

Thanks for the reply ! :)
Yes indeed. It is a function I written but I'm not really using it in the main part of the script: I left it in the code in case of someone would use it :)
Articles à propos du Raspberry Pi sur mon blog: http://www.chteuchteu.com/tag/raspberry-pi/

pyrater
Posts: 7
Joined: Mon Feb 15, 2016 7:58 pm

Re: CPU load monitoring using GPIO and leds

Sun Mar 20, 2016 12:38 am

Do you still have the 5 led version?

Return to “Networking and servers”