Question about LED Voltage and the Teensy

Status
Not open for further replies.

balornt

Member
When I have worked on projects in the past I am used to working with LED's with 2.1V forward voltage while drawing 20mA current. There are LED's that allow for 3.3V forward voltage, drawing 20mA current. If you use the former with the teensy then you need a resistor to dissipate the excess voltage supplied by the teensy, but is there any reason (aside from price) not to use the latter without any resistor? It generally doesn't matter much, but I am working on a project where i would like to get three 0805 SMD LED's into a tight space on a PCB and could easily do it if I don't have to attach resistors to them.
 
You are still best off to provide current limiting for the LEDs. Go pop 3.3, 3.3 and 20 into http://led.linear1.org/1led.wiz and hit 'Find R' button there - just 1 Ohm and the LEDs can last and last like LEDs should.

Edit: Dissipating the over-voltage is the less important role of the resistor for LEDs.
 
Last edited:
1 ohm is meaningless in this case -- the drivers in the Teensy chip have internal resistance of between 5 and 20 ohms which swamps out any significant effect of an external 1 ohm resistor.

LED forward voltage is different for different LEDs -- reds are the lowest at about 1.7 V, green, blue and white increase in voltage. Note that the voltage also changes by about 0.2 V at cold (increases) or hot (decreases) temperatures.

If the LEDs you have have internal resistors to limit the curent, then you're OK. If they are blue or similar and just 'need' 3.3 V to light, you'll find that adding a resistor will decrease the brightness, and still the brightness will change significantly with temperature etc.
 
Hey Jp3141, I can find where the technical datasheet for MK20DX256VLH7 states that the resistance for 'weak pullup' is 20-50K quickly and easy enough but, admittedly not spending a lot of time looking for it, I could not find anything convincing that the digital driver wouldn't happily supply too much current - the advice to make sure you don't exceed 25mA per IO pin (and 100mA overall) makes me think I'd prefer to just pop the 1 Ohm resistor on in Balornt's application.

I don't mind being wrong even 1/10th as much if I can just learn even the slightest thing from it: Would you mind terribly pointing out the info you are looking at which indicates the 5 to 20 Ohms of resistance in their digital drivers?
 
I googled around and found my answer here. Essentially I would need a resistor even with an LED where the forward voltage equals my supply's voltage. This makes sense in my head because if you hooked it up directly then while the voltage of the circuit matches the voltage of the supply, satisfying kirchoff's law, the current is still (mostly) unrestricted. The LED would quickly burn out. How much resistance that resistor should have is a bit of a mystery to me since I have no excess voltage I can't just use Ohm's law to determine the required amount of resistance.

Vsource (3.3V) = Vled(3.3V) - Vresistor(0V?)

0V = IR -.-

Any resistor I add to the circuit would prevent the LED from burning out, but would also prevent the LED from lighting at max brightness.

It doesn't matter for my project. If I must use a resistor then I might as well go with an LED with lower forward voltage requirements because they are cheaper. I am still curious about this though.
 
I think that basically you are better off with V_LED being lower than V_SRC so that you can safely drive it nearer its max current rating, mind you it isn't that brilliant to set them up at 100% of max current rating - pretty sure that LED calculator I linked in my first post makes a point of only going to about 60% of the given max rating and I personally wouldn't rush into exceeding about 80%

If we can rely on the digital driver having a minimum of 5 Ohms (and a maximum of about 20) then we can subtract that 5 Ohms safely enough from the value we derive using Ohms law (pretty sure that if the required resistance calculated isn't bigger than about 100 Ohms this will make a difference).

@Jp3141: Should I be embarrassed that I didn't find the convincing data/info quick enough and just gave in to the temptation to just ask you where you are getting it from?
 
Last edited:
@robsoles,

In the Teensy's datadheet - https://www.pjrc.com/teensy/K20P64M72SF1.pdf, page 13, the output drive is specified at a load of 9 mA -- the output voltage droops by 0.5 V. Therefore the resistance is R=V/I = 0.5/9m = 56 Ω. Note this is a maximum -- typical parts at normal temperatures and supply would (I guess) be about half this; best parts and cold might be ~ 15 Ω -- so my 5-20 Ω was a bit optimistic.

In general, you shouldn't depend on these being particularly close to the limits in the spec.

@balornt -- the VF of an LED isn't a single, precise number -- it changes with the current (and temperature). As you found, basically, you can't define (i.e. can't calculate) the current if you assume the VF and MCU's output are the same value. You're not going to get 'infinite' currents if you don't use a R (the MCU's output drive strength will limit it), and it's unlikely you'll burn out the LED either; however, the current will vary with environmental conditions, and it is even probably that the various LEDS you use won't all have matching brightnesses.

What is the LED you are considering using ?
 
@robsoles,

In the Teensy's datadheet - https://www.pjrc.com/teensy/K20P64M72SF1.pdf, page 13, the output drive is specified at a load of 9 mA -- the output voltage droops by 0.5 V. Therefore the resistance is R=V/I = 0.5/9m = 56 Ω. Note this is a maximum -- typical parts at normal temperatures and supply would (I guess) be about half this; best parts and cold might be ~ 15 Ω -- so my 5-20 Ω was a bit optimistic.

In general, you shouldn't depend on these being particularly close to the limits in the spec.

...

Ah, I read that section differently to you; that information is a bit too ambiguous for me, it only implies a potential resistance where it may even be explained by V_drop of a diode (or other semiconductor; which I do realise these can have resistance either built in or as by-product) - without either seeing the drive circuit schematic or having it explicitly stated (*by Freescale, datasheet, errata or whatever) I am in no rush to rely on any 'proper' resistance there at all.

I (re-)read page 13 pretty carefully before asking you where you got that data from.
 
@robsoles -- you are correct in that this could be interpreted many ways, but in practice, these types of circuits are built in a standard sort of way. The 'resistance' is not a specific resistor, but the resistance of a MOSFET when the gate is driven. It's not a perfect resistor (for instance if you increase the voltage the current doesn't increase linearly); it depends very much on temperature, and it depends very much (approximately inversely with) on the VDD voltage (that's why they have two ranges -- one for V < 2.7, the other for V > 2.7).

Note that in the case of an I/O configured with a resistor pull-up (or -down), a physical resistor is likely used -- although from the spec, you can see that it is not particularly precise.
 
It might be interesting to set up an IO pin with a 10K resistor to GND and then set it to 'digital output on' and measure the voltage difference between VCC and the IO pin - this should give usable figures to define the actual resistance for that IO pin for the (atmospheric) condition it is measured in.

*Of course we need to know the exact actual resistance of our 10K resistor.

Then this process could be repeated on enough IO pins of enough MK20DX256VLH7s under enough different conditions to map the upper and lower limits and the data collected would be plenty explicit enough for me to happily rely on :D
 
Unless I misunderstand completely, you can't reasonably use a resistor to limit current on a LED requiring 3.3V if you are driving it from the output of a Teensy Any resistor small enough in value to allow reasonable brightness won't have any real effect in limiting current. If you really want to drive a blue led with a teensy you should use the Teensy to drive something that pulls one end of the LED to ground with the other end tied to 5V then you have 1.5V to drop which would take an 75 ohm resistor. I choose 1.5 assuming 5V, 3.3 across the LED and .2 across the transistor to ground. Note that if you use an 75 ohm resistor and you pick a LED that happens to only be 3.1V at 20ma and if the 5V supply happens to be a bit high, like maybe 5.1 instead of 5, your 20 ma design will suddenly be 26ma. Likely not a problem but conceptually it could burn out your LEDs.

Ira
 
@Balornt: Pending the number of LEDs (even 2.1V/20mA ones), and how many *may* be on simultaneously, it is probably better to wire it as Ira suggests to wire a 3.3V one just to avoid clobbering the 3.3V regulator.
 
Second that here. The uln2003 and it many flavors are found on just about every pcb I've ever torn down that had relays to be switched by a MCU.

I like to limit the current that the mk20 has to deliver in order to maximize its life. I generally use OSRAM topled and similar LEDs that have a low test current (2mA). They feature a form factor that's similar to 0805's with 3k and 4.7k resistors based on whether it's the teensy driving them (3k) or the external power supply (4.7k). FWIW, external power is somewhere between 4.7-5VDC.

The LED calculator referenced above (thank you!) suggests that I could use much more 'aggressive' resistors. Could be fun to investigate.
 
Last edited:
I would also suggest that learning the 2 really simple equations will help you a lot. That's all that LED site does but it certainly gave you a misleading answer. Leading you to believe that a 1 ohm resistor will do anything in series with a LED is a serious mistake.

Ohms law, E = IR, says that a 1 ohm resistor carrying 20ma will drop .02 volts, not enough to do anything.

It's important when using a current limiting resistor to consider the extremes as 5V is rarely 5V. Commonly it's plus a tenth or two and minus up to 1/5.

I'm going to assume our LED drops 2V at 2o ma so even though the voltages go from 4.8-5.5, the calculations will use2.8 to 3.5. Looking at those numbers we get a table something like this:

4.8V 5V 5.5V Ohms
20 21 25 140
19 20 23 150
16 17 20 175


If you're blinking LEDs the 25ma you might get under absolutely worst case conditions probably don't matter, but if it's on all the time it might burn out faster than you expect. Also if you're doing a minimal design, 0603 or smaller resistors, you may find the resistors get hot.

So, the 2 equations you need to know by heart are ohms law, E=IR which was mentioned and P=IE where P is power in watts.

I attached a spreadsheet I use when playing with these numbers. It's not likely the best spreadsheet ever but it suffices for my needs. Maybe you will find it useful.

Ira
 

Attachments

  • Electrical.zip
    20.8 KB · Views: 124
I used another site that didn't only give answers in 'standard' resistance values to see whether I could achieve consistent brightness values through consistent mA based on my 'standard' resistors.

I settled on 0.6mA per LED channel. Should lead to a long life and low stress on the MCU.
 
Status
Not open for further replies.
Back
Top