Microcontroller Pin Functions


This page explains the basic pin functions that most microcontrollers share, and offers some tips for switching from one microcontroller to another. Since the tutorials on this site are all written with the Arduino Uno in mind, and students may be using other controllers, you may need to know how to “convert” a tutorial from the controller it’s written for to your own controller. In order to get the most out of it, you should know something about electrical circuits, and what a microcontroller is and what it can do. This video might help: Hardware functions in a microcontroller

What Do All These Pins Do?

A typical microcontroller can have between 6 and 60 pins on it, to which you’re expected to attach power connections, input and output connections, and communications connections. Every microcontroller has different configurations for its pins, and often one pin will have more than one function. This combining of functions on one pin is called pin multiplexing.

Every microcontroller has names for the pins specific to its hardware, but the Arduino  application programming interface (API) provides a set of names  for pins and their functions that should work across all microcontrollers that are programmable with the API. So, for example, A0 will always be the analog input pin 0, whether you’re on an Uno, 101, MKRZero, MKR1000, or other Arduino-compatible board. When you connect to the pin with the same function on another board, your code should operate the same, even though the physical layout of pins is different.

Every board has an operating voltage that affects its pins as well. The operating voltage, which is the same as the voltage of the GPIO pins, is labeled below. If you’re connecting a component to a board with a lower voltage than the component, you’ll need to do some level shifting.

Pin Diagrams

Microcontrollers typically come in a variety of physical forms, or packages. Sparkfun has a nice tutorial on integrated circuit package types if you want to know more. Pin numbering on any integrated circuit, including microcontrollers, starts at top left corner, which is usually marked with a dot. From there, you count around the chip counter-clockwise. For modules like the Arduino Uno, this numbering doesn’t hold up, since the board has several pin headers. The pin headers are usually numbered, and the pins of each header are counted. Unfortunately, header numbering does not always follow the same patterns as IC numbering.

Arduino Uno

Here’s a diagram of how the Arduino Uno’s pins are multiplexed:

Left side pinsBoard ImageRight side pins
The left side pins
start several positions
lower than
the right side pins
The Arduino Uno, with the USB connector facing the topA4; D18; SDA
(duplicate of
bottom left pin)
The first left side pin
is IORef, which
is across from
pin D13 on the right
A5; D19; SCL
(duplicate of
second from bottom left pin)
 D13; SCK; LED
 D12; SDI
IORef (5V)D11; SDO; PWM11
ResetD10;CS; PWM10
+3.3VD9; PWM9
Vin (7-12V DC max.)D6; PWM6
A0; D14D5; PWM5
A1; D15D4
A2; D16D3; PWM3; INT1
A3; D17D2; INT0
SDA; A4; D18D1; TX
SCL; A5; D19D0; RX

At the bottom center of the Uno board is a six-pin connector called the In-Circuit Serial Programming connector (ICSP). It has two rows of pins, labeled as follows:

  • Top row (left to right): Reset, SCK, SDI
  • Bottom row (left to right): Ground, SDO, +5V

On the top right of the Uno is another six-pin connector. The Uno has a second microcontroller on board to handle USB-to-serial communications. This is the ICSP header for that microcontroller.

The Serial port called Serial is attached to pins 0 and 1, and to the USB-Serial micrcontroller on board.

Arduino 101

The Arduino 101 has the same pin layout as the Uno. However, there are some differences in pin functions:

  • Interrupts: All GPIO pins can be used as interrupts for HIGH, LOW, RISING, and FALLING. .Only pins 2, 5, 7, 8, 10, 11, 12, 13 can be used for CHANGE interrupts.
  • Serial: The 101 has two hardware UARTs. Serial is attached directly to the USB port of the 101, not to any pins. GPIO pins 0 and 1 are Serial1
  • The ATN pin: Many shields and expansion modules use SPI communication, this always requires a chip select. On processors that have more than 28 pins there are usually extra unallocated pins that can be used. On the 101, this pin is available.

Arduino MKR Series

Here’s the diagram for the Arduino MKR boards, like the MKRZero, MRK1000, MKR1010,  and so forth. The pin numbering follows the U-shaped pattern of a typical integrated circuit as described above; pin 1 is on the top left, and pin 28 is on the top right:

Left side pinsBoard ImageRight side pins
AREFThe MKR Zero, with the USB connector facing up5V (only when powered from USB)
A0; DAC0; D15Vin – voltage in, 5-6V max.
A1; D16; INT16Vcc – 3.3V
A2; D17; INT17GND – ground
A3; D18; PWM18reset
A4; D19; PWM19D14; Serial1 TX
A5; D20D13; Serial1 RX
A6; D21D12; SCL
D0; PWM0; INT0D11; SDA
D1; PWM1; INT1D10; SDI; PWM10
D4; PWM4; INT4D7; PWM7; INT7
D5; PWM4; INT5D6; PWM6; INT6; built-in LED

Notes on the MKR Series

  • Serial: The MKR series boards have two hardware UARTs.The first one, UART0 (aka Serial in your sketches) is attached directly to the USB port not to any pins. GPIO pins 13 and 14 are Serial1
  • Battery in: LiPo, 3.7V, 700mAh min Recharging circuit on board.

Arduino Nano Series

Here’s the diagram for the Arduino Nano boards, like the Nano Every, Nano 33 IoT, and Nano Every BLE. The Nano 33 IoT is shown, but the other Nanos have the same pin layout. The pin numbering follows the U-shaped pattern of a typical integrated circuit as described above; pin 1 is on the top left, and pin 28 is on the top right:

Left sideBoard ImageRight side
Extra functionAnalog Pin NumberDigital pin number Digital pin numberExtra function
SCK D13Arduino Nano 33 IoT board with USB connector facing the topD12~SDI
  Vin (21V max.)D1TX

Notes on the Nano Series

  • The Nano Every operates on 5V. The Nano 33 IoT and 33 BLE operate on 3.3V.
  • The Nano 33 IoT is based on the SAMD21 processor, just like the MKR boards. It has a NINA W102 radio that can communicate using Bluetooth 4.0 or WiFi, just like the MKR 1010. It also has a real-time clock and an IMU sensor. For more on this board, see the Introduction to the Nano 33 IoT.
  • The Nano 33 BLE is based on the nRF 52840 microcontroller. It can communicate using Bluetooth 5.0
  • The Nano Every is based on the ATMega4809 microcontroller. It is functionally most similar to the Uno’s Atmega328 processor.
  • On the Nano Every, pins 16 and 17 (TX and RX)  are the serial port called Serial; they are also attached to the USB-Serial micrcontroller on board. On  the 33 IoT and 33 BLE, they are the serial port called Serial1 and are not attached to the USB serial port.
  • On the Nano 33 IoT as opposed to other Arduino Nano boards, pins A4 and A5 have an internal pull-up resistor and default to the I2C functions.
  • On the Nano 33 IoT and Nano 33 BLE,  the Vusb pin does NOT supply voltage but is connected through a jumper, to the USB power input. You need to solder the jumper on the bottom of the board to use Vusb.
  • Serial: The MKR series boards have two hardware UARTs.The first one, UART0 (aka Serial in your sketches) is attached directly to the USB port not to any pins. GPIO pins 13 and 14 are Serial1
  • Interrupts: All the Nano 33 IoT’s, Nano 33 BLE’s, and Nano Every’s digital pins can be used as hardware interrupts.
  • PWM: on the Nano 33 IoT, the following pins can be used as PWM pins: digital pins 2, 3, 5, 6, 9, 10, 11, 12, A2, A3, and A5. One pin A0, can also be used as a true analog out, because it has a digital-to-analog converter (DAC) attached. On the Nano Every, only pins  3, 5, 6, 9, and 10 can be used as PWM pins. On the Nano 33 BLE, all digital pins can be used as PWM pins.

Pin Functions Explained

In order to make sense of all of this, it helps to know the general functions of a microcontroller. There are a few common functions:

Power:  Every microcontroller will have connections for power (often labeled Vcc, Vdd, or Vin) and ground. A bare microcontroller will have only those, but modules like the Arduino, the Raspberry Pi, and others also have voltage regulators and other components on board. On these, it’s common to see an unregulated voltage input (Vin) and a regulated voltage output (5V and 3.3V on the Uno, for example).

Clock: Every microcontroller needs a clock. The bare microcontroller chip usually has two pins for this. On a module, the clock is usually built onto the board, and the pins are not exposed.

General Purpose Input and Output (GPIO): Most pins on a microcontroller can operate as either a digital input or digital output.

Hardware Interrupts: Many microcontrollers have a subset of their GPIO pins attached to hardware interrupt circuits. A hardware interrupt can interrupt the flow of a program when a given pin changes its state, so you can read it immediately. Some higher level functions like asynchronous serial and PWM sometimes use these interrupts. They’re also good for very responsive reading of digital inputs.

Analog Input (ADC): Not all microcontrollers have an analog-to-digital converter (ADC), but those that do have a number of pins connected to it and act as inputs to the ADC. If there are analog inputs, include analog reference pin as well, that tells the microcontroller what the default high voltage of the ADC is.

Pulse Width Modulation (PWM): Few microcontrollers have a true analog voltage output (though the MKR1000 does), but most have a set of pins connected to an internal oscillator that can produce a pseudo-analog voltage using PWM. This is how the analogWrite() function in Arduino works.


Universal Asynchronous Receiver/Transmitter (UART): Asynchronous serial communication is managed by a Universal Asynchronous Receiver/Transmitter, or UART, inside the processor. The UART pins are usually attached to internal hardware interrupts that can interrupt the program flow when new serial data arrives, so you never miss a byte. It’s possible to manage serial communication in software alone, but at high speeds, you’ll see more errors.

Synchronous Serial: SPI and I2C: Most microcontrollers also have dedicated modules in the processor to handle the two most common forms of synchronous serial communication.

The Serial-Peripheral Interface (SPI) bus has four dedicated pins: Serial Data Out (SDO), also called Controller In, Peripheral Out (CIPO); Serial Data In (SDI), or Controller Out, Peripheral In (COPI); Serial Clock (SCK) and Chip Select (CS). Many miccrocontrollers are programmed via SPI through an In-Circuit Serial Programming header (ICSP) as well.

The Inter-Integrated Circuit (I2C) bus has two pins: Serial Data (SDA) and Serial Clock (SCL).

Reset: All microcontrollers have a pin which resets the program. Usually you take this pin low to reset the controller.

IORef: this is the operating voltage of the board. The Uno and 101 have this pin so that shields can read this voltage to adjust their own output voltages as needed. Not all shields have this functionality.