Arduino Digital Inputs, Pull Up and Pull Down

Arduino Digital Inputs

Arduino pins default come as Input pins. Therefore there is no requirement to define them as Inputs in the setup. Also most of the time Arduino Analog pins can be configured to be used as Digital inputs/outputs. Arduino input pins have very high input impedance where it takes a very little amount of current to change the state of the pin. Also it is important to note that Arduino Output pins has lower impedance compared to input pins. Sometimes this knowledge on input and output impedance come in handy when designing circuits for special conditions. (ex : When driving loads with higher impedance, Circuits designed for areas with higher noise)

Related Arduino Commands


Sets the relevant Arduino pin as either input or Output.

  • pinMode(pin, mode)

Example Code
  • pinMode(11, OUTPUT); //sets the digital pin 11 as output


Sets the output pin into High or Low state.

  • digitalWrite(pin, value)

Example Code
  • digitalWrite(11, HIGH); //sets the digital pin 11 on


  • digitalRead(pin)

Example Code
  • state = digitalRead(10);   //read the input pin 10 and assign it to the variable state

Why Pullup/Pulldown resistors

Arduino pins has a very high input impedance. Therefore, it takes a very minimal current to change the state of the pin. But it also can show random values due to external noises or capacitive coupling of nearby pins. This issue can be avoided by bring the pin into a known state when an input state is not available. To do this we can use either pullup or pulldown resistors to the input. 

In a seperate term this can be explained as pull up and pull down is used to maintain the locgic voltages (0V and 5V, 0V and 3.3V) other than having floating voltages.

10kOhms resistors are considered as the ideal values for pullup or pulldown resistors in most scenarios.

Internal Pullup Resistors

Arduino architecture supports internal pullup resistors where we don't need to bother about applying external pullup resistors. Arduino digital pins support internal pullups of resistance of 20 kOhms - 50 kOhms.

method 1
pinMode(pin, INPUT);           // set pin to input
digitalWrite(pin, HIGH);       // turn on pullup resistors

method 2
pinMode(pin, INPUT_PULLUP);           //set pin to input pullup state

When do we need external pullup resistors over Internal Pullup resistors

  • Since Internal pullup resistors are high in value, they are more susceptible to noises. (for better noise immunity external resistors like 4.7 kOhms, 2.2 kOhms, 1 kOhms are often used)
  • There could be such situations where we need to pullup voltages other than 5V. (3.3V in some cases)
  •  Pullup resistors can have an impact on the rise time and the fall time. (We will discuss this on a separate article)


  • Never pullup microcontrollers higher than their high logic voltage (ex: Arduino Uno 5V)
  • Consider the power loss of pullup/pulldown resistors when power consumption is a critical factor. (ex : very low power consuming circuits)
  • Use external pullups with lower resistance values (ex: 4.7k) when susceptible to noises.
  • Pullup resistors are very important in I2C communications. (Resistor values depend on the number of devices connected)