SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
#101835
natanel,
Resistors can be used to divide or reduce voltage or to limit current, but not to increase voltage.

According to the datasheet, these can take up to 4.0 V and up to 50mA (more current than is available on an output pin from many uCTLRs) per color. You appear to have three choices:
1) change to LEDs that require no more than 3.3V (this one may be close enough),
2) change to a uCTLR that has a higher output voltage than the LEDs require, or
3) provide some intermediate device(s) (such as discrete transistors, driver chip, or 3.3V to 5 V converters) to take control signals from the uCTLR and use them to switch the required voltage and current for the LEDs.

Once you have found a way to get enough voltage and current to your LEDs, you will need to provide a resistor for each color to limit the current. The value of each resistor may be calculated by:
Resistance[ohms] ={Output voltage (Vo) [V]) - (Forward voltage (Vf) of LED [V])}/(Forward current (If) of LED [A])

For example, if you have a source with Vo = 5 V and an LED that has Vf of 3.8 V and If of 40 mA:
Resistance [ohms] = {5 V - 3.8 V}/(0.040 A) = 1.2 V/0.040 A = 30 ohms

To check the calculation, determine the voltage drop across the resistor by multiplying the resistance by the desired current, If:
Vd = R * If
In our example: Vd = 30 ohms * 0.040 A = 1.2 V

The voltage drop across the resistor must equal the difference between the output voltage and Vf:
Vo - Vf ?= Vd
In our example: 5 V - 3.8 V ?= 1.2 V

Happy Hunting,
Eric
#101838
thanks
I know about the R only reduce voltage
in the spec it mention page 4/11 they also show min values

I don't know if I can count on them and how

Vf
min typ max
R - 2 2.4
G 3.1 3.5 4
B 3.2 3.5 4

with If =20 ma

so is it going to be enough?
is the If is correct for working or only to show values?
which resistors in this case R (3.3-2)/20 = 65, G (3.3-3.1)/20 = 20, B (3.3-3.2)/20=5

Br
Natanel
#101839
natanel wrote:in the spec it mention page 4/11 they also show min values. I don't know if I can count on them and how
The only way you can "count on them" is that the Vf of a particular diode is not likely to be below that. It is, unfortunately, quite likely to be above that. My understanding, however, is that a particular diode is going to have some particular Vf, which you can measure. If you got lucky, or purchased enough diodes, you should be able to find ones at the lower end of the Vf spec. The smaller the difference between the upper end of the Vf range and what voltage you have available, the better your chances. That's why I suggested the diodes I did.
natanel wrote:Vf
min typ max
R - 2 2.4
G 3.1 3.5 4
B 3.2 3.5 4
with If =20 ma
is the If is correct for working or only to show values?
That's the current at which the other characteristics were measured. You can operate the diode there, but you'll get more light if you operate at a higher current within the specified limit.
natanel wrote: which resistors in this case R (3.3-2)/20 = 65, G (3.3-3.1)/20 = 20, B (3.3-3.2)/20=5
That's if your diodes happen to be at the low ends of the Vf ranges, at the high ends:
R (3.3-2.4)/0.020 = 45
G (3.3-4.0)/0.020 = -35
B (3.3-4.0)/0.020= -35
which should work quite well, as soon as you can find negative resistors. :wink:

Happy Hunting,
Eric
#101859
It's all in the datasheets, basically.

First, if you're operating an MCU at 3.3V, remember that an I/O pin driving a logic high won't be at 3.3V. There's some voltage drop (usually around 0.5V - 0.7V) associated with the transistor inside the microcontroller which drives the port. So if you hook an I/O pin to an LED to ground, your voltage drop across the LED is probably no more than 2.5V. If you hook an I/O pin to an LED to another I/O pin, your voltage drop across the LED is probably less than 2V.

Second, look at the LED datasheet - specifically the voltage/current graphs and so on. If you're dropping 2.5V across the green LED, for instance, then you're getting less than 5mA through it. Looking at the forward current vs. relative luminosity graph, that probably means you'd get less than 10% of that LED's normal brightness (assuming the LED actually operates at all...) If you could get as much as 3.3V across the LED, then it would operate at a little over 10mA - somewhere around 70% intensity.

The situation with the blue LED is much worse. Even if you managed 3.3V across the LED, that would be less than 10mA current - less than 50% intensity.

So, yeah, you need more voltage. If your power source really is 3.3V, you could use a DC-DC booster to get this. If you're using a higher voltage and regulating it down to 3.3V for the microcontroller, you could take the unregulated source voltage for the LED's common anode, and use current sink source devices (attached to microcontroller pins) to drive and control the individual LEDs...


Incidentally - esklar - personally I find all this green text to be rather annoying. Perhaps you would consider not using the color tag?
#101863
tetsujin wrote:There's some voltage drop (usually around 0.5V - 0.7V) associated with the transistor inside the microcontroller which drives the port. So if you hook an I/O pin to an LED to ground, your voltage drop across the LED is probably no more than 2.5V. If you hook an I/O pin to an LED to another I/O pin, your voltage drop across the LED is probably less than 2V.
tetsujin,
What, if any, is the dependence of that voltage drop on the current?
tetsujin wrote:So, yeah, you need more voltage. If your power source really is 3.3V, you could use a DC-DC booster to get this. If you're using a higher voltage and regulating it down to 3.3V for the microcontroller, you could take the unregulated source voltage for the LED's common anode, and use current sink source devices (attached to microcontroller pins) to drive and control the individual LEDs...
I'd be careful about using an "unregulated" source, but one could use an externally regulated one (USB comes to mind) or regulate it to a more useful value, such as 4 to 5 V.

I've thought of a kluge to avoid having to provide drivers. How about connecting the diodes between (a constant source slightly above the desired forward voltages) and (appropriate resistors to output pins of the uCTLR)? That way, the diodes would be forward biased (but not enough to emit appreciable light) when the DOs are high and forward biased at the nominal forward voltages when the DOs are low. The catch is that this requires the DO pins to tolerate a bit of backdriving, but the voltage to which they would be exposed could be limitted by providing clamping diodes to ground. I have not investigated whether this tolerance exists.
tetsujin wrote:Incidentally - esklar - personally I find all this green text to be rather annoying. Perhaps you would consider not using the color tag?
For you, I've posted this in "basic black". What bothers you about green?

Eric
#101873
esklar81 wrote:
tetsujin wrote:There's some voltage drop (usually around 0.5V - 0.7V) associated with the transistor inside the microcontroller which drives the port. So if you hook an I/O pin to an LED to ground, your voltage drop across the LED is probably no more than 2.5V. If you hook an I/O pin to an LED to another I/O pin, your voltage drop across the LED is probably less than 2V.
tetsujin,
What, if any, is the dependence of that voltage drop on the current?
You mean the voltage drop across the LED, or the voltage drop associated with the microcontroller's output driver?

voltage drop across the LED increases as current through the LED increases, of course - according to a non-linear relationship shown in the LED datasheet.

Voltage drop associated with the microcontroller's output driver is a similar curve, I believe (it's a diode thing - or in this case a transistor thing, really) - but the variance in voltage is pretty small. My usual working assumption is that if a transistor's operating, it drops about 0.7V.
tetsujin wrote:So, yeah, you need more voltage. If your power source really is 3.3V, you could use a DC-DC booster to get this. If you're using a higher voltage and regulating it down to 3.3V for the microcontroller, you could take the unregulated source voltage for the LED's common anode, and use current sink source devices (attached to microcontroller pins) to drive and control the individual LEDs...
I'd be careful about using an "unregulated" source, but one could use an externally regulated one (USB comes to mind) or regulate it to a more useful value, such as 4 to 5 V.
Well, what I described above was using a regulated source - or rather a regulated sink. A current sink driver regulates the amount of current flowing through it. It does this by increasing its output voltage any time the current through the device is too high. So if the unregulated source suddenly spiked, the voltage on the sink driver (on the LED cathode) would quickly increase to match, keeping the voltage drop across the LED itself consistent.
I've thought of a kluge to avoid having to provide drivers. How about connecting the diodes between (a constant source slightly above the desired forward voltages) and (appropriate resistors to output pins of the uCTLR)?
Yes, that would work as well. Kind of like what I suggested, except with regulated voltage instead of regulated current. If the output high voltage of the microcontroller connected to LED cathode wasn't enough to turn the LED off, you could also set the pin as an input - inputs are high-impedance, so not enough current will sink to light the LED. Though you still have to make sure the voltage that reaches this input pin is within the absolute maximum specified in the microcontroller's datasheet, whether the pin is set as an input or not...)
tetsujin wrote:Incidentally - esklar - personally I find all this green text to be rather annoying. Perhaps you would consider not using the color tag?
For you, I've posted this in "basic black". What bothers you about green?
Thanks, you're too kind. :)

I just find it a bit jarring when people color their posts. Black text on a light background is nice and high-contrast, good for reading. Colored text means reduced contrast. Better to stick to clarity IMO.