Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Electronics Fundamentals
  4. ›Pull-Up and Pull-Down Resistors
Step 9 of 18 in Electronics from zeroPart of a learning path.
Next

Concept explainer · Beginner · 3 min read

Pull-Up and Pull-Down Resistors

Why Floating Pins Misbehave

By Geekobot Learning Team · Updated 24 Oct 2026

I'm using
Wiring, code and the Run it panels follow your board.
On this page
Short answerWhy a floating input reads randomlyPull-up vs pull-down wiringReading a button with INPUT_PULLUPChoosing the resistor valueOpen-drain outputs need pull-upsTry itCommon mistakesFAQsParts and next steps
Short answer

A pull-up resistor connects an input pin to the supply so it reads HIGH when nothing drives it; a pull-down connects it to ground so it reads LOW. Without one, an unconnected input "floats" and reads random values. 10 kΩ is the usual value for buttons. Most microcontrollers have internal pull-ups you can enable with INPUT_PULLUP, so wire the button between the pin and ground.

Key specs at a glance

Typical value
10 kΩ for buttons and switches; 4.7 kΩ for I2C; 1 to 2 kΩ for noisy or fast lines
Internal pull-ups
Arduino about 20 to 50 kΩ; ESP32 about 45 kΩ; Pico about 50 kΩ
INPUT_PULLUP
pinMode(pin, INPUT_PULLUP): pressed button reads LOW
Internal pull-downs
ESP32 and Pico yes; classic Arduino no
Current through 10 kΩ at 5 V
0.5 mA when the switch is closed
01

Why a floating input reads randomly

A digital input with nothing connected is like a microphone for electrical noise: your hand, nearby wires and mains hum push it above and below the threshold, so the pin flickers between HIGH and LOW. A pull-up or pull-down resistor gives it a definite resting level while still letting a switch or sensor override it.

02

Pull-up vs pull-down wiring

Pull-upPull-down
Resistor goesPin to VCCPin to GND
Switch goesPin to GNDPin to VCC
Idle readingHIGHLOW
Pressed readingLOWHIGH
Internal versionINPUT_PULLUP on all boardsINPUT_PULLDOWN on ESP32, Pico, R4
Common useButtons, I2C, open-drain outputsLogic where idle must be 0, some sensor modules
Resistor goes
Pull-up:
Pin to VCC
Pull-down:
Pin to GND
Switch goes
Pull-up:
Pin to GND
Pull-down:
Pin to VCC
Idle reading
Pull-up:
HIGH
Pull-down:
LOW
Pressed reading
Pull-up:
LOW
Pull-down:
HIGH
Internal version
Pull-up:
INPUT_PULLUP on all boards
Pull-down:
INPUT_PULLDOWN on ESP32, Pico, R4
Common use
Pull-up:
Buttons, I2C, open-drain outputs
Pull-down:
Logic where idle must be 0, some sensor modules
03

Reading a button with INPUT_PULLUP

Wire the button between the pin and ground; no external resistor needed.

Button with internal pull-up · Arduino C++Verify & upload in Electrolark
const int BTN = 2;

void setup() {
  pinMode(BTN, INPUT_PULLUP);   // idle HIGH
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  bool pressed = digitalRead(BTN) == LOW;   // LOW when pressed
  digitalWrite(LED_BUILTIN, pressed);
}
04

Choosing the resistor value

A pull-up forms a voltage divider with whatever pulls the pin the other way, so it must be:

Small enough

to hold the pin firmly against leakage and noise. Below about 100 kΩ for most inputs; 10 kΩ on long wires or near motors.

Large enough

not to waste current or overload the device pulling it low. 10 kΩ at 5 V passes 0.5 mA when a button is pressed, which is negligible.

For I2C

, 4.7 kΩ at 100 kHz, lower for 400 kHz or many devices. See I2C.

For boot/strapping pins

(ESP32 GPIO 0, 2, 12, 15; ESP8266 D3, D4, D8), check that your pull direction matches the boot requirement.

05

Open-drain outputs need pull-ups

Some outputs can only pull low: I2C lines, many sensor interrupt pins, the DS18B20's data line, and the ESP32's GPIO 34 to 39 inputs have no internal pull-ups at all. Those need an external pull-up to the logic supply. The symptom of a missing one is a line that never goes high, or a sensor the bus scanner cannot find.

06

Try it: I2C pull-up calculator

Change the values and the diagram and results update as you type.

07

Common mistakes to avoid

  • !Leaving an input floating and blaming the code for random triggers.
  • !Wiring the button to VCC while using INPUT_PULLUP, so the pin is always HIGH and the button does nothing.
  • !Pulling an ESP32 strapping pin the wrong way and stopping it from booting.
  • !Using a very weak pull-up (1 MΩ) on a long wire, so noise still gets through.
  • !Expecting internal pull-ups on ESP32 GPIO 34 to 39 or on analog-only pins.
08

Frequently asked questions

What is a pull-up resistor used for?

To hold an input pin at a known HIGH level when nothing else drives it, so buttons, switches and open-drain devices give clean readings.

What value should a pull-up resistor be?

10 kΩ for buttons and general inputs, 4.7 kΩ for I2C. Lower values are more noise-resistant but use more current.

Should I use pull-up or pull-down for a button?

Pull-up is the usual choice because every microcontroller has internal pull-ups: wire the button to ground, use INPUT_PULLUP, and read LOW as pressed.

Does the Arduino have internal pull-down resistors?

Classic AVR Arduinos (Uno, Nano, Mega) have only pull-ups. The ESP32, Raspberry Pi Pico and Arduino Uno R4 have both.

Why does my sensor's interrupt pin never go high?

Many interrupt and data pins are open-drain and need an external pull-up resistor, typically 10 kΩ to the sensor's supply voltage.

Parts for this guide

  • Resistor Assortment Kit (30 Values)
    ₹33View
  • Tactile Push Button Switch
    ₹7View
  • Solderless Breadboard
    ₹68View
Shop ResistorsShop Push Buttons & Tactile

Calculators

I2C pull-up calculatorVoltage divider calculator

Terms in this guide

Pull-up resistorA resistor from a signal line to the supply that keeps the line high when nothing pulls it low.Pull-down resistorA resistor from an input pin to ground so the pin reads LOW until something drives it HIGH.Floating inputAn input pin that is connected to nothing, so it picks up noise and reads random HIGH or LOW values. Fix it with a pull-up or pull-down resistor.Open-drainAn output that can only pull a line low; a pull-up resistor makes it high. Used by I2C.Strapping pinA pin whose level at reset selects a boot mode, such as GPIO 0, 2, 12 and 15 on the ESP32.DebounceFiltering the rapid on-off bouncing of a mechanical switch so one press counts once.

Keep learning

How-toBeginnerPush Buttons with ArduinoWire a push button between a digital pin and ground, set the pin to INPUT_PULLUP, and the pin reads LOW while pressed.3 min read · Switches, Relays & InputComponent guideBeginnerResistors ExplainedWhat resistors do, how to read 4- and 5-band colour codes and SMD codes, Ohm's law, power ratings, standard values and uses: LEDs, pull-ups, dividers.4 min read · Passive ComponentsConcept explainerIntermediateI2C ExplainedI2C is a two-wire bus that lets one microcontroller talk to many sensors and displays using a data line (SDA) and a clock line (SCL).4 min read · Electronics FundamentalsComponent guideBeginnerESP32 GuideThe ESP32 is a low-cost 3.3 V microcontroller from Espressif with built-in Wi-Fi and Bluetooth, used for IoT devices, smart-home controllers and web dashboards.5 min read · Boards & MicrocontrollersComponent guideBeginnerArduino UnoThe Arduino Uno is a beginner-friendly microcontroller board that reads sensors and controls LEDs, motors and relays using simple C++ programs called sketches.5 min read · Boards & Microcontrollers

Sources

  • ATmega328P datasheet, I/O ports chapter (Microchip)
  • ESP32 Series Datasheet, GPIO section (Espressif Systems)
  • RP2040 datasheet, GPIO pads (Raspberry Pi Ltd)

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerWhy a floating input reads randomlyPull-up vs pull-down wiringReading a button with INPUT_PULLUPChoosing the resistor valueOpen-drain outputs need pull-upsTry itCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide3 items · ₹108

Resistor Assortment Kit (30 Values) · Tactile Push Button Switch · Solderless Breadboard

Run itChange the inputs and watch the output
HIGHdigitalRead(BTN)
Built-in LED OFF

A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.

Ask the Community

Ask a question