Table of contents
Introduction PULL-UP vs PULL-DOWN resistor Calculating the value of the resistor The internal PULL-UP resistorsIntroduction
Pull up and pull down resistors are simple but essential components in digital electronics. They ensure that input pins on microcontrollers and other logic devices maintain the desired state instead of floating unpredictably. A good example of this are Dasduino input pins, without pull-up or pull-down resistor, digital input pins are in a high-impedance state. This means that the pin is extremely sensitive to electrical noise and tiny voltage changes. Try running a simple sketch which reads the state of a digital pin. The readings that you get should be LOW, or 0. However, if you try touching a connected wire with your hand, you will notice that the readings are fluctuating randomly. This phenomenon is what we call a floating pin, and it can cause unreliable behavior, which is not acceptable in systems that rely on precise and stable microcontroller operation.
By guiding unused or idle inputs to a stable high or low state, these resistors help prevent noise, false triggering, and unreliable behavior in a circuit. Understanding how and when to use pull up or pull down resistors is a key step in designing stable and predictable digital systems.
PULL-UP vs PULL-DOWN resistor
Pull-up and pull-down resistors are not some kind of special resistors, but simply a fixed-value resistors (typically 4.7kΩ or 10kΩ, more on that later) connected between the pin on the microcontroller and +5V for pull-up configuration or GND for pull-down configuration. To demonstrate this concept of floating pins and how to solve that problem we will use a simple pushbutton example.
We will connect one push button using a pull-down resistor and the other using a pull-up resistor. A common resistor value such as 10 kΩ works well for both configurations. With these connections, the pull-down button will read LOW (0) when not pressed and HIGH (1) when pressed. The pull-up button will behave the opposite way: it will read HIGH (1) when not pressed and LOW (0) when pressed.
This ensures that neither button will produce random or floating readings.

The code below reads the states of both push buttons on pins 7 (pull down) and 6 (pull up), and prints their values to the Serial Monitor.
const int buttonPin1 = 7;
const int buttonPin2 = 6;
int buttonState1 = 0;
int buttonState2 = 0;
void setup()
{
Serial.begin(115200);
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
}
void loop()
{
buttonState1 = digitalRead(buttonPin1);
buttonState2 = digitalRead(buttonPin2);
Serial.println("Button 1 state: " + String(buttonState1) + ", Button 2 state: " + String(buttonState2));
delay(200);
}
Calculating the value of the resistor
The value of the resistor depends on two factors. First is consumption, waste of energy. If the value of the resistor is too low HIGH (+5V in the example above), the voltage will go through a pull-up resistor and unnecessarily waste energy when the circuit is closed. The energy will be spent on heating. This condition is called a strong pull-up and should be avoided when your circuit doesn’t not need much power. Another factor is the voltage when the circuit is open, i.e. pressed. If the value of the resistor is too large, the input voltage may be too small for microcontroller to register as a change. This situation is called a weak pull-up.
Pull-up and pull-down resistors are typically chosen in the range of 1 kΩ to 10 kΩ for most 5 V and 3.3 V microcontroller systems. A common general-purpose value is 4.7 kΩ. Lower resistance values (1–4.7 kΩ) provide a stronger pull and are useful in noisy environments or for certain sensors, while higher values (10 kΩ or more) reduce current consumption but give weaker noise immunity.
The exact resistor value depends on factors such as signal noise, required speed, and acceptable current draw. You can use Ohm’s law to check the current flowing when the line is driven against the pull-up or pull-down resistor, but it does not determine the value by itself.
The internal PULL-UP resistors
Internal pull-up resistors are components inside a microcontroller that are connected to a pin to ensure it has a defined logical state (high or low) when not driven by an external signal. This eliminates the need of adding a dedicated resistor. To use the internal pull-up resistor, simply define the pin in your code using INPUT_PULLUP.