Arduino without External Pullup or Pulldown Resistor | applied electronics engineering


Arduino without External Pullup or Pulldown Resistor

By Applied Electronics - Saturday, February 4, 2017 No Comments
Here we show how to work with Arduino without External Pullup or Pulldown Resistor.

If we want to use Arduino digital pin for reading values from switches, for example, normally we put a pullup or pulldown resistor. Usually a 10KOhm resistor is used. See How to read switch input in arduino? tutorial in which external 10kOhm pulldown resistor is used.

But it is not necessary to use such external pullup or pulldown resistor because Arduino has internal pullup resistor. The reason why these internal pullup resistor are built into arduino is that, the state of the pin is in known state. So you can connect for example a switch directly to the digital pin without any pullup or pulldown resistor.

What does internal pullup resistor mean and what does it do?

The internal pullup resistors are resistors which connects internally each pin to +5V power supply. So it means the pins are in HIGH state when internal pullup resistor are used. The internal pullup resistor are from 20KOhm to 150KOhm depending upon which Arduino Board you are using.

Circuit Example of Arduino without External Pullup or Pulldown Resistor

A LED connected to such pullup resistor active pin will turn on by default because the pin has +5V on it.

See an example below.

Arduino without External Pullup or Pulldown Resistor

Here the pin 9 is configured as an input pin with pullup resistor. To this is connected a switch. When the switch is open the LED is turned off and vice versa. This is due to programming as you will see shortly. The point is as this pin 9 is configured as using internal pullup resistor, the default state of the pin is HIGH when the switch is open. Once the switch is closed the pin changes to 0V or LOW. This can be used to control the LED connected to pin 13 according. The pin 13 is an output pin.

Program Code for Arduino without External Pullup or Pulldown Resistor

The program code for the aforementioned working principle is below.

void setup() {
pinMode(9, INPUT_PULLUP);
pinMode(13, OUTPUT);

void loop(){  
   int var = digitalRead(9);
      if (var == LOW){
      else {
      digitalWrite(13, LOW);

In the program code, we have specified that pin 9 should be an input pin and should use the internal pullup resistor using the pinMode function. The pin 13 is made and output using the same function.

In the main loop code, we read the value using digitalRead() function on pin 9 and store the value in a variable called var. Using the state of the switch or equivalently the variable var we turn on or turn off the LED at pin 13 using the if else statement and digitalWrite() function.

Arduino digitalWrite and digitalRead functions are fundamental functions to work with the digital pins like analogWrite and analogRead functions for analog pins. See How to read analog signal into Arduino to learn how to use analogRead function.

If you liked this arduino tutorial then share it. Also subscribe to our blog.

No Comment to " Arduino without External Pullup or Pulldown Resistor "