A general purpose I/O pin, or GPIO pin for short, is a pin on a microcontroller (ref) which can be used for software-controlled input or output.

GPIO pins are often shared with other peripherals, such as UART and SPI pins.

Usage as an input

If the internal output driver is placed in a high impedance state, then whatever is connected to the pin will determine its current value. Voltages near the I/O voltage will cause a logic "1", and voltages near 0 V will cause a logic "0". Voltages in between may or may not produce a consistent value, as governed by the logic family of the input device. The high or low value can be read in software, using a function like digitalRead().

Some GPIO pins can handle voltages higher than the I/O voltage. For more information, see voltage tolerance.

Unused input pins may cause increased power consumption if the input voltage floats about halfway in between the low and high states, along with spurious value changes. To avoid erratic behavior, set the pin to an output mode or use a pull-up resistor.

Usage as an output

Each GPIO pin also features an output driver, which can set the pin to either a high or low value in software using a function like digitalWrite(). A logic "1" is represented by a voltage close to the I/O voltage of the microcontroller, while a logic "0" is near 0 V.

The actual values of these voltages may vary depending on what type of load is connected to the microcontroller. Pins with high drive strength are affected less by the power draw of the connected device. For this reason, devices driven directly by GPIOs should have short wires and low power requirements.

Teams Contributed to this Article:

  • BLRS (Purdue SIGBots)

Last updated


This work is licensed under a Attribution-ShareAlike 2.0 Generic License