Home     Contact     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS     Terms of services     Privacy policy  
 Home      Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science   

HDD LED SpindicatorAuthor
Giorgos Lazaridis
March 22, 2012

The circuit on a breadboard for test
The idea for this project came from Viktor's site, a guy that has some interesting projects in his DIY subdirectory. He cloned a HDD spindicator with 10 LEDs driven from a 4017 chip. I liked the idea but the implementation was kinda... sterilized. So, i decided to make one for my PC, but spice it up with PWM control...

The problem is that...
No, it is not a problem, it is the way that someone faces a problem. What i mean is that, the PICs that i use have only 4 PWM outputs. I could buy some others with 12 PWM outputs, but this is not the way i faced this problem. I could also use an I/O expander with PWM control, but this is definitely not the way i face problems. Instead, i chose to implement software PWM for the 12 LEDs that i will use.

The only thing that the PIC will do is this: control the LEDs. An asynchronous edge-triggered interrupt will be generated whenever a pulse is detected from the HDD LED output of the motherboard, and this will be the only (short) routine that will run except the PWM routine. So the implementation was not that hard. As a matter of fact, i think that any other solution such as an external driver chip or a more expensive PIC with more PWM outputs would be somewhat an overkill...

The Circuit
The circuit is very simple:

Click to enlarge

The optocoupler and the PIC
Here is how it works. First of all, the HDD LED output of the motherboard is connected to the bi-directional LED of the optocoupler (IC2). I chose a bi-directional optocoupler so that the polarity that the LED is connected wont matter at all. A friend of mine (Hercules, AKA Herctrap) gave me an H11AA1 from Vishay which works just perfect.

The outputs RC4-RC7 and RD0-RD7 drive the 12 LEDs of the spindicator. A small resistor is used to limit the current of the LEDs. Since i use a PIC 16LF, these outputs have 3.3 volts, so the resistors i use are rather small. The other LED driven from the output RC3 indicates the HDD operation. You may wanna use this output for a center 10mm LED which flashes every time a pulse is detected from the software.

Remember that the PIC i use is an LF series and has maximum VDD of 3.6 volts. Order the 16F1937 PIC instead if you wan to power it from the 5V supply.

The software

Here are the assembly listing files if you wish to change the program and recompile it:
Download file
Spindicator - Assembly listing files - Ver 1.0

And here is the Hex file that you can directly upload to your PIC without compilation;
Download file
Spindicator - Hex file - Ver 1.0

You will find some constants in the assembly listing that you can play with and have different effects of the spindicator:

  • GLPWMDecrease: This is the number of steps that the PWM value of the LEDs is decreased in each cycle. Bigger number means faster fade-out.

  • GLPWMDecreaseSlow: When no pulse is detected, the LEDs fade out untill they are all turned off completely. This is the number of steps that the PWM value of the LEDs is decreased in each cycle. Bigger number means faster fade-out.

  • GLPWMDelay: Between each PWM cycle, there is a delay. This number is the cycle repetitions of the delay. Bigger number means bigger interval.

  • GLPulse_Interval: The circuit detects pulse inputs form the HDD LED output. To avoid funny results when the HDD runs very fast, there is an interval. The bigger the number that this parameter has, the slower the LEDs will revolve.

  • GL_PWM_Startup: Since there is almost no difference for high PWM duty cycles, the LEDs can light with not 100% duty cycle and thus achieve a more natural fading tail effect. Keep in mind that this parameter is reversed - bigger number means less duty cycle. The maximum duty cycle can be 0x01. Do not use 0x00 for this parameter, because the counter will overflow.

  • GL_LED_Num: The number of LEDs that you want to control. Max number is 12.

  • Bill Of Materials [BOM]
    R1Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R2Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R3Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R4Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R5Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R6Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R7Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R8Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R9Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R10Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R11Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R12Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R13Resistor 58 Ohm 1/4 Watt 5% Carbon Film
    R14Resistor 220 Ohm 1/4 Watt 5% Carbon Film 
    C1Electrolytic Capacitor 1 uF 50 Volts
    IC1PIC 16LF1939 Microcontroller 
    IC2H11AA1 AC Input Transstor Output Optoisolator 

    For the LEDs, any type of LED with max forward voltage (Vf) of 3.6V and max forward current (If) of 20mA is acceptable. If you do not really know how to calculate the limiting resistors for the LEDs, then you may wanna read the LED driving and controlling theory.

       Continue reading. Click here to view the references.



      Email (shall not be published)


    Notify me of new posts via email

    Write your comments below:
    BEFORE you post a comment:You are welcome to comment for corrections and suggestions on this page. But if you have questions please use the forum instead to post it. Thank you.


  • At 20 September 2013, 5:23:10 user harsha patel wrote:   [reply @ harsha patel]
    • really helpful to improve my knowledge.........

  • At 13 April 2013, 16:56:46 user cibil wrote:   [reply @ cibil]
    • its very nice .. what is the pic price in rupees

  • At 14 June 2012, 18:15:06 user herctrap wrote:   [reply @ herctrap]
    • http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Components/LED/Top-Up%20LED%20Ring%20LED-CCL-A.pdf

  • At 30 March 2012, 20:00:09 user Thanassis wrote:   [reply @ Thanassis]
    • Nice project!

  • At 22 March 2012, 21:10:17 user Viktor wrote:   [reply @ Viktor]
    • Good job! I always like a hack of another hack taken a step further!

    reddit this Reddit this

     HOT in heaven!

    NEW in heaven!

    New Theory: AC electric motor working principle

     Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS   

    Site design: Giorgos Lazaridis
    © Copyright 2008
    Please read the Terms of services and the Privacy policy