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.

LED as a pullup?

Status
Not open for further replies.

Mark_R

Member
Hi,
Please consider the attached circuit.

This is a Fairchild MID400 AC monitor IC. When AC is applied to its input (pins 1 & 2) its output (pin 6) goes low. The output is being monitored by a GPIO of a PIC with a 10K pullup. I added the LED and series resistor for visual indication of the output state.

The question is; do I still need the 10K pullup? Would the LED and series resistor pullup the output?

My thinking is that I still need the 10K as when the output is off the diode would not be biased past its turn on voltage and would effectively do nothing. Or not. :confused:

Thoughts?

EDIT: RA0 in the diagram goes to the PIC
EDIT2: I fixeed the schematic so that Vcc is at the top, per convention. Sorry for the confusion.
 

Attachments

  • mid400.jpg
    mid400.jpg
    38.4 KB · Views: 1,399
Last edited:
The output of a PIC goes high or low. It doesn't need a pullup resistor.
 
The output of a PIC goes high or low. It doesn't need a pullup resistor.

Its not the output of a PIC, its the output of a IC which is the collector of a NPN transistor. see attached internal circuit from the datasheet. It's being monitored by the input of a PIC.

EDIT:
THIS IS NOT MY CIRCUIT.... THIS IS THE INTERNAL DIAGRAM OF THE MID400 OPTOISOLATOR (U6) IN MY CIRCUIT.
Sorry for the confusion. My circuit is in the OP.
 

Attachments

  • mid400 internal.jpg
    mid400 internal.jpg
    40.9 KB · Views: 737
Last edited:
Its not the output of a PIC, its the output of a IC which is the collector of a NPN transistor. see attached internal circuit from the datasheet. It's being monitored by the input of a PIC.

hi,
The MID400 can sink up to 20mA so that 220R/LED is OK, just omit the 10k.
 
hi,
The MID400 can sink up to 20mA so that 220R/LED is OK, just omit the 10k.

Hi Eric,
I know that the LED will function fine, my concern is proper function of the PIC. The primary function of the MID400 is to monitor an AC line and provide status to the PIC. The LED was added later in the design.
So are you are saying that the LED and series resistor WILL pull up the output of the MID400 (when "OFF") to a high enough level to be recognized by the PIC as high?
 
The LED will cause a voltage drop of a volt or two. So, the voltage you will sense will be VCC-Vd, where Vd is the drop of the LED. I'd just leave in the 10K resistor. I don't see that it hurts anything to have it in there.
 
Last edited:
The LED will not pullup high enough for the PIC to see a logic high. Use the 10k pullup resistor to do it.
 
The LED will not pullup high enough for the PIC to see a logic high. Use the 10k pullup resistor to do it.

Using a green led, with a Vfwd of 2.1V will, with leakage current will pull up the HiZ input of the PIC to 3.6V.

As the Vmin high is 2V, the PIC easily sees the 3.6V as a logic high.

This method is frequently used without problems.

I would agree with Brownout, if the OP is concerned, for the price of a 0.1p resistor leave it in the circuit.

EDIT:
To confirm this, I have just tried a it on a PIC input and it does pull up to 3.5V, which the PIC recognises as a High/
 
Last edited:
Isn't a PIC made with high-speed Cmos like 74HCxxxx? Their logic high is a minimum of 3.5V. If the LED is a visible one then it will not have only a 1.2V drop of an IR one. If it is red it might drop 2.0V and the logic will be 3.0V which is not a valid logic high. If it is an old 2.2V green LED or a new 3.5V green, blue or white LED then the LED voltage drop is much too high.
 
Using a green led, with a Vfwd of 2.1V will, with leakage current will pull up the HiZ input of the PIC to 3.6V.

As the Vmin high is 2V, the PIC easily sees the 3.6V as a logic high.

This method is frequently used without problems.

I would agree with Brownout, if the OP is concerned, for the price of a 0.1p resistor leave it in the circuit.

EDIT:
To confirm this, I have just tried a it on a PIC input and it does pull up to 3.5V, which the PIC recognises as a High/

Thanks for the effort Eric. I think for the price of the resistor I will leave it in. One less part of this design to worry about.
 
Isn't a PIC made with high-speed Cmos like 74HCxxxx? Their logic high is a minimum of 3.5V. If the LED is a visible one then it will not have only a 1.2V drop of an IR one. If it is red it might drop 2.0V and the logic will be 3.0V which is not a valid logic high. If it is an old 2.2V green LED or a new 3.5V green, blue or white LED then the LED voltage drop is much too high.

This a clip from the PIC datasheet.

If you dont believe me, you are welcome to come and visit and see it working...

The tea/coffee and doughnuts will be on me.:)
 

Attachments

  • AAesp05.gif
    AAesp05.gif
    19.8 KB · Views: 342
If airfare is included, I'm there!

hi,
Perhaps next time...:)
For reference only, I have done some more testing for the led/resistor pull up.

Using a range of CMOS IC's, and Gn, Rd, Wh, Bl LED's there is sufficient voltage/leakage current to pull the IC's input to a logic high.

Even with the Wh and Bl LED's the inputs pull to 2.8V and the outputs change state.
 
You need the pull-up.

LEDs are photodiodes. In bright light they will generate a microamp or so, and the voltage will rise to about what Vf would be at one microamp in the dark.

So if you don't want a circuit that works differently when you put the lid on, use the resistor.

I have had a PIC input operate from an LED in sunlight. It was connected between ground and the PIC input, and the lower threshold for some PIC inputs may make that easier than if the LED is used as a pull up.
 
You need the pull-up.

LEDs are photodiodes. In bright light they will generate a microamp or so, and the voltage will rise to about what Vf would be at one microamp in the dark.

So if you don't want a circuit that works differently when you put the lid on, use the resistor.

I have had a PIC input operate from an LED in sunlight. It was connected between ground and the PIC input, and the lower threshold for some PIC inputs may make that easier than if the LED is used as a pull up.

In the OP's configuration, any increase in light intensity falling on the unlit LED increases the input high voltage to the PIC input.

His circuit works equally well in total darkness and sunlight.
 
In the OP's configuration, any increase in light intensity falling on the unlit LED increases the input high voltage to the PIC input.

His circuit works equally well in total darkness and sunlight.

The OP's circuit had the LED connected between Vcc and an input. In bright light, if there were no pull-up, the increasing voltage across the LED would lower the input voltage.
 
The OP's circuit had the LED connected between Vcc and an input. In bright light, if there were no pull-up, the increasing voltage across the LED would lower the input voltage.

It dosn't, it increases the voltage to the input due to the increase in leakage current.
I suggest you try it on your project board, as I have been doing for the past few minutes with various CMOS IC's and LED types.

If you look at my post #14, I measure a minimum of 2.8V at the input when dark, this rises to 2.91V when brightly lit.
 
I think it works because Vf is lower at very low currents.
 
It dosn't, it increases the voltage to the input due to the increase in leakage current.
I suggest you try it on your project board, as I have been doing for the past few minutes with various CMOS IC's and LED types.

If you look at my post #14, I measure a minimum of 2.8V at the input when dark, this rises to 2.91V when brightly lit.

I guess it depends on the load and the conditions. There is very little current available from an LED, and even the input current of a DMM will make a difference.

I have certainly measured the voltage across an LED, with no other components at all, and the voltage is larger in sunlight. I have no idea what the leakage current would be if there is an applied voltage.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top