Driving LEDs from PIC weak pullup, saving resistors?

Now that I found that most people drive LEDs (the bright ones) with less then half a milli amp, I just did a test with a PIC:

Configured pin as input, activated weak pull up, LED between ground and pin, LED burns nice low brightness. To switch the LED off, configure port as out and level zero, or perhaps disable weak pull up.

This save any resistors driving LEDs :-)

The weak pull ups are specified from 50 to 400uA, with 250uA as typical. The difference in one PIC is probably very low, making nice equal LED current. I tried with a red high brightness LED and it looks really nice, measured about 200uA.

Any comments? This bad?

If I was Apple I sure would patent this. Claim, anyone attempting to now patent this, will be faced with prior art. I am releasing this solution IN THE PUBLIC DOMAIN. Jan Panteltje (c) 2008 Sun Jan 6 14:22:55 CET 2008

end of posting

Reply to
Jan Panteltje
Loading thread data ...

What voltage does that weak pull-up current source develop across the LED and what internal CMOS is looking at it?

Reply to
Fred Bloggs

ent.

Your driving the LED with an input pin? That must be a mistype.

formatting link

Reply to
www.interfacebus.com

This should be prohibited under the law since it contributes to the global warming. You should drive the ROHS LED by the green PWM at maximum environmentally friendly current, so the energy waste would be minimal.

VLV

Reply to
Vladimir Vassilevsky

On a sunny day (Sun, 6 Jan 2008 09:08:03 -0800 (PST)) it happened "

formatting link
" wrote in :

No it is no typo, the inputs can have a weak pull up MOSFET, and that current is enough to light a modern high brightnes LED. The pull ups can be enabled and disabled via software too.

Reply to
Jan Panteltje

.

urr=3D

rt.=3D

xt -

Many IC pins have programmable input resistors, there for line termination and to control floating lines and so on.

Hmm, it's called an "input" for a reason, I'm unsure why you would do that. Do you have the PIC number so I can take a quick look at the data sheet.

formatting link

Reply to
www.interfacebus.com

On a sunny day (Sun, 6 Jan 2008 09:43:38 -0800 (PST)) it happened "

formatting link
" wrote in :

It goes for most, if not all, PICs I know, I am using a 16F690 now. The reason is, as I stated, that moderne high brightness LEDs are way too bright at say even 1mA, and people like to drive these at levels as low as 400uA these days, to reduce eye damage :-) This requires some resistors, but using the weak pullups has enough current for normal LED signalling use, and saves resistors. This became only possible now the LEDs shine bright already at 200uA.

Reply to
Jan Panteltje

te=3D

Ok, most of those pins appear to be I/O pins. What pin are you using?

formatting link

Reply to
www.interfacebus.com

On a sunny day (Sun, 6 Jan 2008 09:59:13 -0800 (PST)) it happened "

formatting link
" wrote in :

Yes, they are almost all IO pins. The TRIS (TRISB for port B) bits indicate if the pin is an input or output.

So you can do: bsf TRISB, 1 and that pin (RB1) will be configured as input. You need to globally enable weak pull ups with bit NOT_RABPU in OPTION_REG, then have individual control for each pin in the WPUB register. See page 72 of the 294 page document on the PIC 16F690.

Reply to
Jan Panteltje

You could certainly configure the port to be an output and drive the led pwm to control brightness, but I think the energy used would be the same.

Unless you add a series inductor, in which case the whole thing becomes a synchronous switcher.

John

Reply to
John Larkin

ted=3D

.
,
-

Hm, so your drawing 200uA, what's the voltage drop across the diode?

Reply to
www.interfacebus.com

It is better then shorting a pullup to the ground; as for the PWM control, it is not too obvious because of the nonlinear conductance and capacitance of the LED.

Did you account for the energy required to build the inductor and to put it on the board? :)

VLV

Reply to
Vladimir Vassilevsky

On a sunny day (Sun, 6 Jan 2008 10:56:06 -0800 (PST)) it happened "

formatting link
" wrote in :

1.77V @ 200uA red LED.

Click for pizza

Reply to
Jan Panteltje

Jan mentioned that he got dark by reconfiguring the port, so no power is wasted then.

I assumed that the copper was recycled from the recent remodel of Al Gore's mansion.

John

Reply to
John Larkin

Ok, that's to high to be a valid low voltage, is that a valid high voltage? Data sheet says a valid high is 2v or [.25xVdd +.8] or are you operating in an invalid voltage range?

formatting link

I think your input is oscillating and burning up that pin, but that's just me......

Reply to
www.interfacebus.com

Interesting point. Even if it's not oscillating, the input cmos transistors may be biased in their linear range and wasting a lot more current than the chip is dumping into the led.

We recently had some tiny-logic cmos gates powered from +5 but logically driven from +3.3. They work, but glow nicely on a thermal imager.

John

Reply to
John Larkin

On a sunny day (Sun, 6 Jan 2008 11:31:12 -0800 (PST)) it happened "

formatting link
" wrote in :

I did not notice any current increase, you cannot burn a PIC with 2.5 mA Idd. In fact I think any voltage on the input is valid, but some thresholds are set for logic 0 and logic 1. It is irrelevant if it is a valid high if you drive a LED, and no, it is not oscillating.

Reply to
Jan Panteltje

On a sunny day (Sun, 06 Jan 2008 11:39:57 -0800) it happened John Larkin wrote in :

I think you should take into account that many of the PORT inputs also can be configured as AD channels, and the diagram shows some sort of analog mux at the input, then followed by a D flop, and also branched to a schmitt trigger for the other logs. Page 75 etc of the pdf.

Reply to
Jan Panteltje

Perhaps using PIC inputs that include Schmitt triggers would keep the supply current down. To be sure, I would have to dive into the data sheet for the particular PIC in question.

--
Regards,

John Popelish
Reply to
John Popelish

Well that's up to you. This is digital Logic right, so you can only have a high or low. Any other voltage level is undefined, and the IC is no longer guaranteed to function, that's why they put those numbers in the data sheet.

What I don't know is what other logic circuit inside the device is looking at that level ~ wondering what to do with it ~ I already closed the data sheet. Your not really driving the LED, your sourcing current out of an input pin ~ could be 50 other CMOS FETs inside with invalid input voltages.

Leroy ElectricaL Engineer; 1984

Reply to
www.interfacebus.com

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.