Introduction
As we all know, resistors play a important role in limiting current in the circuit. Among then, pull-up resistors and pull-down resistors are often mentioned and frequently used in electronics. The pull-up is to clamp the uncertain signal to a high logical level through a resistor, which acts as a current limiter; while the pull-down resistor clamps the uncertain signal to a low logical level. Because there are only two states of high level and low level in digital circuits, it is uncertain at the initial stage of digital signals.

1 Why pull-down and pull-up resistor?
Pull-up and pull-down resistors are often applied when interfacing a switch or some other input with a microcontroller or other digital gates. That is, in the initial stage of digital circuit power-on, because the high logical level and low level of the output state are uncertain, in order to make the circuit state normally, a pull-up resistor or pull-down resistor is needed to stabilize the uncertain circuit state. The low logical level is connected to GND inside the IC, and the high level is connected to the super resistance inside the IC.
The pull-up resistor connects with the status port of the power supply. Simply put, the high voltage is applied to this point, where the potential will increase. The pull-down resistor means that the resistor is connected to the negative pole, and there is also the case of digital grounding. When the input port signal changes due to different circuit forms, the change will be fed back to the output port, so that the output port acquires a state that should have been completed, but the input port has no signal at this time and keep the original state.
According to the above understanding, many people may feel awkward. Take an example from daily life, when you use the key to open the door, people enter but the door is not closed, at this time, you can add a switch to make the door close automatically.

Schematic of Pull-up Resistor at Positive Input

The above schematic diagram explains why the positive pole and the input terminal resistor can high the level. The two resistances of the port are assumed to be equivalent. We can get that the voltage of the port is 2.5V according to Ohm's law. By connecting the pull-up resistor (red part), the voltage of the port rises at this time, calculate the port voltage. Among them, 10K is connected in parallel with the later connected 1K, and the resistance must be greater than or equal to 1K, which is equivalent to the series relationship between 1K and the 10K resistor below, but the passing current is actually the same. Finally, the voltage of the two 10K resistors increases, and the terminal voltage also increases.
The pin connected to the IC and power (or ground) is not necessarily a pull-down resistor. When this happens, many people may think that the red part of the figure is also a pull-down resistor. However, it is not connected in series with any pin or ground. In fact, it is used for circuit startup resistor, not pull-up/pull-down resistor. For the pull-up/pull-down resistors, it is only for the input port and the output port. Although some circuits will connect the pull-up and pull-down resistors to the redundant ports for stability, not all the resistors are connected to one pin of the IC all the time, and the other pin is connected to power or ground to represent the pull-up and pull-down resistors.

2 Pull-up & Pull-down Resistor Circuits
Look at the following analyses to figure out what are pull-up resistor and pull-down resistor in circuits. Pull-up resistors are used to ensure that a wire is pulled to a high logical level in the absence of an input, while pull-down resistors ensure the voltage between VCC and a microcontroller pin is actively controlled. Just check the details below.

OC(TTL) Circuit, OD(COMS) Circuit

When the I/O port of the IC is in high level, the impedance between the node and GND is very large, which can be understood as infinite. At this time, it is connected to VCC through a pull-up resistor (such as 4.7K ohm, 10K ohm resistor), and the voltage divider of the pull-up resistor is almost negligible. When the I/O port node is in low level, it can be directly connected to GND. At this time, VCC and GND are connected through the pull-up resistor, and the current passing through is very small, which can be ignored.
The level value are relative to the ground level, so you should refer to the ground level value. See if those pins are connected to the ground, it has nothing to do with whether they are connected to peripheral devices.
Connect a 10K ohm or 4.7K ohm pull-up resistor between the node and +5V to pull up the potential of this node. Often this node requires a single-chip microcomputer or other controller to control it (and this node is connected to I/O). If you simply want to make this node a high level, and the output impedance is very large, you can directly connect the power supply, but if the microcontroller wants to make this node low, that is, the node is grounded inside the microcontroller, so that the 5V power supply and the ground are short-circuited.
In addition, when this node is required to be at a high level, the impedance between this node and the ground is generally very large. For example, with an impedance of 100K ohms, when connect a 10K ohm pull-up resistor, the voltage at this point is 100KΩ/(100K +10K)*5V=4.5V, so it can also get a high level.
When the node is required to be low level, just connect it to the ground, and there is a 10K resistor between the power supply and the ground, so that it will not be short-circuited. When it is low, there is a loop formed by a load between the power supply and the ground. Sometimes this node will be connected with a resistor in series. Because the current flows to the place with low impedance, the current will flow to the ground through the resistor connected to the power supply instead of Flow to this resistance connected to the node, because the resistor connected to this node has a high impedance, so the potential at this point is in low level.
It can be considered that, for the I/O port of the IC, controlling the high and low levels inside the IC is equivalent to controlling the O/O port to be connected to its internal GND or a very large resistor, such as 100K ohms. When the I/O port is the low level (0V), inside the IC, the pin that controls the O/O port of the IC chip is connected to GND.
When the I/O port is at a high level, such as 5V, the I/O port pin is connected to a very large resistor in the chip, such as 100K ohms, and sometimes another one is connected in series at the I/O node. A resistor with a small resistance value, such as 68 ohms, because the current flows to a place with low impedance, when the I/O port and GND inside the chip are connected to a low level, the pull-up resistor and the GND inside the chip form a loop.
At this time, the current at the I/O port node will flow to the GND inside the chip, because a small resistance resistor is connected in series at the node, which is high resistance relative to GND, so the current will not flow through this series resistor.
Using a pull-down resistor, when the I/O port is in a high-impedance state, the pull-up resistor can keep it in a high-level state. That is, when the I/O port is in the high-impedance state, using a pull-down resistor to connect this port to GND. The high-impedance state has a large resistance value, which can be understood as disconnection, in fact, it is actually a large resistor inside the chip. The resistors are connected and pulled to the ground, so there is no current and the level value is 0. It can only work unless a high level value is given to this pin.

3 What the Role of Pull-up and Pull-down Resistors?
As for the purpose of pull-up & pull-down resistors, generally speaking, the pull-up resistor increases the current, and the pull-down resistor is used to absorb the current.
1) Increase the voltage level.
When the TTL circuit drives the CMOS circuit, if the output high level of the TTL circuit is lower than the lowest high level of the CMOS circuit, then it is necessary to connect a pull-up resistor to the output terminal of the TTL to increase the value of the output high level. The OC gate circuit must add a pull-up resistor to increase the high-level value of the output.
2) Increase the drive capability of the output pin.
In order to enhance the drive capability of the output pins, pull-up resistors are often used on some single-chip pins.
3) The N/A pin (the pin not connected) should be anti-static and anti-interference.
On the CMOS chip, in order to prevent damage caused by static electricity, the unused pins cannot be left floating. Generally, a pull-up resistor is connected to reduce the input impedance, provide a leakage path, and improve the anti-electromagnetic interference ability of the bus. Because the pin is left floating, it is easier to receive electromagnetic interference from the outside world.
4) Resistance match
In the long-line transmission, the resistance mismatch can easily cause the reflected wave interference. In addition, the pull-down resistor makes the resistance match, which can effectively suppress the reflected wave interference.
5) Preset space state/default potential
Pull-up or pull-down resistors are connected to some CMOS input terminals to preset the default potential. When these pins are not used, these input terminals are pulled down to low level or pulled up to high level. The state when idle on the bus such as I2C is obtained by the pull-up and pull-down resistors.
6) Improve the noise tolerance of the chip input signal.
If the input terminal is in a high-impedance state, or in a floating state, a pull-down or pull-down resistor needs to be added at this time, so as to avoid the random level. Similarly, if the output terminal is in a passive state, a pull-down or pull-down resistor needs to be added. For example, the output terminal is only the collector of a transistor, thereby improving the noise tolerance of the chip input signal and enhancing the anti-interference ability through a pull-up resistor or pull-down resistor.

4 Pull-up & Pull-down Resistor Applications
When to use pull-up or pull-down resistors? Look at the following cases explained.
1) If a pull-up & pull-down resistor is used for the input signal pin, the usual function is clamping the signal to a certain level to prevent the signal line from appearing in an uncertain state. In practical applications, the 10K ohm resistor is the most used pull-up resistor. Whether to use a pull-up resistor or a pull-down resistor depends mainly on the needs of the circuit system itself. For example, for a highly effective enable control signal, we hope that the circuit system be in an invalid state after power-on, and then a pull-down resistor will be used.
Assuming that the enable signal is used to control the motor, if it is left floating, the signal line may be triggered falsely to a high level by other noise interference after power-on (or during operation), resulting in undesired rotation of the motor, and a pull-down resistor can be added at this time. Correspondingly, for the active-low reset control signal (RST#), if we want to be in an inactive state after power-on reset, a pull-up resistor should be used.
2) Most chips with logic control functions (such as single-chip microcomputers, FPGAs, etc.) will integrate pull-up or pull-down resistors. Users can choose whether to turn on or not according to their needs. STM32 microcontroller GPIO mode includes pull-up or pull-down.
3) According to the resistance value of the pull-up resistor, we can also divide it into strong or weak pull-up/down. The pull-up resistors integrated in the chip are usually weak pull-up (larger resistance), the smaller the pull-up resistance, the stronger the level capability (strong pull), and the stronger the ability to resist external noise (that is, if the unwanted interference noise is to change the strong pull signal level, the required energy must be strengthened accordingly ), but the smaller the pull-up resistance, the greater the corresponding power consumption, because the normal signal requires more energy to change the state of the signal line. In terms of energy consumption, both pull-up /down resistors are the same.
4) There is no strict definition of how many ohms are the boundary between strong pull and weak pull. Generally, the pull-up resistors we use are weak pulls, so we can still use external control signals to pull up/down the signal lines as needed.
The extreme of the strong pull resistance is the zero, that is, the signal line can directly connected to the power supply or ground.
5) There are more knowledge points involved when the pull-up resistor is used as an output (or input and output), but the essential function is also to clamp the level. The most common output pull-up resistor appears in the open collector (OC) Or open drain (OD) structure pin.
6) The current sink capability and current source capability are also called the drive capability of the chip pins. For any given chip, the pin drive capability is limited. If the load driven by the pin is large, it may cause the output level to be incorrect (the predetermined level cannot be output).
7) OC (OD) pin output structure is different (OC structure exists in the transistor, and OD structure exists in the field effect transistor FET). The output of most comparator chips is an OD/OC output structure, and the signal pins of many chips or modules that feed back the system status are also in this structure, so that users can pull up the level to the corresponding level according to the actual needs of the circuit system. With the power supply voltage VCC, the level conversion can be omitted.

5 How to Select Pull-up & Pull-down Resistors?
When select pull-up & pull-down resistors, you can consider the following three aspects:
1) Considering power saving, sink current capability of the chip should be large enough, the resistance is large and the current is small.
2) It is necessary to ensure sufficient drive current, so the resistance is small and the current is large.
3) For high-speed circuits, excessive pull-up resistors may have smooth edges.
Considering the above three points comprehensively, the resistance value is usually selected between 1K and 10K. The same principle applies to pull-down resistors.
Andrewen 7 october 2021, 9:33