LED Bargraph chip (guitar LED bling-age) ..do with a PIC?


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Yes, it could be done... but simplest solution probably requires a little compromise...

    First pick a PIC which is more suitable... say a 18F2420... I select this because it has a heap of I/O's and ADC as well. It also has an internal Oscillator so no Xtal or Resonator. Each LED is connected to TWO I/O's through two Resistors. The LED Anode is connected to Vdd, and the Kathode is connected twice... once via one Resistor to one I/O, and a second time via a second Resistor to a second I/O. This arrangement means that with your input into RA0/AN0, you can have eleven LED's connected. Chose a high intensity LED (say with 1300mcd or greater), this means that you can have a decent light output without overloading the PIC when all LEDs are illuminated.

    You now have FOUR states for each LED...

    OFF = Both I/O's HIGH.

    LOW BRIGHTNESS = First I/O is LOW, Second I/O is HIGH (Current flows through R1 - eg 820R).

    MED BRIGHTNESS = First I/O is HIGH, Second I/O is LOW (Current flows through R2 - eg 560R).

    HIGH BRIGHTNESS = Both I/O's are LOW (Current flow is through both R1 and R2).

    The actual Resistor values you will have to chose through experimentation... I just threw those in as a 'best guess'.

    This way you have a two-bit digital fadeout (easilly accomplished through software).

    If you wish to save a few mA/mW, then HIGH means the PIC pin is in INPUT mode. LOW means it is OUTPUT LOW.

    You take say an ADC sample every 500mS. This is your program 'cycle'. Your fade will take four cycles - namely two seconds. If you increase your cycle period, then your fade-out will be quicker. Depending on your ADC Input (max span), your LED's will be illuminated accordingly. At the next cycle, if the ADC value is lower, then the upper LED's are switched into the next level of brightness lower... and so on... simple really...

    Each LED is represented as a BYTE in an Array. The BYTE value is between 0 and 3, where 0 is both I/O's for that LED HIGH (LED OFF), and 3 is both I/O's LOW (LED max ON). The good thing is that you can probably feed your (low-level) Audio straight in with a minimum of components, because if say you only have 100mV peak/peak to play with, then you just set your math for ADC span accordingly. Your span (LED switching) range is in software, your Sample & Hold is in software and your fade is in software... what more do you want?

    Never mind about LOG, LIN, 3DB points etc etc... this is a light show - not a studio reference instrument!

    Cost less than US$10 and an hour of coding.

  2. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    Yes, it could be done... but simplest solution probably requires a little compromise...

    First pick a PIC which is more suitable... say a 18F2420... I select this because it has a heap of I/O's and ADC as well. It also has an internal Oscillator so no Xtal or Resonator. Each LED is connected to TWO I/O's through two Resistors. The LED Anode is connected to Vdd, and the Kathode is connected twice... once via one Resistor to one I/O, and a second time via a second Resistor to a second I/O. This arrangement means that with your input into RA0/AN0, you can have eleven LED's connected. Chose a high intensity LED (say with 1300mcd or greater), this means that you can have a decent light output without overloading the PIC when all LEDs are illuminated.

    You now have FOUR states for each LED...

    OFF = Both I/O's HIGH.

    LOW BRIGHTNESS = First I/O is LOW, Second I/O is HIGH (Current flows through R1 - eg 820R).

    MED BRIGHTNESS = First I/O is HIGH, Second I/O is LOW (Current flows through R2 - eg 560R).

    HIGH BRIGHTNESS = Both I/O's are LOW (Current flow is through both R1 and R2).

    The actual Resistor values you will have to chose through experimentation... I just threw those in as a 'best guess'.

    This way you have a two-bit digital fadeout (easilly accomplished through software).

    If you wish to save a few mA/mW, then HIGH means the PIC pin is in INPUT mode. LOW means it is OUTPUT LOW.

    You take say an ADC sample every 500mS. This is your program 'cycle'. Your fade will take four cycles - namely two seconds. If you increase your cycle period, then your fade-out will be quicker. Depending on your ADC Input (max span), your LED's will be illuminated accordingly. At the next cycle, if the ADC value is lower, then the upper LED's are switched into the next level of brightness lower... and so on... simple really...

    Each LED is represented as a BYTE in an Array. The BYTE value is between 0 and 3, where 0 is both I/O's for that LED HIGH (LED OFF), and 3 is both I/O's LOW (LED max ON). The good thing is that you can probably feed your (low-level) Audio straight in with a minimum of components, because if say you only have 100mV peak/peak to play with, then you just set your math for ADC span accordingly. Your span (LED switching) range is in software, your Sample & Hold is in software and your fade is in software... what more do you want?

    Never mind about LOG, LIN, 3DB points etc etc... this is a light show - not a studio reference instrument!

    Cost less than US$10 and an hour of coding.
    Many thanks Melanie...grasped the concept, but just need to work out the actualy resistor interconnectivity (I'm sure you explained it well, but I'm slow on the uptake!)

    Re Toneman's query about where are the LEDs are physically going to go...well, I just knocked together a bobbin 'top' tonight & inserted the LEDs loosely (they look clear, they're actually the bright ultra blue variety)...



    (it's just a rough 'proof of concept' cut at the moment' ...obviously magnetic pole pieces will fill those empty holes above the LEDs & then a coil will be wound around the whole bobbin - the middle piece, & bottom pice need making up too))
    Last edited by HankMcSpank; - 12th July 2009 at 23:19.

Similar Threads

  1. Calulating BJT base resistance for PIC led switching?
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 20th November 2008, 08:41
  2. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 20:19
  3. Camera with PIC chip
    By The Master in forum Off Topic
    Replies: 5
    Last Post: - 1st July 2008, 14:28
  4. PIC chip resetting. Very weird
    By The Master in forum Off Topic
    Replies: 0
    Last Post: - 28th October 2007, 17:07
  5. Help on coding/ selecting PIC chip for project
    By lovemeok in forum General
    Replies: 0
    Last Post: - 27th July 2006, 19:21

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts