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

  • Thread starter kolleamm
  • Start date
  • #1
412
36
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

Answers and Replies

  • #2
DaveE
Gold Member
1,109
832
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.
 
  • #3
412
36
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?
 
  • #4
DaveE
Gold Member
1,109
832
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.
 
  • #5
davenn
Science Advisor
Gold Member
9,394
8,275
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 phinds
  • #6
DaveE
Gold Member
1,109
832
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 davenn
  • #7
berkeman
Mentor
58,755
8,877
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


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.

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 davenn and DaveE
  • #8
412
36
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:
  • #9
412
36
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
75
33
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 DaveE
  • #11
davenn
Science Advisor
Gold Member
9,394
8,275
Yes but how
The post I told you how, what part didnt you understand ? :smile:
 
  • #12
1,734
1,058
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
412
36
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
pbuk
Science Advisor
Gold Member
1,874
721
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
412
36
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
pbuk
Science Advisor
Gold Member
1,874
721
Isn’t the input pin a positive pin?
No, that would make it an output.
 
  • #17
pbuk
Science Advisor
Gold Member
1,874
721
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
1,734
1,058
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 berkeman
  • #19
412
36
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
berkeman
Mentor
58,755
8,877
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
412
36
Did you understand my post #7?
It would experience more noise?
 
  • #22
berkeman
Mentor
58,755
8,877
It would experience more noise?
No.
Stop thinking about noise, it's nothing to do with noise.
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
412
36
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
berkeman
Mentor
58,755
8,877
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 .Scott, DaveE and pbuk
  • #25
412
36
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?
 

Related Threads on How do pull up and pull down resistors remove electrical noise?

  • Last Post
Replies
6
Views
4K
  • Last Post
Replies
5
Views
1K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
7
Views
16K
  • Last Post
Replies
1
Views
1K
Replies
9
Views
2K
  • Last Post
Replies
22
Views
7K
  • Last Post
Replies
13
Views
993
Top