comsuming mA from uC pin

Status
Not open for further replies.

skmdmasud

Member
Hi..
i made a 7segment clock using atmega8. I connected the 7segment pins with 500Ω resistor to uC , i did not use any transistor. My 7Segment each leds are rated 2V 20mA. the display is bright enough and i like it. Will this arrangement kill my uC because i am consuming quite a good amount of Amp. I was not able to find how much mA atmega8 can handle as output.

Thanks and regards.
 
Last edited:
from page 243 of the data sheet for the ATMEGA8, electrical specifications:



5v voh - 2v vled = 3v (worst case, since voh would be 4.2V @ 20mA, higher for a lower mA)... 3v/500ohm = 6mA per LED. assuming four 7 segment LEDs, 28 x 6mA = 168mA total. Well within the 300mA limit.
 
Last edited:
Thanks Mike.
thats great, this means i can reduce my resistor and increase the brightness. What happens if i go over 300mA, will it automatic shut down or will it get burn?
 
again, from the data sheet... read the notice to the right...
it may do nothing, one day it may quit working, any or all of it...

 
The whole chip will run hot if you get close to 300mA. If it is in open air or has a little heatsink it would be reliable, but with no heatsink and in a hot enclosure it could eventually kill the chip (enclosure can be hot especially if they have a mains transformer and voltage regulator inside).

Maybe you could try driving half of the display on, then the other half, and use 12mA per segment? Sometimes displays appear brighter if pulsed with higher currents even though it is the same average current. This is something to do with the way the human eye works. The frequency needs to be >150Hz or so so the eye can't see flickering.
 
Hi..
I should read the datasheet more carefully. Thanks Mike for info from datasheet. I see that Maximum Operating Voltage is 6V which is great i have lots of 6V regulators i can use them, i previously thought uC only runs at 5V because every where in every example people use 5V.

Mr RB can i just superglue a small aluminum plate on the back of the uC if i find that my uC is runnign hot?

My 7segment 4 digit is multiplexed so we can say as Mike calculated 6mA per led and 7 leds per segment = 6mA X 7 leds = 42mA, so 42mA will be drawn at any given time . I think i am good to go....
 
You never want to run parts at, or even near, their maximum operating points.

The reason that 5 volts is used even though parts can tolerate 6 volts, is so tolerance of voltage accuracy, and transient voltage spikes, don't kill the parts.
 
Exactly like Chris said, you NEVER want to exceed ABSOLUTE MAX Ratings, so don't operate near them...
but you can do this:

View attachment reg.PDF

and in a lot of my designs, I actually do this, but diode isolate the uC from the 5V line, so my in circuit programmer doesn't try to run the rest of the board.

View attachment cpu1.PDF
 
Last edited:
My 7segment 4 digit is multiplexed so we can say as Mike calculated 6mA per led and 7 leds per segment = 6mA X 7 leds = 42mA, so 42mA will be drawn at any given time . I think i am good to go....

if you're already multiplexing, you can drive them a lot harder... try 220 ohm resistors (5-2/220 = 13.6mA; 13.6 mA x 7 = 95mA. This is good for port C. As long as you are driving from port B or D, you can go down to 150 ohm resistors to drive the spec'd 20mA (7 x 20mA = 140mA). The absolute max is 40, so you're good to go from there.
 
Last edited:
I just learned something the hard way yesterday, I thought you couldnt 'blow' a pics o/p pin as there is internal current limiting, but after I accidently connected the o/p of a portb pin to the +5v power pin of an lcd display the pic o/p 'blew' and is now permanently high.
Silly powertip displays where the pin no.s go 15,16,1,2,3.
Another thing that tends to wreck io on the pic is when you try to take the pin volatge above or below vcc or gnd, it shorts the protection diode.
 
and if you do it without resistance, you get unlimited current (well, limited by your supply, of course), so yes it'll blow the diode. That reminds me of the first time I tied an LED from +5V to ground, it got really bright, for about half a second, then, not so much... but was a valuable lesson (oh, the resistor really is needed)...

However, I just took an LED flashlight apart. They don't use resistor limiters, they use the internal battery resistance to limit current. It uses 9 LEDS in parallel, tied directly to the 4.5V coming off the 3 battery string.
 
I will stick with resistors of safe value, dont want to burn my uC. Its very disappointing for beginner like me when components get burned. I already burned 2 uC mysteriously, i will put up a new post for that.

I have burned countless number of High power leds in the past. It all stopped after i made swishing power supply for led which turned out to be very very successful.

Regards.
 
the values I've given should be safe to use, but better to be cautious, I guess. I myself NEVER drive LEDs straight from the processor, I always use a buffer.
 
Theres another thing about pulling ma from a pic pin, if the current limiter operates and lowers the logic high voltage then you can get the well known rmw issue, read-modify-write, do a google for it, myself like many others have been legged up by this issue many times.
 
Last edited:

It's annoying when that happens!

I have a 5v DC regulated PSU for doing breadboard work etc, the 5v PSU has current limiting, selectable at 20/50/100mA.

Thta is REALLY handy and saves my chips all the time, as I first test it switched to 20 or 50mA and if there is a short the PSU just goes into current limiting and the LED goes off (so I know) and nothing can be harmed.

For anyone doing a lot of digital work I really recommend adding a current limit to your 5v DC supply!
 
Last edited:
Theres a long going argument between atmel and arizona.
Ford escorts and ford consuls were both cars, and people liked one or the other.
My 5v supply does have current limit, if you have an lcd with a backlight you need enough ma to run it, which usually means enough ma to blow the pic.
It just so happens I'm working on another supply right now, in fact thats how the last pic bought it.
 
some pics of my clock come timer. I am using 520Ω to drive the 7segmen because thats all i had in hand. In my next edition i will decrease the Ω.

My timer/clock has 3 button just next to the 7segment, one button to choose set clock or set on or set off you can see a horizontal line in top,middle and bottom as per selection. 2nd button for hour++ and 3rd button for min++. no - it goes to max then to zero. The 2nd and 3rd button has another function, in normal running mode 2nd button shows on time and 3d button shows off time when pressed. Red light is power on, white light is relay on.






Regards..
 
I think the LED currents are WAY higher than only 6mA. Mike read the datasheet where is said that when Vcc (the power supply voltage) is only 3V then the output current is only 6mA. But when Vcc is 5V then the maximum output current is higher than 20mA.

Microcontrollers use high speed Cmos. The datasheet for a high speed Cmos IC shows with a 5V supply the output current into a short circuit is typicaslly 55mA and into a 2V red LED its output curent is typically 50mA without any current limiting. That will blow up the IC. Use current-limiting resistors.
 

Please don't drink before posting. If you look at my calculations, I used a Voh (output high voltage of uC I/O pin) of 5V (spec shows 4.2 at test current, which is 20mA). HE IS USING A CURRENT LIMITING RESISTOR, so voh 5V - LED Voltage 2V = 3V across the resistor. 3V/500 ohm = 6mA. (actually, 520 ohm so 3V/520 = 5.77mA, AND he is multiplexing at 25% duty cycle.)
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…