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.
One afternoon, I was looking for a simple microcontroller project I could whip-up just for fun. I knew that I would soon be ordering a new computer case, so I figured that I might as well create some kind of display to enhance the appearance and/or functionality of the new case. But what to improve?
I settled on the hard drive LED. On all computer cases I’ve seen, 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. For years, I’ve had a Radio Shack 10 segment LED bargraph floating around in my parts box, since I’m a nerd, I naturally love blinking LEDs (das blinkenlights), so the LED bargraph HD light idea was born!
I reached for my trusty Microchip PicStart Plus programmer, a perfboard, some wire, and got to work!
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.
Here, you can see the prototype with the LED unit soldered to the perfboard. There is a power and ground (the white wires) and the connection to the motherboard LED output (red and black). I know – those coloring schemes for the wires are messed-up, but the red/black wire was cannibalized from an old case since it already had the pin header on it.
Now that I had the project fine-tuned the way I wanted, it was time to install it in my new aluminum case. I carefully used a nibbler to create the rectangular hole for the bargraph to emerge through. I desoldered the bargraph from the board and used another piece of perfboard to make a landing board for the LEDs and a ribbon cable which connects the control board to the display. This display board was carefully mounted on the backside of the aluminum faceplate so that the front of the LEDs are flush with the front of the case. Doing this cutting on my new case (the most expensive case I’ve ever bought) made me very nervous, but it turned-out good.
Connecting the two boards was easy with a piece of spare ribbon cable. I spooged both ends with some hot-melt glue to prevent the thin wires from getting flexed at the board. The ribbon cable comes-out right next to the floppy drive cage, which is removeable and makes it very easy to get the project out if needed. The PIC microcontroller has enough drive capacity that direct driving the LEDs across the ribbon cable provided no issue whatsoever. I wrapped the power connection in some black plastic loom to make it look better. There is a standard large floppy power connector on the other end for easy connection to the system’s power supply.
I did not bother with in-circuit programming, so should I ever want to adjust anything, I’ll have to pop the chip out of the socket and into the PicStart Plus to re-program, but I don’t expect that I’ll ever have to adjust anything as I’m quite happy with the effect of the pulsing bargraph.
Using the PIC PIC16C84 microcontroller made this project very simple, as PICs often do. With only 35 instructions (typically), they are powerful, easy to learn, cheap, and above all, useful. JAL was a breeze to learn and use, at least in the context of this project. Overall, I’m very pleased with the outcome. If I had it to do over again, I might try using a FPGA (Xilinx or Altera probably) as I’ve been wanting a project to learn gate arrays. However, since this one is complete, the FPGA learning will have to wait for the next surge of motivation and creativity!
Oh yeah – you were hoping for a video, huh? 😉
Bargraph HD LED video
And finally, a short video showing the bargraph in action! It’s in Xvid format so you’ll need the appropriate decoders.
I dug-up the Microcontroller LED hard drive light source code. Please see the README.txt file for a little info.