Shop OBEX P1 Docs P2 Docs Learn Events
9 LED Resistor Value — Parallax Forums

9 LED Resistor Value

CharosCharos Posts: 7
edited 2008-07-23 18:18 in BASIC Stamp
All,

Attached is the basic schematic for an automotive project my son and I are doing this summer. We are using the 'Homework' BS2 board.

The first part of our project is to measure and control a go-kart engine.

In any case, the design uses 9 LEDs, and I don't want to draw too much current. It is OK if they are not very bright.

Question: What is a resistor value for the 9 LEDs that would not harm the chip? This is R3 in the attached schematic? Is there a calculator for such things? I am a novice with electronicc circuits.

Thanks!

- Bill
575 x 470 - 74K

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-07-23 03:14
    It depends on the forward voltage of the LEDs, which will be in the spec sheet. Assuming a modest current of 10ma per LED, the formula for the resistance is:

    ·····R = (5 - Vfwd) / .010

    With a forward voltage of 1.75V, the appropriate resistor would be 330 ohms.

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-23 03:27
    The HomeWork Board uses a PIC16C57 microcontroller and you can reference that chip's datasheet to see exactly what the limits are on current. Generally it depends on how many LEDs can be on at a time. In your case, you have 6 on one group of 8 pins and 3 on a second group. I believe the limit per group is 50mA and the limit on any one pin is 20mA. The overall current drain of the entire BS2 chip is 100mA. Assuming all the LEDs might be on at the same time, I'd limit the current to 5 to 8mA per LED. If you choose 5mA to "play it safe", that would be a resistance of 5V - 1.7V = 3.3V / 0.005A = 660 Ohms. 680 Ohms is the nearest standard value. This would be for red LEDs where the forward voltage (Vf) is 1.7V. For other color LEDs, the forward voltage is higher and can be found on the datasheets for the LEDs. Often green and yellow have a forward voltage closer to 2.1V, sometimes higher.
  • CharosCharos Posts: 7
    edited 2008-07-23 03:28
    Please note that ground connection is missing a jumper on the right side.

    Thanks.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-07-23 05:26
    Mike,

    Thanks for the correction. I hadn't factored in the PIC's total rated load current. (I'm so used to driving LEDs at 20mA that 10mA seemed paltry!)

    Bill,

    If you're mixing similar green and red LEDs, you will probably need to drive the green ones a little harder than the red ones, if you want them to appear equally bright. (I don't use yellow ones often enough to remember where they generally fall brightness-wise.)

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • CharosCharos Posts: 7
    edited 2008-07-23 13:09
    As I mentioned, I am a novice with electronics. What does "drive the green ones a little harder than the red ones" mean? Should I yell at the to work harder?

    Why are there two formulas to solve the same problem?

    R = (5 - Vfwd) / .010 ...the appropriate resistor would be 330 ohms

    5V - 1.7V = 3.3V / 0.005A = 660 Ohms

    Why twice the resistance vs the other formula?

    Thanks!
  • Chuck ThomasChuck Thomas Posts: 39
    edited 2008-07-23 14:37
    You changed the current from .010 to .005. You are using half the current so the resistance will double. Ohms law E=I*R.

    LED formula: (Voltage in - LED voltage)/ LED current. As stated earlier the datasheet will provide LED Voltage and LED Current.

    Chuck
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-07-23 14:48
    I think this sort of thing is the reason they make "Darlington Driver" chips...
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-07-23 15:01
    Bill,

    Sorry: "drive harder" means "provide more current" (using a smaller resistor).

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • CharosCharos Posts: 7
    edited 2008-07-23 15:57
    You guys are da bomb! Thanks a million times for your help!

    - Bill
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2008-07-23 16:48
    Take a look at this link

    http://www.parallax.com/Store/Components/IntegratedCircuits/InterfacingChips/tabid/613/CategoryID/78/List/0/SortField/0/Level/a/ProductID/211/Default.aspx



    ULN2803A Darlington Array


    Downloads:
    N&V column "Silicon Steroids for the Stamp" #6 (.pdf)



    ·allanlane5

    I think this sort of thing is the reason they make "Darlington Driver" chips...

    I second this it would make thing a lot easier on you

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-07-23 17:26
    People often overlook the fact that the microcontroller is not really meant to be a power source. It is intended to provide the controlling pulse.
    The specification sheet has limits of power to each pin and each one byte port as a whole. If you go over those, the output stages burn up.
    Buffer/Driver chips were made exactly for this application as they draw merely 1ma.

    In many cases, with all the pins involved, the output pulses are limited to 1ma or 2ma. This can be done with a transistor [noparse][[/noparse]like the 2n2222] or driver ICs that output much more power to each·of its own·output·pins than was input. 1ma in can easily become 30ma out if needed.· Essentially these are just tiny power amplifiers.

    If you are using all the pins for output, it is indeed better to have a 'driver' chip provide the power to the LEDs. But you don't need to use a specialized Darlington transistor arrangement, there are simple driver chips that maintain the 5 volt output with more millamps of power. Some invert and some do not. The 74ls06 aand 74ls07 might be appropriate.

    Are these LEDs going to blink or stay steadily on? I have used 680 ohms on some blinking LEDS and couldn't see anything. You can use a 74ls07 and 220-330 ohms for good visibility. Save the UNL2308 for places where you need to jump to a higher voltage - like a 12volt relay coil or a stepper motor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's sunny and warm here. It is always sunny and warm here.... (unless a typhoon blows through).

    Tropically, G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan

    Post Edited (Kramer) : 7/23/2008 6:01:20 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-07-23 17:38
    Sure, but with the ULN2803 you get *8* high-current outputs in a single DIP package, with NO danger of over-loading your BS2. You'll still need current limiting resistors on the outputs, though -- which you can get with a single Resistor SIP package.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-07-23 18:01
    Since he has 9 LEDs, the 74ls07 chips are cheaper. Eight falls short, just like six.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's sunny and warm here. It is always sunny and warm here.... (unless a typhoon blows through).

    Tropically, G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
  • ercoerco Posts: 20,256
    edited 2008-07-23 18:18
    Don't forget that the homework board already has 220 ohm resistors hardwired on the board. So an LED that requires 1.7 volts can be used directly without any extra resistors at all, for 15 mA current. IF you only have one per 8 IOs on at a time. Otherwise, use·a resistor values·220 ohms less than the values mentioned in this thread.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
Sign In or Register to comment.