Shop OBEX P1 Docs P2 Docs Learn Events
newbie led question — Parallax Forums

newbie led question

Tracy BrownTracy Brown Posts: 3
edited 2008-10-31 21:27 in BASIC Stamp
I think this is pretty simple for people experienced in electronics, but hey, you gotta start somewhere.

I was wondering if someone could show me the math required to calculate the resistor required to light a single led from a bs2 pin.
The led is a typical red radio shack model with 2.4V (max), ·20mA (max).

This is what I have so far:

Guessing I need a 470ohm resitor, I calculate the current like so:

I=V/R
I=5v/470
I=10.6ma

Using only one resistor, the best I can figure from the info I've found so far,·I calculate the voltage drop like so:

V=I*R
V=.0106*470
V=4.98

If the voltage drop calculation is correct, then there is no voltage left to light the led.

My theory is that the led does have some resistance (what it is I don't know), and therefore you would look at the circuit as though you have two resistors in series and calculate the voltage drop as such.· I am guessing that if you plug-in the resistance of the led into the equation, the voltage drop would be +-3V.

Could someone tell me how close I am,·or better yet, show me how they would calculate the required resistance?

Thanks,
Tracy

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-10-31 18:39
    LED_current = (V_output - V_LED) / series_resistor

    LED_current = (5V - 2V) / series_resistor

    LED_current = 3V / series_resistor

    LED_current = 3V / 470Ω

    LED_current = 6mA
  • Computer Geek 101Computer Geek 101 Posts: 179
    edited 2008-10-31 18:39
    ok you need 2.4V to light the LED so you need to drop 5V-2.4V = 2.6v
    you need to drop 2.6v with a resistor

    v = I * R
    2.6v = 0.02A * R

    2.6v / 0.02A = R

    130 ohms = R


    hope this helps.
  • Tracy BrownTracy Brown Posts: 3
    edited 2008-10-31 18:50
    Thanks for the responses guys. I am glad to see there are people willing to help a newbie like myself with such a simple question.

    Stayed tuned.....I am sure more interesting questions will follow!

    Thanks again,
    Tracy
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-10-31 19:05
    Well, Computer Geek 101 has it a little off. The "20 mA" is a MAXIMUM before the LED burns out. You don't want to work there. Probaby, 12 mA is sufficient for full brightness.

    The 2.4 Volts is a consistent voltage drop across the LED when it's "On" and conducting, and is true for a range of currents (10 mA to 20 mA or so).

    So, the equation becomes:

    V = I * R. Now we subtract out the voltage the LED will be dropping. This means the voltage/current equation across the resistor will be:

    (5 - 2.4)/ I == R. Or 2.6/I == R, or if I == 12 mA, 2.6/0.012 == 216 Ohms. 220 ohms is a typical value to use, making 2.6/220 ohms == 11.8 mA, which is still plenty.
  • Tracy BrownTracy Brown Posts: 3
    edited 2008-10-31 20:15
    Allan,

    I had noticed that problem with Computer Geek's response, but the "process" that is used is what I was looking for. Thanks for your response as well, as it does explain to me exactly what I need.

    It's kinda funny that you can find numerous examples of more complicated circuits on the internet and in other documentation, but it seems that everyone has forgot to explain how to take the first step. I am positive there is an example somewhere that shows how to light an led and how to select the proper components, but I couldn't find it.

    The parallax board that I have already has the leds and resistors built-in. This is great for experimenting with code, but it doesn't explain how to select components "off the shelf". That said, I know that is not it's purpose.

    Sorry, I got a little off topic.

    Thanks again guys!
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-10-31 21:27
    Tracy Brown said...
    Sorry, I got a little off topic.

    Don't be. There are plenty of us newbies lurking here who learn a lot from questions like this. Great answers too.
Sign In or Register to comment.