How do pull up and pull down resistors remove electrical noise?

Click For Summary

Discussion Overview

The discussion revolves around the use of pull-up and pull-down resistors in circuits, particularly in the context of Arduino projects. Participants seek to understand the theoretical basis for how these resistors help in achieving reliable digital input values, minimizing random fluctuations due to electrical noise or floating inputs.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants explain that pull-up resistors create a low pass filter effect, helping to stabilize input signals by limiting current during transients.
  • Others argue that pull-up and pull-down resistors assign fixed voltage levels to pins, preventing random voltages from appearing when inputs are left floating.
  • A participant suggests that the input cable acts like an antenna, which is challenged by others who emphasize that the discussion should focus on local PCB layout considerations.
  • One participant shares an experience with CMOS technology, noting that floating inputs can lead to unpredictable behavior due to high impedance and external noise influences.
  • Another participant mentions that internal pull-up resistors in microcontrollers may not always be reliable during certain states, advocating for external resistors for guaranteed levels.
  • Some participants express confusion about the role of resistors in filtering noise versus their function in establishing known voltage levels.
  • A later reply clarifies that the presence of a pull-up resistor ensures that the input pin is in a known steady state, preventing it from floating and causing erratic behavior.

Areas of Agreement / Disagreement

Participants express differing views on the role of noise in the function of pull-up and pull-down resistors, with some emphasizing its importance and others suggesting it is not a primary concern. The discussion remains unresolved regarding the precise mechanisms by which these resistors stabilize input signals.

Contextual Notes

Some participants highlight the complexity of the topic, indicating that the reasons for using pull-up and pull-down resistors can be multifaceted and context-dependent, particularly in relation to circuit design and signal transmission.

kolleamm
Messages
476
Reaction score
44
I’m doing a project with my Arduino, and I’ve seen some tutorials on YouTube explaining how to use pull up or pull down resistors to make the input values on the board reliable, basically either a 0 or a 1 without any random changes from other em sources.
The only thing is I still don’t understand why it works. The videos explain how to create the circuit but not so much the theory behind it.
Any help is appreciated.
 

Attachments

  • F882EDDA-A18A-41E8-AE35-DB1E1626166C.png
    F882EDDA-A18A-41E8-AE35-DB1E1626166C.png
    9.2 KB · Views: 531
Engineering news on Phys.org
IC inputs have some inherent capacitance. The pull-up resistors will make a low pass filter between the power supply (a source of noise) and the input. They also limit the current that can flow during transients in more extreme cases.

There are a few other reasons pull-up resistors are good. I'm sure others will chime in soon to describe those.
 
DaveE said:
IC inputs have some inherent capacitance. The pull-up resistors will make a low pass filter between the power supply (a source of noise) and the input. They also limit the current that can flow during transients in more extreme cases.

There are a few other reasons pull-up resistors are good. I'm sure others will chime in soon to describe those.
From what I’m understanding the input cable is like an antenna, and the resistor essentially reduces its size?
 
kolleamm said:
From what I’m understanding the input cable is like an antenna, and the resistor essentially reduces its size?
What input cable? You didn't say anything about distance transmission, antennas, cables, etc.

That opens up a whole set of additional reasons to put a resistor there which are a bit more complex. Guidance will depend on a good description of the set up for that. So my only comment is that signals that travel over significant distance (significant depends on the frequencies, rise/fall times etc.) benefit from proper transmission line termination (impedance matching etc.). Most good designs will have circuits/ICs dedicated to just transmitting or receiving signals over distance.

In normal engineering speak, pull-up resistors are mostly confined to local PCB layout sort of considerations.
 
kolleamm said:
From what I’m understanding the input cable is like an antenna, and the resistor essentially reduces its size?

no, not correct

using pull-up or pull-down resistors assigns a fixed value to the pin(s) usually +5V or +12V for up and 0V for down
this stops the random voltages from appearing on the pin as noise when the pin(s) is/are left floating
 
  • Like
Likes   Reactions: scottdave and phinds
davenn said:
no, not correct

using pull-up or pull-down resistors assigns a fixed value to the pin(s) usually +5V or +12V for up and 0V for down
this stops the random voltages from appearing on the pin as noise when the pin(s) is/are left floating
Yes! Don't leave pins disconnected (like if you have a switch that might be open). I was assuming the question was about a pull-up resistor vs. direct connection to a power supply.

Also, for many uControllers pull-up resistors may be internal and programmable, then, if you set it up right you don't need anything external; but the concept is the same. One way or another @davenn is absolutely correct, logic inputs should have a defined value in the circuit.

The truth is the various reasons for pull-ups and such can be pretty complex. This is where you will want to just default to "good design practice". Use pull-up resistors unless you know you don't need them.
 
  • Like
Likes   Reactions: davenn
kolleamm said:
The only thing is I still don’t understand why it works. The videos explain how to create the circuit but not so much the theory behind it.
The old TTL technology may not have needed default pullup/pulldown resistors, but CMOS logic certainly does. There are two fundamental issues -- First, the CMOS inputs are very high impedance, so if they are left open, they can float high or low depending on static charge or even loosely coupled EM fields like AC Mains noise on nearby conductors. I once made a neat little LED 8-bit monitor circuit that could probe 8 logic signals and show me their state on the LEDs. I learned quickly that any unconnected inputs could show high or low based on my hand coming close to those inputs (static charge and AC Mains noise). Lesson learned.

Second, if CMOS inputs are floating near their mid-input voltage (say around 2.5V for a 5V CMOS input), the whole logic gate circuit can go into the linear region for the transistors, and conduct significant current from the power rail to ground. Typically it won't be enough current to hurt the logic, but it will put you well above your Icc budget for the circuit.

https://upload.wikimedia.org/wikipe...MOS_inverter.svg/1200px-CMOS_inverter.svg.png

1606872007377.png


kolleamm said:
From what I’m understanding the input cable is like an antenna, and the resistor essentially reduces its size?

As others have noted, an input "cable" changes things a bit, since it presents a stronger signal to the logic input, versus an on-PCBA logic signal. Please clarify. Thank you.

DaveE said:
Also, for many uControllers pull-up resistors may be internal and programmable, then, if you set it up right you don't need anything external;
Be careful in this -- some uCs tri-state their inputs when they are in reset, so the on-chip pullups may go away during resets and the built-in-self-test period. If the levels need to be guaranteed, use external pullups.
 
Last edited:
  • Like
Likes   Reactions: alan123hk, davenn and DaveE
There’s no antenna, that’s just me trying to make sense of the circuit.
I just want to read a reliable digital value with my Arduino, and want to know how pull up or pull down resistors help me accomplish this.
My overall goal is to be able to control a mosfet transistor without any interference in the circuit.
 
Last edited:
davenn said:
no, not correct

using pull-up or pull-down resistors assigns a fixed value to the pin(s) usually +5V or +12V for up and 0V for down
this stops the random voltages from appearing on the pin as noise when the pin(s) is/are left floating
Yes but how
 
  • #10
kolleamm said:
Yes but how
In logic circuits, the input voltage should be at logic 1 or logic 0, depending on the exact configuration. If left unconnected, the input can vary above and below the switching threshholds causing the output to vary at random. The pull-up (or pull-down) resistor ensures that the input is in a known steady state

https://www.electronics-tutorials.ws/logic/pull-up-resistor.html
 
  • Like
Likes   Reactions: DaveE
  • #11
kolleamm said:
Yes but how

The post I told you how, what part didnt you understand ? :smile:
 
  • #12
kolleamm said:
I just want to read a reliable digital value with my Arduino, and want to know how pull up or pull down resistors help me accomplish this.
If the input pin has very low capacitance and does not sink or provide current then even a small amount of charge (from noise) might effect the sensed logic level.
With the additional resistor these random charges are transferred to ground or rail: you need far more charge (than just noise) to set the logic level.
 
  • #13
So does the resistor merely filter out the noise with its resistance or is it part of another circuit that the noise gets sent to?
 
  • #14
Stop thinking about noise, it's nothing to do with noise.

Look at your first circuit: when the switch is open a very small current flows from the +5V rail via the pull-up resistor to the input pin, which signals HI. When the switch is closed a very small current flows from the input pin via the switch to ground and so the input pin signals LO.

If the pull-up wasn't there and the switch was open then the input pin still has to signal either HI or LO, but who can tell which it is going to be? If there is a leakage current to ground then maybe it will be LO, or maybe there is some square wave clock signal PCB trace passing close which induces a current in and out of the pin which oscillates from HI to LO (OK, noise may be something to do with it) - the point is that if you leave it floating you have no guarantee whether it will be HI or LO.
 
  • #15
pbuk said:
Stop thinking about noise, it's nothing to do with noise.

Look at your first circuit: when the switch is open a very small current flows from the +5V rail via the pull-up resistor to the input pin, which signals HI. When the switch is closed a very small current flows from the input pin via the switch to ground and so the input pin signals LO.

If the pull-up wasn't there and the switch was open then the input pin still has to signal either HI or LO, but who can tell which it is going to be? If there is a leakage current to ground then maybe it will be LO, or maybe there is some square wave clock signal PCB trace passing close which induces a current in and out of the pin which oscillates from HI to LO (OK, noise may be something to do with it) - the point is that if you leave it floating you have no guarantee whether it will be HI or LO.
Isn’t the input pin a positive pin? So shouldn’t it flow towards the board’s ground pin? (For HI)
 
  • #16
kolleamm said:
Isn’t the input pin a positive pin?
No, that would make it an output.
 
  • #17
Another way to look at it: take away the resistors from both of the circuits in your OP so all that's left is the switches and the MCUs. When the switches are closed, the first input reads LO and the second input reads HI. When you open the switches, the circuits in the two diagrams are electrically identical; how does the one on the left know that you want it to read HI and the one on the right LO?
 
  • #18
Starting to run out of suitable 'another way' angles...

Well, noise is a weak signal. If there is nothing else the it may be able to determine the logic state of the input pin.
The pullup (or pulldown) is a ... signal. Not really strong (if carefully selected) but far stronger than the expected noise, so it can dominate the logic state of the input pin against the noise.
The signal you want to sense is a strong one: it can (it should) override the pullup (/pulldown) so if there is signal you will 'see' the signal.

... and that's my bottom line o0)
 
  • Like
Likes   Reactions: berkeman
  • #19
What if the only thing connected to the input pin is a loose wire, is it still possible for the controller to pickup the noise?
 
  • #20
kolleamm said:
What if the only thing connected to the input pin is a loose wire, is it still possible for the controller to pickup the noise?
Did you understand my post #7?
 
  • #21
berkeman said:
Did you understand my post #7?
It would experience more noise?
 
  • #22
kolleamm said:
It would experience more noise?
No.
pbuk said:
Stop thinking about noise, it's nothing to do with noise.
berkeman said:
There are two fundamental issues -- First, the CMOS inputs are very high impedance, so if they are left open, they can float high or low depending on static charge or even loosely coupled EM fields like AC Mains noise on nearby conductors. I once made a neat little LED 8-bit monitor circuit that could probe 8 logic signals and show me their state on the LEDs. I learned quickly that any unconnected inputs could show high or low based on my hand coming close to those inputs (static charge and AC Mains noise). Lesson learned.

Second, if CMOS inputs are floating near their mid-input voltage (say around 2.5V for a 5V CMOS input), the whole logic gate circuit can go into the linear region for the transistors, and conduct significant current from the power rail to ground. Typically it won't be enough current to hurt the logic, but it will put you well above your Icc budget for the circuit.
 
  • #23
berkeman said:
No.
So what your saying is that unconnected inputs can experience those fluctuations.
I’m still confused as to how the resistors then solve this problem if they merely act as a filter at a part of the circuit.
 
  • #24
kolleamm said:
So what your saying is that unconnected inputs can experience those fluctuations.
I’m still confused as to how the resistors then solve this problem if they merely act as a filter at a part of the circuit.
They are not a filter. Please un-learn that concept.

The resistors provide a medium-impedance tie to one of the rails, ensuring that the input voltage is well defined. The input impedance of CMOS logic inputs is in the MegOhms, so attaching a 10kOhm pullup/pulldown resistor easily defines the input voltage.

You just need to ensure that whatever your external drive circuit is can overpower the pullup/pulldown resistor to assert the other logic level. You would not use a 10 Ohm pullup resistor, for example, because it would be very hard for a connected logic output to fight that pullup and pull the input pin below Vil to cause a logic low input.

Does that make sense? Can you link a couple of CMOS logic gate datasheets that you've been reading to learn about input Vil and Vih specs and Vol and Voh specs? Thanks.
 
  • Like
Likes   Reactions: .Scott, DaveE and pbuk
  • #25
berkeman said:
They are not a filter. Please un-learn that concept.

The resistors provide a medium-impedance tie to one of the rails, ensuring that the input voltage is well defined. The input impedance of CMOS logic inputs is in the MegOhms, so attaching a 10kOhm pullup/pulldown resistor easily defines the input voltage.

You just need to ensure that whatever your external drive circuit is can overpower the pullup/pulldown resistor to assert the other logic level. You would not use a 10 Ohm pullup resistor, for example, because it would be very hard for a connected logic output to fight that pullup and pull the input pin below Vil to cause a logic low input.

Does that make sense? Can you link a couple of CMOS logic gate datasheets that you've been reading to learn about input Vil and Vih specs and Vol and Voh specs? Thanks.
Can you elaborate more on the medium impedance tie and what exactly you mean by tie. Are you saying it ties another circuit or that it acts as a bridge?
 
  • #26
kolleamm said:
Can you elaborate more on the medium impedance tie and what exactly you mean by tie. Are you saying it ties another circuit or that it acts as a bridge?
It simply means a connection. In the first circuit it ties the pin to 5V (or 'pulls the pin up') and in the second it ties the pin to ground (or 'pulls the pin down').

In your first circuit with the switch closed there is a connection to ground, so the pin reads 0. Open the switch and there is a connection via the resistor to 5V (the current the pin draws is tiny so we can ignore the voltage drop across the resistor) so the pin reads 1. In your second circuit with the switch closed there is a connection to 5V, so the pin reads 1. Open the switch and there is a connection via the resistor to ground so the pin reads 0.

Now take away the resistors.

In your first circuit with the switch closed there is a connection to ground, so the pin reads 0. Open the switch and there is no connection to anything so the pin is 'left floating' and doesn't know what to read. In your second circuit with the switch closed there is a connection to 5V, so the pin reads 1. Open the switch and there is no connection to anything so the pin is in exactly the same condition as in the first circuit: it is 'left floating' and doesn't know what to read.
 
  • Like
Likes   Reactions: DaveE
  • #27
OK - are you familiar with a "thought experiment"... In the diagram showing the input circuit, you see two MOS transistors, their input gate is insulated, and acts like a small capacitor.

So step back and think of only a small (and very good - low leakage) capacitor, one side of it grounded.

Tell me what the voltage across the capacitor is?

You can not - depending on what it is connected to even static may impact the voltage, it is not defined.

Now apply a 5V signal, and then remove it... the 5V may remain on the gate for an unknown period of time.

Now - attach a 10K resistor across the capacitor... NOW what is the voltage on the cap? Unless it is connected to a signal with enough current to keep a voltage on a 10K resistor , the voltage on the cap will go to or drain to zero volts, and be held there.

Yes - this is clearly not ideal, we have added a load to the incoming signal, but the effectiveness of the input on the uC is good enough that we live with these issues.
 
  • #28
Rive said:
Well, noise is a weak signal.
That's a bit too simplistic. MOS circuits have a very high input impedance and they have very high voltage gain all internal signal paths are coupled to each other. If the logic technology can handle thousands of MHz signals then an input can admit that sort of bandwidth of noise or interference and, hence, significant levels signal. Even a short length of internal connecting lead can act as a significantly long 2GHz antenna or coupler, not to be dismissed as zero length when it's right next to another lead carrying signals. You have to ask what value could you find on a floating or uncommitted input pin (perhaps right on the threshold level). A random induced interference spike, appearing on a floating input can take the level high or low. A pull up/down resistor of a low enough value will reduce any induced voltage to something well below a logic level. Coupling can also occur on power supply rails, of course. If the logic technology can handle thousands of MHz signals then an input can admit that sort of bandwidth of noise and, hence, significant levels of brief voltage spikes.

This has always been a problem, even with early logic designs (5MHz clock speeds) and we take it as read that we define every input level in a design - even in unused elements in an integrated circuit.
 
  • #29
sophiecentaur said:
That's a bit too simplistic.
In general, I do agree.
In this particular topic, I feel like it's still not simple enough...
 
  • Like
Likes   Reactions: sophiecentaur
  • #30
Basically it's like this. Imagine that instead of your MCU, it was a voltmeter that was connected between your MCU pin and ground (basically for all intents and purposes, is how a logic input would operate), and on the other side of the voltmeter is another circuit (which would be the rest of the internal MCU circuitry).

Now let's say you designed your program to recognize the switch's CLOSE position with a logic of 0 (in which case, our voltmeter should read 0V). When you let go of the switch (I'll assume this is a simple switch, and not a detented/holding type), how do we make sure that our voltmeter reading registers +5V (switch's OPEN position) at the moment of open circuit, without being affected by the goings on in the other circuit (internal MCU circuitry)?

The reliable answer would be by connecting a pull-up resistor from pin to +5V, in order to ensure that our voltmeter reading is as close to +5V as possible, as soon as possible, as reliably as possible, and force the MCU to acknowledge ASAP that we have opened the switch, and for good. Pull-up resistor value should be significantly large, as we are not trying to pass current, and should therefore minimize voltage drop.

Same narrative with the pull-down resistor for forcing MCU to acknowledge logic 0 (voltmeter reading of 0V) if you want it to recognize logic 0 = switch OPEN.
 
  • Like
Likes   Reactions: sophiecentaur

Similar threads

  • · Replies 33 ·
2
Replies
33
Views
5K
Replies
6
Views
7K
Replies
5
Views
2K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
12
Views
2K
  • · Replies 21 ·
Replies
21
Views
4K