LED drive with pwm?

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

Hi,
I've designed a multiplexed 8 digit LED driver using an ATMega16. It sort of emulates a Maxim MAX7221. My question is on current limiting. The way it is currently hooked up, there are no current limiting resistors. Current is limiting through PWM, kept to a fairly low duty cycle. It seems to work fine this way, and I have great control over the intensity of the LED's. However, is the large short duration current going to cause long term damage to either the LED's or the AVR's port drivers? It sources current through the pins attached to the segments (common cathode), and the digit control pins activate a transistor to sink the current from the digit pins on the display. The display switches digits at around 2khz, so each segment is only on for a very short time, then its turned off for a while.

Thanks,
Bluefire211

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

First have a look to the datasheet:

*** Absolute Maximum Ratings ***
DC Current per I/O Pin ............................................... 40.0 mA
DC Current VCC and GND Pins................................... 200.0 mA

Second look to the *** DC Characteristics (Continued) ***

============= IO-PORTs AS CURRENT-SOURCE =============
Although each I/O port can source more than the test conditions (20 mA at Vcc = 5V, 10 mA at Vcc = 3V) under steady state conditions (non-transient), the following must be observed:

##### PDIP Package ######:
1] The sum of all IOH, for all ports, should not exceed 400 mA.
2] The sum of all IOH, for port A0 - A7, should not exceed 200 mA.
3] The sum of all IOH, for ports B0 - B7,C0 - C7, D0 - D7 and XTAL2, should not exceed 300 mA.

##### TQFP and MLF Package ######:
1] The sum of all IOH, for all ports, should not exceed 400 mA.
2] The sum of all IOH, for ports A0 - A7, should not exceed 200 mA.
3] The sum of all IOH, for ports B0 - B4, should not exceed 200 mA.
4] The sum of all IOH, for ports B3 - B7, XTAL2, D0 - D2, should not exceed 200 mA.
5] The sum of all IOH, for ports D3 - D7, should not exceed 200 mA.
6] The sum of all IOH, for ports C0 - C7, should not exceed 200 mA.If IOH exceeds the test condition, VOH may exceed the
related specification. Pins are not guaranteed to source current greater than the listed test condition.

My answer is:
- the best suited port will be port-a. But the current sum should not exceed 200mA on port -a (see spec).
- rough calculation:
Isink = (VOH(min) - Vsat - Vled) / Rx
= 4V - 0.5V - 2V / 1Ohm = 1.5A per segment :-(((((
= 4V - 0.5V - 2V / 10Ohm = 150mA per segment :-(((((
- what happens during power-up (not multiplexing running)?
- any thermal calculation?

Sorry, but I cannot see the proper working long-term parameters.
We did the multiplexping with a pnp-darlington on the common-anode and one uln2803; so mostly (any) current will work.

Regards
Gregor Arndt

admin's test signature
 

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

Well, I'm actually using a combination of Ports B and D for the segment drives. I don't intend to go over 20ma continuous for each segment, so that would only be 160mA total, spread between two ports.
During power up, all outputs are turned off, the multiplexer is the first part of the program to initialize.

I don't think I'm exceeding that as far as the continuous average current goes, but I'm concerned about the short term transient. I think I might just go and do a test on it, set my brightness as far as I would need (probably 15mA continous), and just run the circuit for a day or so and see if anything gets torched. If so, I can put some current limiting resistors in, if it works, then I'll leave it as is.

Thanks for the quick reply.
Any other insights would also be greatly appreciated.

Over and out,
bluefire211

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

What I found on the '1200, and you will also see in the spec sheet, is that as
more current is drawn from a pin it's "high" value output voltage drops.
So if you connect an anode of the LED to pin, and cathode to ground
with no current limiting resistor... the voltage will drop on the pin as the LED
draws current "unabounded" but voltage stops dropping where it meets
the V(led) requirement - around 1.7 volts for a red LED.
At that voltage the pin will be sourcing around 15ma (assume Vcc 5).
You can have the pin high all day long nothing heats up. It's a
self limiting kind of thing because the pin is only good for so much power
and the LED "wants" to stay on. Some CMOS books show that it's perfectly
fine to hand LED directly of a CMOS output this way, at reasonably low Vcc.
Start hanging more LEDs off the port pins the same way in parallel and
when you exceed some number of LEDs they will all start to dim
because the power of "the port" (half of chip die) is being overburdened..
it can no longer source the required power (voltage to light all
LEDs properly at nominal current for "good lighting" usually reported
as 20mA for an LED). Maybe it's similar for 8515?
Just keep in mind that it's POWER (volts * amps) is what we're working with
here, and it's power draw makes heat in the chip. Don't over-focus on milliamps
per pin or per port without knowing and measuring the voltage being
dropped there too.

Scott

admin's test signature
 

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

Hmm, thats really cool. So, possibly, if I kept only one LED per pin, I could directly drive it at 100% duty cycle, with no problems? Obviously, the most I can run is about 1/8 duty cycle (since I'm scanning 8 digits, whether they're hooked up or not). I'll have to experiment with that, and check the voltage drops.

bluefire211

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

Wouldn't a string of all 8's keep your duty at full-on for each segment driving pin? The scan would just be channeling the current through a different digit.

admin's test signature
 

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

BE CAREFUL!
If you are using a VOM or DVM to measure current, make sure you are measuring the peak current by doing something like putting all 8's into the display, or better yet, set all the segment output pins to drive all the segments, and hold one digit on.

There is a possibilit that the peak current is much higer than you are reading (unless, of course you are using an oscilloscope to measure the current). The peak current can kill chips over time because of metal migration. The part might run for months or years before failure.

By the way, if this is a product you are going to manufacture in volume, be really casreful. You could have hundreds or thousands of chips dropping dead after a period in the field .

Rick

admin's test signature
 

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

Few LED manufacturers publish peak current for PWM. Typically a LED that has a peak current of 30mA will have a peak current of 100mA at 10% duty cycle.

admin's test signature
 

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

A little OT.
Not far ago I had a very hard time when trying to drive LED displays without enough care about current consumption (from AVR IO pins).
tiny26 behaved in very strange but unfortunately repeatable manner and it take some time before I stopped searching bugs in software and started reconsideration of the hardware design.

Regards,

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

I don't really intend to sell this, but I do want it to last a while.... I let it run all last night, and it didn't go up in smoke, but I haven't considered long term fatigue of the device.
I can't really measure the exact peak current since even with all the segments on, the AVR switches digits 2000 times a second. Capacitance in the test leads seem to average out the current so it doesn't jump around very much. My maximum average current seems to be between 7 and 10mA.

I think I'll just design resistors into my circuit board, and I can mount them if I want to or I can just bypass them. I think maybe I'm assuming too much just to save mounting eight resistors on the board.

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

If you only have 1 led on at a time (through fast switching), you can have only 1 resitor (common to all of them).

Embedded Dreams
One day, knowledge will replace money.