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

In summary: Pull-up resistors (or any resistor for that matter) are often used as a form of low-pass filtering to reduce or eliminate extraneous noise on an input, or to limit the current that can flow during transient events.What input cable? You didn't say anything about distance transmission, antennas, cables, etc.
  • #1
kolleamm
477
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: 331
Engineering news on Phys.org
  • #2
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
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?
 
  • #4
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.
 
  • #5
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 scottdave and phinds
  • #6
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 davenn
  • #7
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 alan123hk, davenn and DaveE
  • #8
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
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 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 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 .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 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 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 sophiecentaur
  • #31
Rive said:
In general, I do agree.
In this particular topic, I feel like it's still not simple enough...
Too much simplicity can give the wrong lesson though, although I can see I wrote rather a lot. :wink:
Fact is that circuit theory is actually complicated and you can't safely take short cuts.
 
  • Like
Likes Rive
  • #32
kolleamm said:
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.
Yes @berkeman is right, you should ignore noise and filtering for now.

I'm afraid I mislead you with my earlier post where I mentioned filtering in response to your "noise" related question. I was thinking of different, and frankly, uncommon noise problems in logic circuits. It's not that there is no filtering or noise issues, but they are subtle and rarely an issue in normal environments.

It sounds like your issue is inputs that might have an undefined digital input because the circuit connected doesn't force a valid digital 1 or 0 level.

The image below is part of the datasheet for a common CMOS IC. Consider the Vih and Vil specs. These define when the device will interpret your input voltage as a logic high (Vih) or logic low (Vil). Your device will also have a datasheet like this, although you may need to search a bit to find it.

Vih.jpg


What they are telling you here is that if you want the input to be read as high you must provide a voltage greater than the minimum value of Vih (>3.15V when operated from a 4.5V power supply). If you want the input to be read as low you must provide a voltage less than the maximum value of Vil (<1.35V when operated from a 4.5V power supply). As your input changes levels the device will switch at some voltage between these two guaranteed levels. So for reliable operation, you need to avoid an input voltage in the middle of this range. An input which is disconnected (like an open switch, for example) could be at any voltage. Avoid that.

edit: Some other logic families may also give you a specification for the current required by your circuit to drive the input high or low. These are normally called Iih (the current into get the input high) and Iil (the current out to get the input low). They don't have that for these simple CMOS inputs because the current is really small (typically 0) and in either direction, so, instead, you'll find an input leakage current spec somewhere else in this data sheet which may look like ±1μA, or something similar.
 
Last edited:
  • #33
This link https://NDAcademy.FoxPing.com/ => Electronics is Easy? => 5.1 Digital Component Basics --- and 3.5 FETs (Field Effect Transistors) --- describe the role of pull-up and pull-down resistors.
 
  • #34
DaveE said:
uncommon noise problems in logic circuits.
If you are including interference and crosstalk in that comment then it's very common when using a technology at its maximum. An unterminated input pin can attain a level that takes it 'either way'. Why take the risk? Just give it a defined level.
 
  • #35
berkeman said:
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.

This is very correct and important, the following is a real example of my own experience.

I used to work in a company that designed and produced electronic quartz watches. If we received thousands of microcontroller mask chips, and then discovered that the software engineer had forgotten to use a resistor to connect one of the microcontroller’s input ports to power or ground, it would have disastrous consequences for the company, not only financial loss, but also unable to deliver the goods to the customer on time.

The current consumption of the watch is just about one 1.5uA, for a 20mAh coin cell battery, the battery life is around 20/0.002 = 1.5 years, as long as there is one CMOS input port of the microcontroller floating, the consumption current may jump from 1.5uA to 5uA, this will greatly reduce the battery life from 1.5 years to less than half a year.

Even if it does not affect all other functions of the watch, no one will buy a watch with a battery life of less than half a year. 😢
 
  • Like
Likes sophiecentaur
<h2>1. How do pull up and pull down resistors work?</h2><p>Pull up and pull down resistors are used to stabilize the voltage level in a circuit. A pull up resistor is connected between the power supply and the input signal, while a pull down resistor is connected between the input signal and ground. These resistors help to ensure that the input signal remains at a known voltage level, even when there is no active input signal. </p><h2>2. Why are pull up and pull down resistors necessary?</h2><p>Without pull up and pull down resistors, an input signal that is not actively driven by a source can float and cause electrical noise in the circuit. This can lead to incorrect readings or malfunctions in the circuit. Pull up and pull down resistors provide a stable reference voltage for the input signal, preventing it from floating and causing noise.</p><h2>3. How do pull up and pull down resistors remove electrical noise?</h2><p>Pull up and pull down resistors remove electrical noise by providing a stable reference voltage for the input signal. This ensures that the signal remains at a known voltage level, reducing the effects of any noise that may be present. Additionally, these resistors can help to filter out high frequency noise by acting as a low pass filter.</p><h2>4. What is the difference between a pull up and pull down resistor?</h2><p>A pull up resistor is connected between the input signal and the power supply, while a pull down resistor is connected between the input signal and ground. The main difference is the direction of the current flow. In a pull up resistor, current flows from the power supply through the resistor to the input signal, while in a pull down resistor, current flows from the input signal through the resistor to ground.</p><h2>5. How do I choose the appropriate value for pull up and pull down resistors?</h2><p>The value of the pull up or pull down resistor will depend on the specific circuit and the input signal it is connected to. In general, the resistor should be large enough to prevent excessive current flow, but small enough to avoid affecting the performance of the circuit. It is important to consult the circuit's specifications and do some calculations to determine the appropriate resistor value.</p>

1. How do pull up and pull down resistors work?

Pull up and pull down resistors are used to stabilize the voltage level in a circuit. A pull up resistor is connected between the power supply and the input signal, while a pull down resistor is connected between the input signal and ground. These resistors help to ensure that the input signal remains at a known voltage level, even when there is no active input signal.

2. Why are pull up and pull down resistors necessary?

Without pull up and pull down resistors, an input signal that is not actively driven by a source can float and cause electrical noise in the circuit. This can lead to incorrect readings or malfunctions in the circuit. Pull up and pull down resistors provide a stable reference voltage for the input signal, preventing it from floating and causing noise.

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

Pull up and pull down resistors remove electrical noise by providing a stable reference voltage for the input signal. This ensures that the signal remains at a known voltage level, reducing the effects of any noise that may be present. Additionally, these resistors can help to filter out high frequency noise by acting as a low pass filter.

4. What is the difference between a pull up and pull down resistor?

A pull up resistor is connected between the input signal and the power supply, while a pull down resistor is connected between the input signal and ground. The main difference is the direction of the current flow. In a pull up resistor, current flows from the power supply through the resistor to the input signal, while in a pull down resistor, current flows from the input signal through the resistor to ground.

5. How do I choose the appropriate value for pull up and pull down resistors?

The value of the pull up or pull down resistor will depend on the specific circuit and the input signal it is connected to. In general, the resistor should be large enough to prevent excessive current flow, but small enough to avoid affecting the performance of the circuit. It is important to consult the circuit's specifications and do some calculations to determine the appropriate resistor value.

Similar threads

Replies
6
Views
5K
  • Electrical Engineering
Replies
12
Views
2K
  • Electrical Engineering
Replies
3
Views
744
  • Introductory Physics Homework Help
2
Replies
38
Views
973
Replies
12
Views
1K
Replies
14
Views
934
  • Electrical Engineering
Replies
7
Views
2K
  • Electrical Engineering
Replies
1
Views
1K
  • Electrical Engineering
Replies
10
Views
775
Replies
6
Views
1K
Back
Top