Electronics > Projects, Designs, and Technical Stuff
Pullup or not?
(1/2) > >>
phil from seattle:
So, I have a design which uses a Schmitt trigger on digital input to a microcontroller.  It uses a low pass filter. The input can be a simple switch or some sort of optoisolator (I'm designing it for general use so I have to handle all sorts of cases). Typically it will be an encoder of some sort.  I use a pullup resistor for the cases where a simple switch to ground is used. See the diagram below. This works fine.  But, I tested it without the pullup (R1) with pullups enabled in the uC and it worked correctly, even with the simple switch to ground - i.e no input signal. Looking at the output of the Schmitt trigger when it's not connected to the uC showed the expected random state fluctuations.

It makes sense that it is deterministic when there is a pullup after the Schmitt trigger but am I setting myself up for trouble by doing that?
The uC pullups are in the 50K ohm range.

This isn't so much about saving money but saving space as I'm pressed for room for the resistors in the current design.

ataradov:
You would still have a high-impedance input floating. It generally not a good idea, it will potentially be more sensitive to noise in noisy environments.

I would also move R2 before the diodes. This way it will also act as a current limiter for the diodes if they happen to open.
Miti:
What uC? It may already have ST inputs. If not, yes, you need a pull up/ down.
graybeard:
For a CMOS input a pull-up (or pull-down) is only needed if the input floats.  A floating input is one that is not driven.  This can be either open or tri-stated.  The pull-up or pull-down drives an open input into a known state.

Your low pass filter will prevent oscillation and most, but not all noise.  The leakage currents in your protection diodes and the ones on the chip input will decide if input goes high or low if you omit the resistor.  If the input floats and you do'nt care what state it is in, you can omit the pull-up.  If your design cannot tolerate noise on the input, use the resistor.

As ataradov stated, it would be better to move your clamping diodes inside R2.
wraper:
Circuit looks like a waste of money and parts. If you use switch, for best result you should debounce it in firmware anyway. Also if you use a switch or optocoupler, there should be lower resistance pull-up to ensure reliability, and directly connected to the switch/optocoupler, not through another resistor in series. Also many MCUs already have inputs with Shmitt trigger and internal pull-up.
Navigation
Message Index
Next page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod