Browse over 10,000 Electronics Projects

Homebrew microcontroller based hard drive LED bar graph

Homebrew microcontroller based hard drive LED bar graph

The HD LED is just a single, boring light. Yeah, maybe it comes in blue or purple on your fancier cases, but it’s still just a boring light. I wanted something a bit more flashy and dynamic. So the LED bargraph HD light idea was born!
This is a PIC microcontroller project I did some time ago which turns my computer’s hard drive LED into a more interesting 10 LED bargraph display.

I first got the LED unit, socket for the PIC16C84, and basic wiring done on the perfboard. The clock is provided by a 4MHz ceramic resonator and for good measure, I put an opto isolator on the input from the motherboard LED connector. I figured that the optoisolator would present a similar load to the mobo’s drive circuit since it’s just a very small LED in essence.

Next, I started to work on the software. I normally do most of my microcontroller work in the native PIC assembler, but this seemed like a good project to try a compiled language since the project is not timing critical. The compiled language let me not worry about counting higher than 255 or messing with multiple registers to assemble long delays. I had been hearing some good talk about JAL (Just Another Language) which targets these lower to mid-range PIC devices, so I figured I’d give it a try. It’s a GPL project and is free.


JAL was very easy to use, especially for this simple project. It made working on the timings of the lights very easy, which was important as the speed of the rise and decay of the LEDs is critical for the finished result to look cool. The code is basically an accumulator type setup where the HD signal from the mobo is polled and if it’s on, a number is added to the internal counter. If it’s off, a number is subtracted. In between polling, that counter value is divided to determine how many LEDs on the bargraph to light.

I had to do a bit of tweaking for aesthetics, such as making the first LED very “sensitive” (it lights immediately) so that you can see the minor blips that are common under a modern operating system. I also made the 10th LED very fast to turn-off or else the display would appear to lag since it is pretty common for the indicator to peg at LED 10 and decrementing the counter like the other LEDs would take too long.

Visit Here for more.