5V AVR to lower voltage LEDs without resistors

Go To Last Post
44 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am looking at ways of reducing the amount of work involved in building a circuit that uses 7 segment LED displays.

I want to avoid needing 8 resistors per display. The obvious solution is to match the LED's forward voltage. The question is how best to do that.

I could run the AVR at the forward voltage too. An ATtiny2313 will do 8MHz at 2.7V, but that is still a little bit high for red LEDs. It would probably be fine and can easily interface with another AVR running at 5V with some 10k resistors and the internal clamping diodes (I only need three lines for comms).

However, I would like to run the 2313 at 5V if possible because then I could put a header for a drop-in character LCD module as an option. Since I am trying to keep the component count as low as possible that rules out transistor arrays.

My idea is to use common anode displays supplied at the forward voltage (say 2.2V for the sake of argument) from a regulator. The cathodes would be connected to AVR I/O pins. When set low the AVR will sink current and the LED turns on. When held high the LED will not conduct and will be off.

Rather than set the pin to output 5V I'd just set it as an input with pull-up, so even if the LED's reverse voltage is lower than the difference between 5V and 2.2V the amount of current will be tiny.

I'll try and get around to prototyping this soon, but in theory it seems solid.

PS. There is one other option. I could use 2.2V to the anodes and a SIL resistor array to pull the cathodes up to 2.2V unless the AVR pulls them low. It's one more component but one that is much easier to solder on than 8 independent resistors.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just switch the outputs on and off to get the appropriate duty cycle.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can use a single resistor for the 7-segment (on the common anode or cathode). Then for consistent brightness you time multiplex segments.

Since each segment is on for 1/7th of the time (or less if you want), increase current to preserve brightness.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use a Resnet.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
The obvious solution is to match the LED's forward voltage
Which brand, which batch, which colour and at which temperature? Oh, you are expecting to be the same all the time? :?

I wonder why people go to the trouble of making relatively expensive led driver chips if it is all that easy.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are special small, 2 pin, chips to give a current proportional to voltage.

If you want you could just adjust the µC voltage. At low voltage (e.g. 3 V) the maximum output current can be low enough for a LEDs. However the voltage may be to low to run the AVR at 8 MHz.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kleinstein wrote:

Quote:
There are special small, 2 pin, chips to give a current proportional to voltage.

LOVL !

Nard

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js wrote:
Quote:
The obvious solution is to match the LED's forward voltage
Which brand, which batch, which colour and at which temperature? Oh, you are expecting to be the same all the time? :?

Simply vary the supply voltage to match whatever LEDs you are using. An LM317 and two resistors is all that is required.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kleinstein wrote:
There are special small, 2 pin, chips to give a current proportional to voltage.

If they are 2 pin there does not seem to be any advantage to using 14 of them compared to 14 resistors (2x7 seg displays).

Quote:
If you want you could just adjust the µC voltage. At low voltage (e.g. 3 V) the maximum output current can be low enough for a LEDs. However the voltage may be to low to run the AVR at 8 MHz.

The ATtiny2313 says it will do 8MHz at 2.7V, but I could always use 4MHz. The AVR will be doing nothing other than the display and a simple one-way clocked 2 bit input bus with another AVR.

AVRs are so cheap they are ideal for this sort of thing. They can supply/sink enough current to run lots of LEDs (compared to e.g. a 74HC595) and are extremely versatile.

I am going to try the separate LED supply method I suggested. Reading the datasheet spec it should work okay, and as a bonus I can use the same PCB with an option jumper for connecting an LCD display instead.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mojo-chan wrote:
Kleinstein wrote:
There are special small, 2 pin, chips to give a current proportional to voltage.

If they are 2 pin there does not seem to be any advantage to using 14 of them compared to 14 resistors (2x7 seg displays).

But a two pin chip that gives current proportional to voltage *is* a resistor.

Besides you need 7 resistors if you multiplex two 7-seg displays, and maybe 1 or 2 resistors if you multiplex the displays as 14 single LEDs or two blocks of 7 single LEDs.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OMG Jani !

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Connect a 4017 decade (1-2-3.. sequence) counter to the segments. Clock the counter from one IO pin. Use another IO pin to switch the whole display on or off at the right times. One resistor is required.

When you master this you can easily add 7 user input buttons to this design just by adding one single input pin.

PS: the 4017 function can easily be implemented in the microcontroller at the same bus as the LCD :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is the occasional exception to the rule, but by and large an LED without a resistor is a lot like:

A car engine without a starter motor
A refrigerator without a compressor
A Space Shuttle without a Solid Rocket Booster
A kitchen oven without a thermostat
A cell phone without an LCD
A heart transplant without a heart

Anyways, you get the idea.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Simply vary the supply voltage to match whatever LEDs you are using. An LM317 and two resistors is all that is required.
Well my friend, I hope that you are not designing some commercial stuff because it will be JUNK!! I have clock radio next to my bed that shows exactly the rubbish that some peole "design" and sell because the "designer" must still be in kindergarten.

What happens if you have a red led and a blue led on the same board?

Do you know why they put stuff like this in the data sheet?

Parameter Symbol    MIN. TYP. MAX. Unit Condition
Forward  Voltage Vf 1.5  1.7  2.4  V  If=20mA

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ironically, one (not two) resistors can turn an LM317 into a constant current source. And you don't have to vary the supply voltage ...

Stealing Proteus doesn't make you an engineer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The OP seems to think that resistors are just a conspiracy to use up board space and money when working with LEDs. Fact is, they are there for several very good purposes. Here are the facts:

1) There is a LOT of variation among LEDs of the forward voltage at any particular current, even the same color from the same manufacturer and the same batch. The result is that two diodes across the voltage source will have different currents. Since brightness is proportional to current, they will have different brightnesses.

2) The forward voltage varies significantly with temperature. Thus, brightness will vary with temperature.

The result of both of these facts is that if you drive them from anything like a voltage source, you have problems. The LEDs will be different brightness and the relative brightness of all will vary with temperature, some differently than others in the system.

It gets even worse if you have different manufacturing sources or if you change sources part way though the project. And, it will be worse, still, if you try to mix red, orange, yellow, and green; blue is entirely out of the picture.

So, I suggest that you bite the bullet and put in the resistors.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As i read you said to avoid 8 resistors per display.8 resistors will be used totally and put them in data line since leds are multiplexed.
if leds are common anode connect emiter of a pnp transistor like BC640 to 5V,collector to common anode of LED and the all parts A together and with 470ohm to AVR pin,same for B,C,D,E,F,G and dot.In the base of the transistor put 4,7K and connect it to a pin a AVR.
By multiplex only one digit lights at time,and selecting frequency 80HZ*number of digits you will have a good stable display.Interrupt period=1/80*n.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
And you don't have to vary the supply voltage
But if you have a Red led (~1.5V required) and a Blue (~3-4V required) or a Green (~2-3V required) how can you manage?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With different current sources, how else? Supply voltage == the voltage going into the LM317.

I was just surprised that the OP suggested to use an LM317 in constant voltage mode for driving a LED when that IC can also be operated in constant current mode, which makes more sense when you want to use that IC to drive a LED.

Stealing Proteus doesn't make you an engineer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One LM317 per LED compared to 1 resistor per LED. Makes no sense to me!

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You shouldn't really use LEDs with constant voltage - they act like zener diodes. The 'knee' voltage is not as sharp but the difference of a few 10s of mv could mean the difference between 5mA and 50mA :)

-=mike=-

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js wrote:
Well my friend, I hope that you are not designing some commercial stuff because it will be JUNK!! I have clock radio next to my bed that shows exactly the rubbish that some peole "design" and sell because the "designer" must still be in kindergarten.

What happens if you have a red led and a blue led on the same board?

Well my friend, I hope that you are not designing some commercial stuff either because apparently you randomly substitute components and prey that it works. I hate break it to you, but you can't just swap parts because they look similar.

Quote:
Do you know why they put stuff like this in the data sheet?

I do. It's so that you don't have to guess what will work or use trial and error, instead you can make an informed decisions to choose the right one.

I'll give you a hint: those little numbers on the schematic are pretty important. You should figure out what they mean.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ArnoldB wrote:
Ironically, one (not two) resistors can turn an LM317 into a constant current source. And you don't have to vary the supply voltage ...

Problem is the current varies depending on how many LEDs are lit.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, thanks for all the hilarious comments and complete lack of consideration for most of the question I posed. I guess maybe you guys get fed up with people asking daft questions, but mine was not daft.

Anyway, I did some experimentation and have shown the method I suggested using an LM317 to supply the forward voltage of the LEDs works perfectly. When the AVR sets the I/O pin to an input with pull-up the LED turns off and the amount of current is around 0.1mA.

As for temperature variations, the datasheet says that the differences are too small to matter at room temperature. I verified this by putting the device in a fridge to cool it down to ~3C and in an oven (low setting) to warm it to ~40C.

The reduced part count has reduce construction time and cost by 100-200% (tests pending).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
to supply the forward voltage of the LEDs works perfectly.

Mojo,

You asked a question, and had about 18 responses, the vast majority of which recommended using a few resistors, or a formal constant current source, (which would take even more parts, board space, and cost).

I am glad you have your circuit working, but be aware that ONE test prototype, running for a few minutes, does not reflect long term operational performance.

Lastly, JS has more design and production experience than most of the membership on the forum. Your response above seems a bit inappropriate, coming from the person who is asking for insite and assistance.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, JS chose to insult my intelligence rather than offer any useful or productive advice. It seems that he decided to assume I am some kind of idiot rather than give the benefit of the doubt.

In doing so, only only managed to prove his own foolishness.

This particular project called for something unusual. Due to the low volumes being assembled by hand a low parts count and ease of construction was essential. Space saving to fit a very small case was another requirement.

Otherwise, a simple SIL resistor network would have sufficed. Again, I am not a complete idiot and have experience of this kind of thing. As I have already said, I can appreciate that you probably get a lot of basic questions asked, but that does not excuse tarring everyone with the same brush. Well, "tarring" is probably not the right word, as I would hope you could treat less experienced questioners with a bit more respect, but looking at other threads I see that is not the case. I would suggest simply ignoring such questions if you cannot find anything constructive to say.

Anyway, Thanks to using a single fixed output regulator I have achieved the project goals. While further testing will of course take place, there is no reason to think that there will be any problems. That was really what my question was about - are there any potential issues with this method. Since everything is well within spec and no-one has managed to suggest anything which I have not already accounted for or tested, it seems probable that this design is a good one.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mojo, if you are happy with your LM317 solution, enjoy it.
Blowing your own trumpet over the solution: you're welcome.

You are quite a newbie here on AVRfreaks. A more modest attitude towards fellow-members would be appreciated. And is recommended. If you want respect from us, show yours. And that starts with taking well meant advice seriously.

Plons
yep, ... moderator

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Like the first reply sais, just adjust the duty cycle. LEDs are very forgiving when it comes to short pulses of higher currents. 1A is ursually no problem, as long as the mean current isn't too high. Also to the human eye is good at averaging light if the frequency is high enough, like over 100 Hz. So 100 times the light 1/100 of the time looks the same.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok the solution with LM317 in constant voltage might be affordable in the case of driving one digit only.For contant current source the light will vary depending from the number of segments that lit.If are more than one digits how can you select the digit that will lit in the appropriate time.The only thinking of mine is to use latches,otherwise you might be joking.

Last Edited: Sat. Oct 17, 2009 - 11:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The average seven segment display LED certainly does not like 1A, it's more around 100-150mA. Only some IR leds are able to repetitively withstand short 1A peaks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
apparently you randomly substitute components and prey that it works.
WOW and here I thought my secret was safe for all these years.

Jay I can't afford to pay all that money everytime you support me, we need to renegotiate your support fee structure. :wink:

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Geoelec,

As you noted, a 317 could be used as a driver. The question is: "Why?".
Mojo keeps talking about using a (single ?) 317 as a voltage source, and just about everyone has suggested, in every imaginable way, that this is a poor choice.

The original post was about 7-segment displays. One would typically multiplex either the digits, or the segments. Either way, a variable number of LEDs can be lit during any phase of the time multiplexing.
This will lead to varying intensities across the phases of the time multiplexing, and to vayring intensities within a single phase of the time multiplexing. This is a functional, but sub-optimal, approach to 7-Segment driving. A single current limiter would be very tough to impliment, and not worth the hassle.

One could use a 317, and two resistors, per digit, (or per segment), as a constant current driver, but then the parts count and board space skyrockets!

Eight SMT resistors cost less, use up minimal space, and can drive the LEDs in spec.

As noted one can sometimes drive LEDs with a higher current for a brief time, such as when multiplexing them. But be careful. Read the specs! Many LEDs still have a Max pulse current and one should stay under this or the intensity and lifespan of the LED(s) will be lessened.

Occam's Razor came up in another thread recently, and this is yet another perfect example. There are multiple "solutions", the "best" one is the simpliest.

Mojo,

As I stated above, I am glad that you have a design which works for you.

If you wish to post your schematic, and board layout, I am sure some would like to see its implimentation.

JC

Edit: Occam's Razor: http://en.wikipedia.org/wiki/Occam's_razor
Inbedded link fails...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jokerman (mike): au contraire, mon ami !
LEDs have a much sharper knee-voltage than f.i. a 3.3V zener. Attached the proof :)

So if you need a low voltage zener and it isn't in the parts-box, an LED is a good replacement.

The current is measured over 100 Ohm

Nard

Attachment(s): 

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

and two other leds

Attachment(s): 

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It would be interesting to make a curve of the LED current rising due to temperature rise when it's fed by a fixed voltage :)

If I connect a SuperFlux LED to a bench power supply and set it to, say 40mA, current limit, you I clearly see the voltage on the display rise to maintain the current limit.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Jokerman (mike): au contraire, mon ami !
LEDs have a much sharper knee-voltage than f.i. a 3.3V zener. Attached the proof Smile

So if you need a low voltage zener and it isn't in the parts-box, an LED is a good replacement.

The current is measured over 100 Ohm

Nard

True, and I have used them in the past as a low voltage zener. But you missed the point of my comment which was that driving an LED with a constant voltage is not a good thing.

-=mike=-

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
You shouldn't really use LEDs with constant voltage - they act like zener diodes. The 'knee' voltage is not as sharp ....
Possibly a language thingie, Mike. I read it as: leds' knee-voltage is not as sharp as zeners' ....

The point of constant voltage driving of an LED: that point wasn't taken as it is no point at all (pun intended) :lol:

Nard

Edit: to prevent further confusion: we all know that constant voltage drive of LEDs is bad practice. Uhm, .... almost all.

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jokerman wrote:
But you missed the point of my comment which was that driving an LED with a constant voltage is not a good thing.
I think everyone in this thread, except one, agrees and thought that goes without saying.

Stealing Proteus doesn't make you an engineer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The OP has a good point. Some people like to throw in a little insult and condescension with their posts. I do too, but I'll always let others start it first, golden rule and all that.

C: i = "told you so";

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

you could use a zener diode to bring the common rail voltage up for the the led display, don't know how long it will last though, you are very likely to fry one or two of the segments

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Plons,

Sorry to threadjack, but can you quickly explain how you got your cro to plot those waveforms?

thx,
oddbudman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Scope set to X/Y mode. Function generator outputting a sawtooth that goes to X and to the DUT. Series resistor goes to Y input. I guess also some amplifier after the function generator.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks jayjay :)

If you need more details oddbudman, let me know.

Nard

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If i dont see the schematics of the design,then the talk is based on science fiction.The multiplex is the only solution and resistors are necessary.
My question is how many leds and micros he burned and still he insists.
For once more,interrupt interval time for multiplex.
T=1/80HZ*number of leds.The number or resistors needed is only 8.Common anode leds are driven by a PNP transistor each.