5.9. Pin assignments

The table below lists the most important pin assignments for the ATmega32U4 on the 3pi+ 32U4. This table is helpful if you want to add your own electronics to the 3pi+ 32U4, write your own low-level code for interfacing with the hardware, or just want to understand better how the 3pi+ 32U4 works. Each row represents a physical pin on the ATmega32U4.

The “ATmega32U4 pin name” column shows the official name of the pin according to the ATmega32U4 datasheet.

The “Arduino pin names” column lists the names provided by the Arduino environment for the pin. These names can generally be used as arguments to any function that takes a pin number. However, there are some exceptions. For example, passing the number 4 to analogRead actually reads pin A4, not pin 4. Also, due to hardware limitations, some functions only work on a limited set of pins.

The “3pi+ 32U4 functions” column documents what the pin is used for on the 3pi+ 32U4. Many pins can serve multiple purposes concurrently by switching modes. For example, PB0 can read the state of button C when it is an input, and it can control the red LED and serve as a display interface line when it is an output.

The “Note/alternate functions” column documents other features of the pin, although some of those features might be impractical to use.

ATmega32U4
pin name
Arduino
pin names
3pi+ 32U4 functions Notes/alternate functions
PD6 12, A11, 29 Line sensor 1 (DN1, leftmost) Analog input (ADC7)
JTAG test data in (TDI)
PF7 A0, 18 Line sensor 2 (DN2) Analog input (ADC5)
JTAG test mode select (TMS)
PF5 A2, 20 Line sensor 3 (DN3, center)
Analog input (ADC4)
JTAG test clock (TCK)
PF4 A3, 21 Line sensor 4 (DN4) Analog input (ADC8)
Timer1 input capture pin (ICP1)
PF1 A4, 22 Line sensor 5 (DN5, rightmost) Analog input (ADC9)
Timer4 PWM output D (OC4D)
Timer1 counter source (T1)
PD4 4, A6, 24 Left bump sensor (BL) Analog input (ADC1)
PC6 5 Right bump sensor (BR) Timer3 PWM output A (OC3A)
Timer4 PWM output A (OC4A)
PB7 11 IR emitter control (EMIT)
(for line sensors and bump sensors)
Timer0 PWM output A (OC0A)
Timer1 PWM output C (OC1C)
UART flow control (RTS)
Pin-change interrupt (PCINT7)
PD2 0 OLED version: Display reset (RESET)
LCD version: LCD control line (RS)
UART receive pin (RXD1)
External interrupt source (INT2)
PD3 1 OLED version: Display SPI clock (SCK)
LCD version: LCD control line (E)
UART transmit pin (TXD1)
External interrupt source (INT3)
PB3 14, MISO User pushbutton A
LCD version: LCD data line DB4
SPI Master Input/Slave Output (MISO)
Pin-change interrupt (PCINT3)
PB0 17, LED_BUILTIN_RX, SS Red LED (RX)
User pushbutton C
OLED version: Display data/command select (D/C)
LCD version: LCD data line DB5
SPI slave select (SS)
Pin-change interrupt (PCINT0)
PC7 13, LED_BUILTIN Yellow LED
LCD version: LCD data line DB6
Timer4 PWM output A (OC4A)
Timer3 input capture pin (ICP3)
Divided system clock output (CLKO)
PD5 30, LED_BUILTIN_TX Green LED (TX)
User pushbutton B
OLED version: Display data (MOSI)
LCD version: LCD data line DB7
UART external clock (XCK1)
UART flow control (CTS)
PD7 6, A7, 25 Buzzer PWM Analog input (ADC10)
Timer4 PWM output D (OC4D)
Timer0 counter source (T0)
PF6 A1, 19 Battery level input (VSW/3) Analog input (ADC6)
JTAG test data out (TDO)
PB6 10, A10, 28 Left motor PWM Analog input (ADC13)
Timer1 PWM output B (OC1B)
Timer4 PWM output B (OC4B)
Pin-change interrupt (PCINT6)
PB2 16, MOSI Left motor direction SPI Master Output/Slave Input (MOSI)
Pin-change interrupt (PCINT2)
PB5 9, A9, 27 Right motor PWM Analog input (ADC12)
Timer1 PWM output A (OC1A)
Timer4 PWM output B (OC4B)
Pin-change interrupt (PCINT5)
PB1 15, SCK Right motor direction SPI Clock (SCK)
Pin-change interrupt (PCINT1)
PB4 8, A8, 26 Left encoder XORed input Analog input (ADC11)
Pin-change interrupt (PCINT4)
PE2 - Left encoder input Hardware bootloader select (HWB)
PE6 7 Right encoder XORed input Analog comparator negative input (AIN0)
External interrupt source (INT6)
PF0 A5, 23 Right encoder input Analog input (ADC0)
PD0 3, SCL I²C clock for inertial sensors Timer0 PWM output B (OC0B)
External interrupt source (INT0)
PD1 2, SDA I²C data for inertial sensors External interrupt source (INT1)
RESET - Reset pushbutton internally pulled high, active low
AREF - - Analog reference

Related Products

3pi+ 32U4 Control Board
3pi+ 32U4 OLED Robot Kit with 30:1 MP Motors (Standard Edition Kit)
3pi+ 32U4 OLED Robot Kit with 15:1 HPCB Motors (Hyper Edition Kit)
3pi+ 32U4 OLED Robot - Turtle Edition (75:1 LP Motors), Assembled
3pi+ 32U4 OLED Robot - Standard Edition (30:1 MP Motors), Assembled
3pi+ 32U4 OLED Robot - Hyper Edition (15:1 HPCB Motors), Assembled
3pi+ 32U4 OLED Control Board
3pi+ 32U4 Robot Kit with 75:1 LP Motors (Turtle Edition Kit)
3pi+ 32U4 Robot Kit with 30:1 MP Motors (Standard Edition Kit)
3pi+ 32U4 Robot Kit with 15:1 HPCB Motors (Hyper Edition Kit)
3pi+ 32U4 Robot - Turtle Edition (75:1 LP Motors), Assembled
3pi+ 32U4 Robot - Standard Edition (30:1 MP Motors), Assembled
3pi+ 32U4 Robot - Hyper Edition (15:1 HPCB Motors), Assembled
3pi+ 32U4 OLED Robot Kit with 75:1 LP Motors (Turtle Edition Kit)
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors