# Understanding Pull-up and Pull-down Resistors: A Guide for Arduino and Microcontrollers

Learn how pull-up and pull-down resistors prevent floating inputs, how to wire them, use Arduino INPUT_PULLUP, and choose a suitable resistor value.

Written by [Jharwin Barrozo](https://www.flux.ai/jharwinbarrozo)

Published Sep 2026 - 7 min read

[![A simplified schematic diagram illustrates how pull-up and pull-down resistors are utilized in microcontroller applications](https://www.flux.ai/p/assets/blogs/pull-up-down-resistors/main.webp)](#)

## Pull-up and pull-down resistors are vital components in the world of electronics, especially in microcontroller-based circuits. Whether you're using an Arduino, Raspberry Pi, or any other microcontroller, understanding pull-up and pull-down resistors is essential. In this blog, we'll dive deep into these components, how they work, and why they are crucial for reliable circuit performance.

### What are Pull-ups and Pull-downs?

A pull-up resistor connects a signal to its logic supply so an undriven input defaults to HIGH. A pull-down resistor connects it to ground so it defaults to LOW. Both prevent a microcontroller input from floating, while allowing a switch or another device to override that default state. Use a supply voltage compatible with the input, such as 3.3V or 5V depending on the device.

#### Pull-up Resistor vs Pull-down Resistor

To more clearly highlight the distinctions between pull-up and pull-down resistors, I'll present a side-by-side comparison in the table below:

| Pull-up Resistors | Pull-down Resistors |
| --- | --- |
| Connect between I/O pin and +supply voltage, with an open switch connected between I/O and ground. | Connect between an I/O pin and ground, with an open switch connected between I/O and +Supply. |
| Keeps the input “High” | Keeps the input “Low” |
| More commonly used | Less commonly used |

### How pinMode() and digitalRead() Work in Arduino

In Arduino, **pinMode**(pin, INPUT) configures a GPIO pin to read a digital signal. **digitalRead**(pin) returns HIGH or LOW according to the microcontroller’s input-voltage thresholds—not a universal 5V rule. An unconnected input can float, and a voltage between the specified LOW and HIGH thresholds is undefined. Check the board’s logic voltage before connecting external signals.

### Importance of Pull-up and Pull-down Resistors in Circuits

For a simple switch input, 4.7kΩ or 10kΩ is a common starting point, not a universal requirement. Choose the resistance by checking input leakage, logic thresholds, noise, and the current that flows when the switch overrides the resistor. Faster signals also require attention to capacitance and rise time.

When connected in a circuit, the resistor pulls the voltage across the pin to a known level. For example, with a pull-up resistor, a **digitalRead** on an Arduino GPIO pin will return HIGH unless actively driven low. This ensures a stable logic level, thus making the reading consistent and reliable.

### Schematics and Practical Examples

In a typical pull-up schematic, the resistor is connected between the pin and VCC. For pull-downs, the resistor connects the pin to GND. These schematics often appear in circuits with switches, NAND gates, CMOS, and TTL logic devices.

[

![A typical schematic diagram of pull-up resistor and pull-down resistors used in ESP32 microcontroller](https://www.flux.ai/p/assets/blog-content/6507f2bb22875d0b8afcb4cd_Screenshot%202023-09-18%20at%202.36.23%20PM.png)

](https://www.flux.ai/jharwinbarrozo/pull-up-and-pull-down-resistors)

Typical pull-up resistor and pull-down resistors used in ESP32 microcontroller.

### Role in Digital Protocols and Transistors

I2C uses pull-up resistors on SDA and SCL because devices pull these lines LOW and release them to return HIGH; pull-down resistors are not interchangeable here. In transistor circuits, a resistor may provide a collector pull-up or keep a MOSFET gate in a defined state when its driver is inactive. Its role depends on the actual circuit, rather than every pull resistor acting as a voltage divider.

### Arduino's Built-In Pull-ups and Pull-downs

The ATmega328P used on the Arduino Uno R3 has internal pull-up resistors, but no internal pull-down resistors. Enable a pull-up with **pinMode**(pin, **INPUT\_PULLUP**), then wire the switch between the input and GND: an open switch reads HIGH and a pressed switch reads LOW. Other Arduino-compatible MCUs may support **INPUT\_PULLDOWN**, so check the specific board and core before using it.

To enable internal pull-ups on an Arduino, you can use the following line of code in your setup() function:

```scss
pinMode(5, INPUT_PULLUP); // Enable internal pull-up resistor on pin 5
pinMode(6, INPUT_PULLUP); // Enable internal pull-up resistor on pin 6
pinMode(7, INPUT_PULLUP); // Enable internal pull-up resistor on pin 7
```

### How to Calculate Resistance of a Pull-up Resistor?

A pull-up must be strong enough to maintain a valid HIGH level despite input leakage and noise, yet large enough to limit current when the line is pulled LOW. For the button example below, Ohm’s law estimates the closed-switch current; it does not by itself establish the maximum resistance for every digital interface.

![](https://www.flux.ai/p/assets/blog-content/6507f5e55da7213440377009_Screenshot%202023-09-18%20at%203.01.37%20PM.png)

Let's say you want to limit the current to approximately 1mA when the button is pressed in the circuit above, where Vcc = 5V. What resistor value should you use?

To calculate the pull-up resistor, we'll be using [Ohm's Law](https://en.wikipedia.org/wiki/Ohm%27s_law):

Where is the Vcc, is the current through the pull-up resistor, and is the resistance of the pull-up resistor.

Rearrange the above equation with little algebra to solve for the resistor:

To find the bands for the value you settle on, or to check the resistor already in your parts bin, use our [resistor color code calculator](https://www.flux.ai/p/tools/resistor-color-code-calculator).

### Pull-ups vs. Pull-downs: When to Use Which?

Choose the default state your circuit needs. Use a pull-up when an open switch should read HIGH and a switch to ground should read LOW; use a pull-down for the opposite arrangement. Follow the interface specification for shared buses such as I2C, and do not assume all CMOS or TTL inputs behave identically.

### The Physics Behind It: Ohm's Law

Ohm's Law is the foundation when it comes to understanding resistors. The formula , where is the voltage, is the current, and is the resistance, governs how resistors work in circuits. The resistor limits the current that can flow between VCC and the input pin, balancing the impedance and providing a stable voltage level for **digitalRead** to interpret.

### Real-world Applications: Switches and Sensors

In real-world applications, pull-up and pull-down resistors are commonly used with switches and sensors. When a switch is open, a pull-up resistor will ensure that the voltage at the pin is pulled up to VCC (5V or 3V). When the switch is closed, it connects the pin directly to GND, overriding the pull-up and bringing the voltage to 0V.

For a sensor with an open-drain digital output, a pull-up can establish the released HIGH state; check whether the sensor module already includes one. Do not add pull resistors indiscriminately to analog sensor outputs, since they can load the signal and change the measured voltage.

### Voltage Dividers and Level Shifters

In some cases, pull-up or pull-down resistors are part of a voltage divider circuit, especially when you're interfacing 5V and 3V components. A voltage divider consists of two resistors in series connected across a voltage supply. The output voltage can be tapped between the two resistors, providing a reduced voltage that is proportional to the ratio of the resistors. Our [voltage divider calculator](https://www.flux.ai/p/tools/voltage-divider-calculator) works that ratio out for you, and returns the nearest standard E-series resistor values.

### Common Pitfalls and Tips

1.  **Wrong Resistor Value**: Choosing a resistor with a value too low can cause excessive current to flow, wasting power and possibly damaging the microcontroller pin.
2.  **Forget to Connect the Resistor**: When the resistor is not connected, the pin will float, leading to unreliable readings.
3.  **High-Impedance Sources**: A pull resistor can load a high-impedance source and change the signal being measured. Check the source impedance, input leakage, and required thresholds; a buffer may be appropriate when the source cannot drive the input reliably.
4.  **Wire Length**: Longer wire runs can introduce noise and resistance, affecting the performance of pull-up and pull-down resistors.

### Final Thoughts

Pull-up and pull-down resistors are more than just "additional components" in your electronic projects; they're fundamental to the reliable operation of microcontrollers, transistors, and logic gates. Understanding their function, role in circuits, and practical applications can make the difference between a project that functions inconsistently and one that operates reliably.

By now, you should have a solid understanding of pull-up and pull-down resistors, how to set the **pinMode** and use **digitalRead** in your Arduino projects, and the significance of resistance and impedance in these configurations. Whether you're a hobbyist or a professional, these resistors are tools you'll come back to time and time again.

With this, we've reached the end of our comprehensive guide. Happy building!

‍

## About the author

[Jharwin Barrozo](https://www.flux.ai/jharwinbarrozo)

Electronics Engineer at Flux

Jharwin is an electronics engineer mainly focused on satellites. He built his own ground station using Flux to monitor RF activities on the International Space Station. Find him on Flux [@jharwinbarrozo](https://flux.ai/jharwinbarrozo)

Let’s start building

Build your big idea together with Flux. All you need to do is describe what you want to make, or what problem you want to solve. Flux will work with you to make it a reality.

![Close-up photo of a PCB made with Flux, with an ESP32 module, buttons, and a microSD slot.](https://www.flux.ai/p/assets/blogs/miscellaneous/sidebar-cta-pcb.webp) [Try it Free](https://www.flux.ai/signup)

## More in Component & Platform Guides

[

![A 3d model of arduino uno board](https://www.flux.ai/p/assets/blogs/arduino-getting-started/main.webp)

### Arduino Uno Basics: Beginner's Guide to Getting Started

15 Min Read](https://www.flux.ai/p/blog/arduino-uno-basics-beginners-guide-to-getting-started)[

![ESP32 Board with its pinout label and diagram, each pin label and function on different colors](https://www.flux.ai/p/assets/blogs/esp32-pinout/main.webp)

### ESP32 Pinout Guide: Everything You Need to Know

11 Min Read](https://www.flux.ai/p/blog/esp32-pinout-everything-you-need-to-know)[

![A raspberry pi 3B and zero boards laid out together showing graphical GPIO pinout](https://www.flux.ai/p/assets/blogs/raspberry-pi-guide/main.webp)

### Raspberry Pi Pinouts: A Comprehensive Guide

8 Min Read](https://www.flux.ai/p/blog/raspberry-pi-pinouts-a-comprehensive-guide)[

![An arduino uno microcontroller board with its sketch code on Arduino IDE being used as background in a monitor.](https://www.flux.ai/p/assets/blogs/arduino-code-guide/main.webp)

### Arduino Code for Beginners: How to Write Your First Sketch

8 Min Read](https://www.flux.ai/p/blog/arduino-code-a-comprehensive-guide-for-beginners)[

![Meet the Arduino Nano R4: Why Is This Tiny Upgrade So Big for Makers?](https://www.flux.ai/p/assets/blogs/arduino-nano-r4/main.webp)

### Meet the Arduino Nano R4: Why Is This Tiny Upgrade So Big for Makers?

6 Min Read](https://www.flux.ai/p/blog/meet-the-arduino-nano-r4-why-is-this-tiny-upgrade-so-big-for-makers)[

![A microcontroller board with the words Arduino Pro Micro on it.](https://www.flux.ai/p/assets/blogs/arduino-pro-micro/main.webp)

### What is Arduino Pro Micro: a Comprehensive Introduction for Novices

5 Min Read](https://www.flux.ai/p/blog/what-is-arduino-pro-micro-a-comprehensive-introduction-for-novices)[

![Schematic diagram of arduino uno board with all of its passive and active components](https://www.flux.ai/p/assets/blogs/arduino-uno-schematic-diagram/main.webp)

### Arduino Uno Schematic Diagram: A Comprehensive Guide

8 Min Read](https://www.flux.ai/p/blog/arduino-uno-schematic-diagram)[

![Side by side comparison of the 3 powerful and most common Arduino microcontroller boards; Arduino Mega 2560, Arduino Uno and Arduino Micro.](https://www.flux.ai/p/assets/blogs/arduino-mega-uno-micro/main.webp)

### Arduino Mega vs. Uno vs. Micro: Key Differences

6 Min Read](https://www.flux.ai/p/blog/what-is-the-real-difference-arduino-mega-vs-micro-vs-uno)[

![Different packages or footprint of famous atmega328p microcontroller with its pinout](https://www.flux.ai/p/assets/blogs/atmega328p-still-top-choice/main.webp)

### Why Atmega328p is Still a Top Choice for Microcontroller Projects in 2023

8 Min Read](https://www.flux.ai/p/blog/why-atmega328p-is-still-a-top-choice-for-microcontroller-projects-in-2023)[

![ESP32 Chip in a dark background: A powerful microcontroller with integrated Wi-Fi and Bluetooth, driving IoT innovation with seamless connectivity.](https://www.flux.ai/p/assets/blogs/esp32-history/main.webp)

### Exploring ESP32: from History to Application

3 Min Read](https://www.flux.ai/p/blog/exploring-esp32-from-history-to-application)[

![3d rendered of an ESP8266 microcontroller board, showing its compact size with the Wi-Fi module, chip antenna, and GPIO pins clearly visible, ideal for embedding wireless internet connectivity into DIY electronics projects.](https://www.flux.ai/p/assets/blogs/everything-about-esp8266/main.webp)

### ESP8266 Pinout Guide: Complete GPIO Reference & IoT Project Tips

10 Min Read](https://www.flux.ai/p/blog/esp8266-pinout-everything-you-need-to-know)[

![Attiny85 chip in two different packages viewed on top, also showing pinout diagram](https://www.flux.ai/p/assets/blogs/attiny85/main.webp)

### Introduction to the ATtiny85 Microcontroller

12 Min Read](https://www.flux.ai/p/blog/introduction-to-the-attiny85-microcontroller)[

![STM32 microcontroller chip overview – Why choose STM32? Discover STM32F4 ARM-based processors, optimized for performance with USB OTG, SWD, and UART support](https://www.flux.ai/p/assets/blogs/stm32-things-you-need-to-know/main.webp)

### STM32: Things You Need to Know

10 Min Read](https://www.flux.ai/p/blog/stm32-things-you-need-to-know)[

![Arduino Nano Guide](https://www.flux.ai/p/assets/blogs/arduino-nano-guide/main.webp)

### Arduino Nano Guide

10 Min Read](https://www.flux.ai/p/blog/arduino-nano-guide)[

![A top view photo of raspberry pi zero 2 w board](https://www.flux.ai/p/assets/blogs/pi-zero-2w/main.webp)

### Raspberry Pi Zero 2 W Review: a Powerful and Affordable Mini Computer

9 Min Read](https://www.flux.ai/p/blog/raspberry-pi-zero-2-w-review-a-powerful-and-affordable-mini-computer)[

![RP2350 A4 Stepping: Why Raspberry Pi Pico’s Latest Upgrade Changes Everything](https://www.flux.ai/p/assets/blogs/rp2350-a4-stepping/main.webp)

### RP2350 A4 Stepping: Why Raspberry Pi Pico’s Latest Upgrade Changes Everything

8 Min Read](https://www.flux.ai/p/blog/rp2350-a4-stepping-why-raspberry-pi-picos-latest-upgrade-changes-everything)[

![Photos of Raspberry Pi Pico 2 PCB board and its predecessor Raspberry Pi Pico boards laid out with a text suggesting their key differences](https://www.flux.ai/p/assets/blogs/pi-pico-vs-pi-pico-2/main.webp)

### Raspberry Pi Pico 2 vs Pico: Key Differences and Upgrades

8 Min Read](https://www.flux.ai/p/blog/whats-new-in-the-raspberry-pi-pico-2-a-showdown-with-the-original-raspberry-pi-pico)[

![Choosing the Right Platform to Build Your Project](https://www.flux.ai/p/assets/blogs/choosing-the-right-microcontroller/main.webp)

### Choosing the Right Platform to Build Your Project

9 Min Read](https://www.flux.ai/p/blog/choosing-the-right-platform-to-build-your-project)[

![Raspberry pi boards and arduino boards laid out side by side.](https://www.flux.ai/p/assets/blogs/arduino-vs-raspberry-pi/main.webp)

### Arduino vs. Raspberry Pi: Key Differences and Which to Choose

8 Min Read](https://www.flux.ai/p/blog/arduino-vs-raspberry-pi-comparison)[

![ESP32 boards and Arduino boards side by side, highlighting the comparison between these popular IoT microcontroller platforms.](https://www.flux.ai/p/assets/blogs/esp32-vs-arduino/main.webp)

### ESP32 vs Arduino: Key Differences & Which to Choose?

8 Min Read](https://www.flux.ai/p/blog/esp32-vs-arduino)[

![arduino board and text suggesting this is all about the arduino map () function](https://www.flux.ai/p/assets/blogs/arduino-map-function/main.webp)

### How to Use the Arduino map() Function: A Complete Guide

4 Min Read](https://www.flux.ai/p/blog/how-to-use-the-arduino-map-function-a-complete-guide)[

![What Is an Open Circuit? Causes, Examples, and Troubleshooting](https://www.flux.ai/p/assets/blogs/what-is-an-open-circuit/main.webp)

### What Is an Open Circuit? Causes, Examples, and Troubleshooting

10 Min Read](https://www.flux.ai/p/blog/what-is-an-open-circuit)

See All (22)

## Let’s start building.

Let’s build your idea together. All you need to do is describe what you want to make, or what problem you want to solve. Flux will work with you to make it a reality.

[Try it Free](https://www.flux.ai/signup)

 ![Close-up of a Flux-designed printed circuit board](https://www.flux.ai/p/assets/homepage-v2/mission-visual.webp)
