Opens in a new tab

Arduino Mega 2560 Pinout

Arduino Mega 2560 is the Uno’s big brother: an ATmega2560 microcontroller at 16 MHz, 54 digital pins, 16 analog inputs and four hardware UARTs. It is the choice when the Uno isn’t enough – 3D printers with a RAMPS board, robotics, larger displays or projects with several serial devices.

The first part of the headers matches the Uno, so most shields fit the Mega too.

Specifications

  • ATmega2560: 8-bit AVR, 16 MHz
  • 256 kB flash (8 kB used by the bootloader), 8 kB SRAM, 4 kB EEPROM
  • 54 digital pins (15× PWM), 16 analog inputs (10-bit ADC)
  • 4× UART, I2C (D20/D21 and separate SDA/SCL pins) and SPI (D50–D53 and the ICSP header)
  • 6 external interrupts (D2, D3, D18–D21)
  • 5 V logic, 7–12 V power input (VIN or barrel jack) or USB power
  • USB-B with an ATmega16U2 converter (CH340 on clones)
  • 101.5 × 53.3 mm

Uno shields that use SPI on pins D11–D13 don’t work on the Mega without modification – SPI is on D50–D53 and the ICSP header here. I2C is on D20/D21 and on the separate SDA/SCL pins next to AREF, not on A4/A5.

Pinout and pin table

Hover over a pin in the diagram or a table row; use the filter to highlight a bus. You can download the pinout as PNG or SVG.

Pin names:
Arduino Mega 2560 Rev3 – pinoutArduino Mega 2560 Rev3 – pinoutchiptron.eu · CC BY 4.0ATmega2560USB-BRESETLTXRXONICSPPOWERANALOG INPWM ~COMMUNICATIONSPI: D50–D53 · PWM: D44–D465V5VD22D23D24D25D26D27D28D29D30D31D32D33D34D35D36D37D38D39D40D41D42D43D44D45D46D47D48D49D50D51D52D53GNDGND NC Nezapojeno (rezerva) IOREF ← Logic level for shields (5 V) RESET → Reset – connect to GND 3V3 ← 3.3 V output, max. 50 mA 5V ↔ 5 V from the regulator or from USB GND GND VIN → Power input 7–12 V A0 PF0 ADC0 A1 PF1 ADC1 A2 PF2 ADC2 A3 PF3 ADC3 A4 PF4 ADC4 A5 PF5 ADC5 A6 PF6 ADC6 A7 PF7 ADC7 A8 PK0 ADC8 A9 PK1 ADC9 A10 PK2 ADC10 A11 PK3 ADC11 A12 PK4 ADC12 A13 PK5 ADC13 A14 PK6 ADC14 A15 PK7 ADC15 SCL PD0 SDA PD1 AREF ← ADC reference (default 5 V) GND D13 PB7 PWM LED (L) D12 PB6 PWM D11 PB5 PWM D10 PB4 PWM D9 PH6 PWM D8 PH5 PWM D7 PH4 PWM D6 PH3 PWM D5 PE3 PWM D4 PG5 PWM D3 PE5 PWM INT5 D2 PE4 PWM INT4 D1 PE1 TX0 D0 PE0 RX0 D14 PJ1 TX3 D15 PJ0 RX3 D16 PH1 TX2 D17 PH0 RX2 D18 PD3 TX1 INT3 D19 PD2 RX1 INT2 D20 PD1 SDA INT1 D21 PD0 SCL INT0 GPIO Chip port UART I2C ADC (analog) PWM Power Ground (GND) Control / reset Not connected

Double header D22–D53

Arduino Mega 2560 Rev3 – pinout (double header D22–D53)Arduino Mega 2560 Rev3 – pinout (double header D22–D53)chiptron.eu · CC BY 4.0ATmega2560USB-BSide headers – described in the main viewNC5VD9D8D7D6A0D5A1D4A2D3A3D2A4D1A5D0A6A7A8A9 5V ↔ 5 V from the regulator or from USB 5V ↔ D22 PA0 D23 PA1 D24 PA2 D25 PA3 D26 PA4 D27 PA5 D28 PA6 D29 PA7 D30 PC7 D31 PC6 D32 PC5 D33 PC4 D34 PC3 D35 PC2 D36 PC1 D37 PC0 D38 PD7 D39 PG2 D40 PG1 D41 PG0 D42 PL7 D43 PL6 D44 PL5 PWM D45 PL4 PWM D46 PL3 PWM D47 PL2 D48 PL1 D49 PL0 D50 PB3 MISO D51 PB2 MOSI D52 PB1 SCK D53 PB0 SS GND GND GPIO Chip port SPI PWM Power Ground (GND)
Download:PNGSVG
Download – Double header D22–D53:PNGSVG
Pin table – Arduino Mega 2560 Rev3
NameChip portDirectionUARTI2CSPIPWMADCNote
D0PE0input/outputRX0UART0 RX (Serial) – shared with the USB-serial converter (program upload)
D1PE1input/outputTX0UART0 TX (Serial) – shared with the USB-serial converter
D2PE4input/outputPWMPWM (OC3B); external interrupt INT4 (attachInterrupt 0)
D3PE5input/outputPWMPWM (OC3C); external interrupt INT5 (attachInterrupt 1)
D4PG5input/outputPWMPWM (OC0B)
D5PE3input/outputPWMPWM (OC3A)
D6PH3input/outputPWMPWM (OC4A)
D7PH4input/outputPWMPWM (OC4B)
D8PH5input/outputPWMPWM (OC4C)
D9PH6input/outputPWMPWM (OC2B)
D10PB4input/outputPWMPWM (OC2A)
D11PB5input/outputPWMPWM (OC1A)
D12PB6input/outputPWMPWM (OC1B)
D13PB7input/outputPWMPWM (OC0A); onboard LED "L"
D14PJ1input/outputTX3UART3 TX (Serial3)
D15PJ0input/outputRX3UART3 RX (Serial3)
D16PH1input/outputTX2UART2 TX (Serial2)
D17PH0input/outputRX2UART2 RX (Serial2)
D18PD3input/outputTX1UART1 TX (Serial1); external interrupt INT3 (attachInterrupt 5)
D19PD2input/outputRX1UART1 RX (Serial1); external interrupt INT2 (attachInterrupt 4)
D20PD1input/outputSDAI2C SDA (Wire), 10 kΩ pull-up to 5 V; interrupt INT1 (attachInterrupt 3)
D21PD0input/outputSCLI2C SCL (Wire), 10 kΩ pull-up to 5 V; interrupt INT0 (attachInterrupt 2)
D22PA0input/outputPort A (PA0). Pins D22–D37 and D39–D41 also form the external memory bus (XMEM).
D23PA1input/output
D24PA2input/output
D25PA3input/output
D26PA4input/output
D27PA5input/output
D28PA6input/output
D29PA7input/output
D30PC7input/output
D31PC6input/output
D32PC5input/output
D33PC4input/output
D34PC3input/output
D35PC2input/output
D36PC1input/output
D37PC0input/output
D38PD7input/output
D39PG2input/output
D40PG1input/output
D41PG0input/output
D42PL7input/output
D43PL6input/output
D44PL5input/outputPWMPWM (OC5C)
D45PL4input/outputPWMPWM (OC5B)
D46PL3input/outputPWMPWM (OC5A)
D47PL2input/output
D48PL1input/output
D49PL0input/output
D50PB3input/outputMISOSPI MISO (also on the ICSP header)
D51PB2input/outputMOSISPI MOSI (also on the ICSP header)
D52PB1input/outputSCKSPI SCK (also on the ICSP header)
D53PB0input/outputSSSPI SS – leave as output in SPI master mode
A0PF0input/outputADC0
A1PF1input/outputADC1
A2PF2input/outputADC2
A3PF3input/outputADC3
A4PF4input/outputADC4
A5PF5input/outputADC5
A6PF6input/outputADC6
A7PF7input/outputADC7
A8PK0input/outputADC8Analog input ADC8. Pins A8–A15 (port K) also support pin-change interrupts (PCINT16–23).
A9PK1input/outputADC9
A10PK2input/outputADC10
A11PK3input/outputADC11
A12PK4input/outputADC12
A13PK5input/outputADC13
A14PK6input/outputADC14
A15PK7input/outputADC15
NC–Nezapojeno (rezerva)
IOREFoutputBoard logic level (5 V) – shields that support both 3.3 V and 5 V are configured according to it.
RESETinputReset – connecting to GND restarts the chip (same as the RESET button).
3V3output3.3 V output, max. 50 mA
5Vinput/output5 V from the regulator (when powered from the jack or VIN) or from USB; it can also power the board, but this bypasses the protection.
GND–
GND–
VINinputPower input 7–12 V. It sits after the power jack's protection diode – when powered from the jack it is 0.7–1 V lower; when powered via VIN, reverse-polarity protection does not work.
GND–
AREFinputADC reference (default 5 V)
SDAPD1input/outputSDAI2C SDA – propojeno s D20
SCLPD0input/outputSCLI2C SCL – propojeno s D21
5Vinput/output5 V from the regulator (when powered from the jack or VIN) or from USB; it can also power the board, but this bypasses the protection.
5Vinput/output5 V from the regulator (when powered from the jack or VIN) or from USB; it can also power the board, but this bypasses the protection.
GND–
GND–

What to watch out for

  • Serial (D0/D1) shares the USB-serial converter – peripherals on these pins interfere with uploading. Use Serial1–3 for other devices.
  • SPI is on D50–D53 (and ICSP), not on D11–D13 as on the Uno.
  • I2C is on D20 (SDA) and D21 (SCL) with 10 kΩ pull-ups to 5 V; A4 and A5 are analog inputs only here.
  • In SPI master mode, keep D53 (SS) set as an output, otherwise SPI switches to slave mode.
  • Draw at most 20 mA per pin (absolute maximum 40 mA) and no more than 200 mA from the whole chip. The 3V3 pin supplies only 50 mA.

Arduino Mega on chiptron.eu/

Projects and guides on chiptron.eu/:

More pinouts

See all pinouts on the Pinouts page.

Related Articles