7
\$\begingroup\$

I'm setting up an attiny2313 to drive an array of LEDs and blink them in different patterns. Rather than putting a series resistor in line with each LED (they'll be controlled separately, so I can't do tricks like putting them in series with each other), I was wondering about just using a couple diodes to get the voltage down to the right range.

The system is running at 3.3V (with a regulator to keep it pretty constant), and two 1N4001 diodes will drop that down to 1.9V - right in line with the lower end of the 1.8 - 2.2V these LEDs are specced for. Since the diodes will always want to maintain the same voltage drop across themselves, I don't have to worry about that voltage changing as I turn the LEDs on or off. Overall I save 6 components.

Has anyone else tried something like this? Any gotchas I've overlooked? I realize the diodes will have to dissipate the full current from all the LEDs, but for this small amount of current that doesn't seem like it will be an issue.

(edit: I'm putting these diodes between the common cathode of the LEDs and ground)

\$\endgroup\$
1
  • \$\begingroup\$ Just thought I'd update and note that everything seems to be working, though not as perfectly as I might like. I'm actually hitting the current limit of my regulator when I have too many LEDs switched on at once, which causes them to dim a little. \$\endgroup\$
    – edebill
    Nov 15, 2009 at 15:05

11 Answers 11

11
\$\begingroup\$

I must confess I never tried this. But the series resistor has an important role: it is there to limit the current through the LED. If there's no resistor, the current may be limited in the end to a value which is too high for the LED or for the driver transistor. Theoretically you should graphically add the U-I characteristics of the diodes and the LED, and see on the the resulting characteristic what's the current for your Vcc value. But the main problem is that this current cannot be reliable predicted, since the U-I catalog characteristics of the diodes and LED give you an typical curve, and this curve will also shift with the temperature.

So while it may work, I wouldn't count on it working in every instance. But you may have some help from an unexpected place: the IC driving your LEDs. Sometimes the digital outputs have internal resistors or other ways to limit the output current, in order to avoid overloading them. So check the spec sheet for your attiny2313.

\$\endgroup\$
1
  • \$\begingroup\$ Ooooh. I hadn't thought about how temperature changes things. I'd hope it'd be pretty stable for 50-90F, but these super cheap LEDs (ledshoppe.com) don't come with a lot of specs. The attiny2313 doesn't seem to have any output protection resistors. I may go back to resistors for safety. Diodes sure were handy on the breadboard, though. \$\endgroup\$
    – edebill
    Nov 8, 2009 at 15:51
16
\$\begingroup\$

using another diode to "match" the source voltage to the LED voltage: NO NO NO!

An LED is basically a voltage sink: it draws no current until the voltage across it forward-biases the diode junction, and then all of a sudden when you get enough voltage the current through it rises dramatically. The light output of an LED is strongly dependent on the amount of current you put through it: more current = more light output. The voltage drop, although approximately constant, varies with temperature and from device to device.

In almost all applications you want to set the light output, and hence the current, to a fixed value, independent of supply voltage variations and LED voltage drop variations. This means the ideal source for an LED load is a constant current source -- which you can implement, it's just that it's a pain to do so without a few additional components. In practice we just tend to use a voltage source (switched on and off by a logic gate or a MOSFET or a bipolar transistor) and a resistor to set the current.

The key equation is Vsupply - VLED = ILED*R, or ILED = (Vsupply - VLED)/R

The term on the left-hand side is the difference between supply voltage and LED voltage drop. This can vary with temperature and part-to-part variation. A sensitivity analysis here is fairly easy: ΔI = ΔV/R -- the change in current is equal to 1/R times the change in voltage. If you want your LED current to be less sensitive to changes in voltage, that means the value of R should be higher... for a particular nominal LED current (usually between 5mA and 20mA), the current will be less sensitive to changes in voltage if the source voltage is higher and the resistance is higher.

By dropping the supply voltage using a second diode, you are doing the exact opposite: to get the desired current, you have to reduce the value of R, which makes the load current more sensitive to voltage variation. AND you are also introducing another circuit element (this new diode) which has additional voltage tolerances, making those voltage variations larger. You'd be adding extra components which serve no purpose but to make the light output more sensitive to supply voltage variations, temperature, and part variations.

The only other things worth considering here are power dissipation. If you have a fixed voltage source (say 5V) and an LED or other circuit element that uses only a fraction of that voltage (say 1.2V) then only a fraction of the power (1.2/5V = 24% in this example) is dissipated in the LED, and the rest (76%) is dissipated in something else that you need to connect the two together. That's true for any linear power supply (see below for a comment about switchers). This goes into heat, which needs to be properly dissipated, and in most cases the cheapest easiest way to dissipate a given amount of heat in a controlled fashion is in a resistor. They work properly over a higher temperature range (most diodes/transistors work up to about 150 C max) and their behavior varies less with temperature.

The exception to all of this thinking is a switching power supply. Many LED drivers are going the switcher route, and using pulse-width modulation + a switching transistor and an inductor to get the efficiencies up. This lets essentially all of the power dissipation occur in the LED (with a little bit of loss in a switching MOSFET and inductor). You still treat the LED as a voltage sink, though, with the switching transistor + inductor acting as a current source, varying its duty cycle to control the LED brightness (in high-quality visual displays there is also a light-sensor chip so that the current can be varied to compensate for the LED's aging over time so that white light does not drift in color towards red or green or blue). A switching LED driver costs $$, though, so unless you need the efficiency I wouldn't bother.

Bottom line: keep it simple, use the resistor by itself.

\$\endgroup\$
6
  • \$\begingroup\$ I understand your point here, but properly designed, you can use one zener diode in place of 5 or 10 resistors. They hold the same voltage over an extremely wide range of currents. the resistance of your wires and a semi-stable power source work perfectly. This is not the most intelligent system when compared to a switching system, but it gets the job done. You can cheaply overdo the voltage on an LED and PWM it on and off and it will accomplish the same task, but in far less controllable way. \$\endgroup\$
    – Kortuk
    Nov 30, 2009 at 3:10
  • 1
    \$\begingroup\$ The zener doesn't change the fact that you'd be controlling voltage -- of which the LED current is depending, but with extreme sensitivity which makes the system inherently unstable. \$\endgroup\$
    – Wim
    Jun 30, 2010 at 12:41
  • \$\begingroup\$ Diodes drop VOLTS they do not limit (resist) CURRENT. \$\endgroup\$
    – John U
    Jan 22, 2013 at 12:34
  • \$\begingroup\$ @JohnU: who are you talking to and what are you referring to? \$\endgroup\$
    – Jason S
    Jan 23, 2013 at 5:31
  • \$\begingroup\$ @JasonS - I was talking to Kortuk who seems to be in denial over the laws of physics. \$\endgroup\$
    – John U
    Jan 23, 2013 at 9:01
11
\$\begingroup\$

Sorry, but the whole premise of the question won't work, because diodes do not limit current. You seem to be somewhat confusing voltage and current. Without a resistor, there will be nothing to limit the current. In the best case, the LEDs will work fine, but will wear out much sooner due to overcurrent. In the worst case, it will pop the LED from too much current, and in the very worst case it will fry your microcontroller by trying to sink or source too much current.

Basically the answer is that you always need to limit the current using resistors, unless you are using a special LED driver IC that handles it for you (often called 'constant current sink' or 'constant current source').

I've used Allegro's LED driver ICs before, they work quite well. You can control 16 individual LEDs using only 3 pins on your microcontroller (or many more if using matrixing or multiplexing). Various other vendors also make LED driving ICs as well. Or you can do it yourself just using a combination of shift registers, transistors, and resistors.

\$\endgroup\$
6
\$\begingroup\$

It occurs to me that one nice property of series resistors is that when the input voltage starts to sag (e.g. when batteries run low) they will gradually account for less of the total voltage as the current through the LEDs falls. That will have the effect of making the LEDs stay brighter longer. The diodes won't have that flexibility.

\$\endgroup\$
3
\$\begingroup\$

davr has the best answer here. Diodes in forward bias have a current that is very sensitive to voltage. ( and temperature ... ) So you do not regulate the voltage, you regulate the current. A resistor is the simplest ( and not very energy efficient way to do this ).

\$\endgroup\$
2
  • \$\begingroup\$ Don't forget Zener Diodes! \$\endgroup\$
    – Kortuk
    Nov 16, 2009 at 9:21
  • \$\begingroup\$ Zener diodes regulate voltage, not current. \$\endgroup\$
    – pjc50
    Aug 28, 2012 at 16:14
2
\$\begingroup\$

A typical max current of a microcontroller is 40mA. Sometimes this is limited and sometimes it will shut down the uc. That's why sometimes you can connect a LED directly to a uc.

If you are driving a LED, the voltage is not important because it's constant. It will let (almost) all the current that you provide pass, until breakage. So that's why you have to limit it somehow and a diode won't do it.

Asuming you are limiting the power supply it to, for example, 40mA, if you don't use a resistor for each LED, current will be distributed so if you light one diode it will be very bright and when turning 10 leds on they will be ten times dimmer.

That's why every LED tutorial you see on the net, regulates current with simple resistors.

\$\endgroup\$
1
  • \$\begingroup\$ typical max current varies heavily by manufacturer and design. I know many uC that cannot pass 4mA or less. \$\endgroup\$
    – Kortuk
    May 20, 2010 at 14:48
2
\$\begingroup\$

I would like to add a suggestion: build a current mirror. The problem with the resistors is that they will resist the same amount at all time. You lose a certain amount of energy to resisting current flow even when the LEDs wouldn't normally be drawing too much. A current mirror, or constant current source, is much more efficient and allows you select a specific current to run at.

Further, you may consider using a driver chip like the ULN2803, linky: ULN2803

You will find it can handle much more current than a microcontroller, and allows you drive some pretty big loads.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ current mirrors are not more efficient than resistors. Any linear circuit, which a given amount of current passes through, and which drops a given amount of voltage, has the same energy usage. Doesn't matter whether it is a resistor or a diode or a transistor or something else. Current sources have value in this situation, but that value is being able to control the LED current, and not anything to do with efficiency. \$\endgroup\$
    – Jason S
    Nov 29, 2009 at 23:25
  • \$\begingroup\$ I have to agree with Jason here. If you want more efficiency than a resistor (or some other circuit that just burns away the excess voltage, such as a current mirror or a current source using a FET), you'll need something like a DC-DC converter or switching power supply. \$\endgroup\$
    – Wim
    Jun 30, 2010 at 13:18
0
\$\begingroup\$

If you are able to run your complete circuit at the forward voltage of the led then there is no problem - it will work fine. Why not use a variable regulator and get the voltage down that way rather than 3.3v and two diodes? Alternatively you could use the diodes between the common cathode of the leds and ground - again no problem.

\$\endgroup\$
3
  • \$\begingroup\$ It never occurred to me to run the circuit at the LED's forward voltage. Unfortunately, minimum forward voltage on this attiny2313 I'm using is 2.7V, so I can't get it low enough. \$\endgroup\$
    – edebill
    Nov 7, 2009 at 13:46
  • \$\begingroup\$ So where do you expect to place the diodes, I assume connected to the leds in a common anode or a common cathode configuration - in which case you will be OK. \$\endgroup\$
    – JohnC
    Nov 7, 2009 at 17:49
  • \$\begingroup\$ Common cathode, which sounds safe, but for what icabrindus says about temperature dependence changing how things behave. \$\endgroup\$
    – edebill
    Nov 8, 2009 at 15:44
0
\$\begingroup\$

On your LED datasheet, there should be a graph labelled something like "LED current vs. forward voltage". There should also be one something like "Duty cycle ratio vs. allowable current" which may also help. Those graphs demonstrate the difference between and "ideal" diode and your actual one... and we can use this to our advantage!

I chose a voltage that gives a current that is half the maximum rating. I rummaged through diodes until I found a combination that dropped the voltage from 5v to 2.8v, for this LED that resulted in a measured current of 9.2mA, less than half the maximum rating. Brightness was normal. The method, while not ideal, works fine, even at 100% duty cycle.

You do have to control the voltage rather well though. A variable benchtop power supply and an ammeter will help a lot, though trial and error works fine too. Normally I'd just use resistors, but I don't have any and can't buy more right now.

\$\endgroup\$
1
  • \$\begingroup\$ A major problem with that approach is that no matter how precisely you control voltage, the amount of current a LED passes at a given voltage may vary enormously with manufacturing lot, temperature, phase of the moon, etc. If one doesn't really care whether the current is 2mA or 20mA, picking a voltage that yields 6mA may be fine, but one should be prepared for the possibility that the LED might pass considerably more or less current than expected. \$\endgroup\$
    – supercat
    Jan 22, 2013 at 16:59
0
\$\begingroup\$

When a diode is used as a voltage dropper for LEDs, diode capacity could be a problem at turn on and allow a very brief, but high LED current before the diode conducts. Scope checks of LED currents at turn on would show if this is happening.

\$\endgroup\$
-1
\$\begingroup\$

I enjoy your idea, and I think it is an excellent one, I would just change the hardware just a little.

If you have heard of a zener diode, I think it is more what you are looking for. They hold a constant voltage over a wide range of currents, and you can get one for 1.8 V. A zener is a diode that has a reverse breakdown voltage that is very controlled, and does not change a noticeable amount. The 5.1V zener diodes are the most temperature independent due to the physical parameters, but a 1.8 can be also.

The LED you are using have a decently large operating rage, so a variance in your power supply should not be a large problem for circuit, which removes the reason people normally use resistors, as a power limiter, but we often measure that as a current/voltage limiting device.

The thing I worry about you overlooking is the maximum current your micro-controller can output, but this has been brought up in other posts.

Using a Zener to drop a voltage down to an operating range for another device is a common practice I read about and have used myself. I am sure you will be happy with the result.

\$\endgroup\$
2
  • \$\begingroup\$ A zener diode doesn't solve this! If you have a look at the U/I-curve of an LED, you'll see that -- in order to have the LED work at a certain current -- you need to control the voltage very precisely. Any deviation of the voltage over the LED results in a huge change in current. Therefore, you're much better of controlling the current directly. \$\endgroup\$
    – Wim
    Jun 30, 2010 at 12:37
  • \$\begingroup\$ I enjoy you saying I should control the current directly, as V or I can be controlled, But I know what you mean. My standard practice, as with many is an LED Driver or a resistor. Still, no reason not to play with a zener. Especially if your generator has the resistance and dissipation power rating you need. \$\endgroup\$
    – Kortuk
    Jul 5, 2010 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.