How pull-up/pull-down resistors work?

How pull-up/pull-down resistors work?

We know that a logical signal can have two states: LOW (or 0) and HIGH (or 1). In the LOW state, the voltage level is usually close to 0V. In the HIGH state, the voltage is close to the power source voltage: 3.3V, 5V, or in some circuits even lower.

When we don’t provide an input signal to an input pin of an integrated circuit, meaning the input is neither connected to ground, power source, nor other device on circuit board, we don’t know in what state the input is. The input pin and the wire connected to it act as an antenna and it is sensible to any electro-magnetic fluctuations around it. The circuit will randomly switch between LOW or HIGH states, leading to undesirable behavior. In this case, we say that the input is in a floating state.

Input pin in floating state

Figure 1: Input pin in floating state.

To set the input state, a digital circuit reads the voltage applied to the input pin. To consider the state LOW, it doesn’t have to be exactly 0V, same applies for the HIGH state, it doesn’t have to be equal to power source voltage value. Depending on the integrated circuit type (TTL, CMOS) and manufacturer, there are voltage ranges when the chip considers the input signal as LOW or HIGH.

Signal states voltage level

Figure 2. Voltage levels for LOW, HIGH, and indeterministic states.

As you can see in Figure 2, what is below 1.5 V (blue zone) guarantees to read as a LOW level. Everything above 3.5V (red zone) will read as a HIGH level. The range between 1.5 and 3.5V is non-deterministic, the circuit can read either the LOW or HIGH level. So we want to avoid this zone as much as possible.

When we select a pull-up or pull-down resistor, we need to make sure the signal level is in the red or blue zone.

The voltage ranges shown in Figure 2 are an example for illustrative purposes. Consult the integrated circuit’s datasheet for the concrete values.

Pull-up resistor

Pull-up resistor is a resistor that connects a signal line to the power source, thus providing a default HIGH level when we apply no other signal, Figure 3.

Pull-up configuration

Figure 3. Pull-up resistor configuration

When we don’t apply a signal (Figure 3a), the input pin will read a voltage value close to the power source voltage value. A small current will flow through the pull-up transistor into the input pin, setting it in the HIGH state. We can also connect the input pin to the power source directly. However, the issue will arise when we close the switch, as it will short circuit to the ground and damage the circuit.

When we close the switch (Figure 3b), we short-circuit the input pin to the ground. The current will flow through the pull-up resistor to the ground, and from the input pin to the ground. The input will be in a LOW state. At the same time, the pull-up resistor protects from short-circuit when the switch is closed.

Pull-up resistor and input impedance

Figure 4. Pull-up resistor and input impedance act as voltage divider.

So why is that? Consider that internal elements of the integrated circuit from the input pin to the common ground create a resistance. We use a fancier word for that - impedance. The input impedance value usually varies between 100KOhm and 1MOhm.

The pull-up resistor and input impedance act as a voltage divider. The pull-up resistor value must be selected in such a way that it will guarantee to set the input in the HIGH state.

The datasheets should provide how much current the input sinks for the HIGH state, or how much current flows out of the input for the LOW state.

Using the information from the datasheet, you can calculate the pull-up resistor value using Ohm’s law. Depending on the circuit requirements, the value can range between 1KOhm and 100KOhm.

To calculate the value of the pull-up resistor, basically you want to determine how much voltage you want to drop on the resistor. You want the voltage drop on the input pin to be close to the indeterministic zone, but not at the edge.

VCC = VR + Vchip

VR = VCC - Vchip

We know that the current that flows through the pin is the same current that flows through the resistor:

Ichip = IR

So using the Ohm’s law, RPU

RPU = VR/IR = (VCC - Vchip)/Ichip

A pull-up resistor with a lower value is called “Strong pull-up”, the voltage drop on the input pin will be closer to the power source, and more current will flow through the resistor when we connect it to the ground.

A pull-up resistor with a higher value is called “Weak pull-up”. The voltage drop on the input pin will be close to the orange area, but less current will flow through it when connected to the ground.

Pull-down resistor

Pull-down resistor is a resistor that connects a signal line to the common ground, thus providing a default LOW level when we don’t apply another signal, Figure 5.

Pull-down configuration

Figure 5. Pull-down resistor configuration.

When we apply no signal, a small current will flow from the input pin through the pull-down resistor to the ground. There will be a small voltage drop across the pull-down resistor, but it will be in that blue range (Figure 2), enough to read as the LOW state.

When we close the switch, the input pin will connect directly to the power source and set the input in the HIGH state. The current will flow from the power source to the ground through the pull-down resistor.

Pull-down resistor and input impedance

Figure 6. Pull-down resistor and input impedance as a voltage divider.

We can calculate the value for the pull-down resistor in the same way as for the pull-up resistor.

Determine how much voltage you want to drop on the resistor. You want the voltage drop on the resistor to be little below the indeterministic zone but not too close to 0V. The formula remains the same as for the pull-up resistor.

RPD = VR/IR = (VCC - Vchip)/Ichip

However, keep in mind the higher the resistor value, the higher the voltage drop and the closer to the orange zone, which we want to avoid.

Lower resistor value, more current will flow through it when we close the switch, so more power dissipation.

Keep in mind that pull-up and pull-down resistors are not always required, for example, when switching a load. Also, some integrated circuits already have internal pull-up/pull-down resistors and you can enable them programmatically.

Input pins have a parasitic capacitance, using a large value for the resistors will cause this capacitance to charge/discharge slowly (basically an RC filter), which may affect the functionality of a high frequency switching application.

Summary

The pull-up and pull-down resistors are used to ensure that a circuit’s input is in a known state when we don’t apply any signal. These are commonly used in circuits with switches and push buttons connected to logic circuits or microcontrollers. The value of the pull-up or pull-down resistors depends on the circuit’s requirements and the characteristics of the integrated circuits itself. It’s important to understand the specific requirements of a circuit before deciding whether to use pull-up or pull-down resistors.