Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

multiple LEDs per pin

Status
Not open for further replies.

MrDEB

Well-Known Member
Plan on running an 18LF1220 pIC with multiple LEDs (1-?) per pin. The PIC is to be operated on a 3v coin cell.
Thinking hopefully being able to do this without resistors?
Going to be "jewelry" for Christmas.
Plan is to program the PIC with several different patterns using PWM, blinking etc.
Any creative ideas?
 
At that voltage a single I/O pin will have trouble driving one LED from a coin cell but it should produce something worth looking at no current limit resistor required. Lifespan may not be very good though, and the blink rate will change as the voltage drops and the internal oscillator changes frequencies, but again it should still produce something worth looking at, simple write the code, hotwire the power leads to a coin cell and a few I/O lines to the LED(s) and give it a go. I would recommend trying to incorporate at least a single bypass capacitor on VCC/GND, but you can forgo it and see what happens, it might be glitchy around static discharge, (or outright fry from some demon sweater carrying 12,000 volts ;))

Keep in mind a half hour to and hour and a half or is about the best you'll be able to expect from it.
 
Less than 2 hours run time?
If I use PWM perhaps longer?
Use one LED per pin
I tried calculating LED resistor using an online calculator and came up with 56 ohms. Without = 2 amps?
Perhaps one resistor? for all the leds?
Got to be a way to achieve a longer run time? Reason for using the LF series pIC.
 
simply by using a 10f smd chip and smd resistors and Led's would cut the power drain down to a minim and the circuit board wouldn't be much bigger than the coin cell either...
 
The PIC outputs are safely current limited to 15 - 25mA, depending on the chip.

I never use resistors for any LED's connected straight to a PIC, and I never have any hassles with blowing outputs or LED's.

You don't need a resistor unless you want to reduce the current, which can be done by pwm anyway.

If you are parallelling the LED's you should probably use a resistor for each LED anyway.
 
Last edited:
ive always assumed the quoted 20ma per pin was a guide as to the maximum you were allowed to draw from the pin. i have never thought it was a actual limit as to what the pin would output???
 
I've never seen any documentation that states that a PIC port pin is current limited.
"Current Limited" suggests active circuitry exists to actively reduce the output current when the load impedance is too low.

What they do have is a "Current Limit" in which you are capable to drawing more than that but may result in damage to the IC.

The limit is likely due to the aluminum wires connecting the pins to the die which is why you have a current rating for each pin and each port.

In this case, since the PIC and LED are driven from a coin cell, the LED would likely need very little series resistance to stay in spec of the LED and port pin.
The Ron of the output FETs and the ESR of the coincell may actually be enough to keep it limited enough.
Though for a lower current and longer lifespan a series resistor is likely needed anyway.
 
Last edited:
I've never seen any documentation that states that a PIC port pin is current limited.
"Current Limited" suggests active circuitry exists to actively reduce the output current when the load impedance is too low.

What they do have is a "Current Limit" in which you are capable to drawing more than that but may result in damage to the IC.

Try it. Hook up a multimeter and measure the current through a LED without a resistor. The current will stay steady at the current limit, depending on which PIC. It certainly doesn't damage the IC, I do this all the time with many different PICs. That suggests to me that there is active current limiting going on, yes?

In saying that I cannot find anything to do with the current limiting in the datasheets, either.

Have a look at this video.
 
the problem is how do uou wich pic and wich pins are ok? for me is easier to just put a resistor in. as for space if you use a smd 0805 resistor then board space taken is praticaly nothing, i am not saying it cant or shouldnt be done but a personal preference is to use a resistor. i would love to know tho wether there is current limiting actively put in a pic or wether its just some kind of 'side effect' of the pin mosfets or whatever. if anyone has a difinitive answer i would love to know.
@ Mr deb
if run time is essential then i would have thought you will need to get creative and use all the tricks in the book like deep sleep between flashes etc, maybe one of those microchip chips that get the last smidge of juice out the battery (sorry cant remember the part number), run the led <10ma.
 
Last edited:
Ghostman, you are right. It is not in the datasheet so you should always use a resistor to keep within spec. You also bring up an interesting point - how do you know which pins are safe to do it or not?

Because it's not in the datasheet I probably shouldn't be advising people to do it but rest-assured I've done it hundreds of times without a problem.
 
i got a couple different pics kicking around and more than a few leds :D i am trying different pics and pins and seeing if theres any diference in the pics or pins regarding what they draw. only change is i am using a PSU instead of a button cell so that might make a difference. if i blow the pics its no big deal i would like to know what the deal is regarding current draw on the pins
 
MrDeb, even in sleep the 18F itself will be the primary power draw in the long term not the LEDs.
 
MrDeb, even in sleep the 18F itself will be the primary power draw in the long term not the LEDs.

Hi Sceadwian.

The PIC18F1220 in primary run mode (external crystal) uses only 150 μA (@ 1MHz, 2v). In sleep mode it uses only 0.1 μA (@ 2v). I assume the PIC will be sleeping a majority of the time considering it is being designed for low power consumption. The PIC18LF1220 may use even less.

Even a single LED running at 5mA uses a few orders of magnitude more power than that.
 
Last edited:
Try it. Hook up a multimeter and measure the current through a LED without a resistor. The current will stay steady at the current limit, depending on which PIC. It certainly doesn't damage the IC, I do this all the time with many different PICs. That suggests to me that there is active current limiting going on, yes?

I actually did a similar test. I don't have any 18F of 16-bit PICs so I can't say for them.
But I do have some baseline and mid-range PICs to test on.
Test conditions:
  • PICkit2 used for variable power supply
  • PIC16F506, PIC16F616
  • All peripherals disabled, output capable pins set as outputs and toggled every 3 seconds in code.
  • Supply voltage was adjusted to show different SC currents
  • DMM connected directly from one pin to supply then from one pin to ground.

Results:
5v on the 16F506: A HIGH pin would draw 29mA from ground. A LOW pin would draw 64mA from supply.
4v on the 16F506: A HIGH pin would draw 21mA from ground. A LOW pin would draw 50mA from supply.
3v on the 16F506: A HIGH pin would draw 12mA from ground. A LOW pin would draw 32mA from supply.

5v on the 16F616: A HIGH pin would draw 32mA from ground. A LOW pin would draw 64mA from supply.
4v on the 16F616: A HIGH pin would draw 24mA from ground. A LOW pin would draw 51mA from supply.
3v on the 16F616: A HIGH pin would draw 13mA from ground. A LOW pin would draw 32mA from supply.


The current would indeed stay the same, that is until you change the supply voltage.
The short-circuit current would change linearly with supply voltage.
That suggests there is no active current limiting and the short-circuit current is limited only by the Ron of the output fets and the resistance of internal connections.

At 5v, the low-side FET has roughly 78Ω of Ron, with a green/blue/white LED rated at about 3.2v, the LED would pull about 23mA, close to the rated current limit of the pin.
At 5v, the high-side FET has roughly 167Ω or Ron, with a green/blue/white LED rated at about 3.2v, the LED would pull about 10mA.

I did some actual tests with an LED in series with the DMM but didn't type the results out as they mirrored the math above.
The fact that the LED current stayed at the current limit was a pure coincidence as the FETs Ron was just enough to maintain that.
Any lower voltage LED (red, orange, yellow, lime green) would draw much more current.

To put it simply: There is no active current limiting circuitry on a baseline or mid-range PIC's output pin.

Though the tests did prove that the output FETs have enough Ron to limit LED current across most of supply voltage range.


If the OP needs to, he can forgo a series resistor and connect the LED from an output pin to ground as at 3v the Ron would be more than enough to limit the current.
I don't have any 18F or any 16-bit PICs so would anyone who does consider doing the test on them as well?
 
Last edited:
yeah i have 18f's i will have a go with them. what your saying backs up the fact there is no info in the datasheet, so like you say i guess its pure luck it works out that way!
as for a pic in sleep drawing more current than the leds being used........i take it you havent read the datasheet then scead! especialy the low power ones draw next to nothing and microchip have alot of info on running pics to get the max life from a battery.
It would be worth a good trawl on there totaly awful site Mr Deb, burried amongst it all is alot of info on how to get the little blighters yo use as little power as possiable, but be prepared to jump through a few hoops to get the most out of them
 
To put it simply: There is no active current limiting circuitry on a baseline or mid-range PIC's output pin.

Though the tests did prove that the output FETs have enough Ron to limit LED current across most of supply voltage range.

After a second thought I do agree with you that that is the case.

Though, as I emphasised, I've never, ever had a problem using an LED or 2 without a resistor from a PIC.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top