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.
Double header D22–D53
| Name | Chip port | Direction | UART | I2C | SPI | PWM | ADC | Note |
|---|---|---|---|---|---|---|---|---|
| D0 | PE0 | input/output | RX0 | UART0 RX (Serial) – shared with the USB-serial converter (program upload) | ||||
| D1 | PE1 | input/output | TX0 | UART0 TX (Serial) – shared with the USB-serial converter | ||||
| D2 | PE4 | input/output | PWM | PWM (OC3B); external interrupt INT4 (attachInterrupt 0) | ||||
| D3 | PE5 | input/output | PWM | PWM (OC3C); external interrupt INT5 (attachInterrupt 1) | ||||
| D4 | PG5 | input/output | PWM | PWM (OC0B) | ||||
| D5 | PE3 | input/output | PWM | PWM (OC3A) | ||||
| D6 | PH3 | input/output | PWM | PWM (OC4A) | ||||
| D7 | PH4 | input/output | PWM | PWM (OC4B) | ||||
| D8 | PH5 | input/output | PWM | PWM (OC4C) | ||||
| D9 | PH6 | input/output | PWM | PWM (OC2B) | ||||
| D10 | PB4 | input/output | PWM | PWM (OC2A) | ||||
| D11 | PB5 | input/output | PWM | PWM (OC1A) | ||||
| D12 | PB6 | input/output | PWM | PWM (OC1B) | ||||
| D13 | PB7 | input/output | PWM | PWM (OC0A); onboard LED "L" | ||||
| D14 | PJ1 | input/output | TX3 | UART3 TX (Serial3) | ||||
| D15 | PJ0 | input/output | RX3 | UART3 RX (Serial3) | ||||
| D16 | PH1 | input/output | TX2 | UART2 TX (Serial2) | ||||
| D17 | PH0 | input/output | RX2 | UART2 RX (Serial2) | ||||
| D18 | PD3 | input/output | TX1 | UART1 TX (Serial1); external interrupt INT3 (attachInterrupt 5) | ||||
| D19 | PD2 | input/output | RX1 | UART1 RX (Serial1); external interrupt INT2 (attachInterrupt 4) | ||||
| D20 | PD1 | input/output | SDA | I2C SDA (Wire), 10 kΩ pull-up to 5 V; interrupt INT1 (attachInterrupt 3) | ||||
| D21 | PD0 | input/output | SCL | I2C SCL (Wire), 10 kΩ pull-up to 5 V; interrupt INT0 (attachInterrupt 2) | ||||
| D22 | PA0 | input/output | Port A (PA0). Pins D22–D37 and D39–D41 also form the external memory bus (XMEM). | |||||
| D23 | PA1 | input/output | ||||||
| D24 | PA2 | input/output | ||||||
| D25 | PA3 | input/output | ||||||
| D26 | PA4 | input/output | ||||||
| D27 | PA5 | input/output | ||||||
| D28 | PA6 | input/output | ||||||
| D29 | PA7 | input/output | ||||||
| D30 | PC7 | input/output | ||||||
| D31 | PC6 | input/output | ||||||
| D32 | PC5 | input/output | ||||||
| D33 | PC4 | input/output | ||||||
| D34 | PC3 | input/output | ||||||
| D35 | PC2 | input/output | ||||||
| D36 | PC1 | input/output | ||||||
| D37 | PC0 | input/output | ||||||
| D38 | PD7 | input/output | ||||||
| D39 | PG2 | input/output | ||||||
| D40 | PG1 | input/output | ||||||
| D41 | PG0 | input/output | ||||||
| D42 | PL7 | input/output | ||||||
| D43 | PL6 | input/output | ||||||
| D44 | PL5 | input/output | PWM | PWM (OC5C) | ||||
| D45 | PL4 | input/output | PWM | PWM (OC5B) | ||||
| D46 | PL3 | input/output | PWM | PWM (OC5A) | ||||
| D47 | PL2 | input/output | ||||||
| D48 | PL1 | input/output | ||||||
| D49 | PL0 | input/output | ||||||
| D50 | PB3 | input/output | MISO | SPI MISO (also on the ICSP header) | ||||
| D51 | PB2 | input/output | MOSI | SPI MOSI (also on the ICSP header) | ||||
| D52 | PB1 | input/output | SCK | SPI SCK (also on the ICSP header) | ||||
| D53 | PB0 | input/output | SS | SPI SS – leave as output in SPI master mode | ||||
| A0 | PF0 | input/output | ADC0 | |||||
| A1 | PF1 | input/output | ADC1 | |||||
| A2 | PF2 | input/output | ADC2 | |||||
| A3 | PF3 | input/output | ADC3 | |||||
| A4 | PF4 | input/output | ADC4 | |||||
| A5 | PF5 | input/output | ADC5 | |||||
| A6 | PF6 | input/output | ADC6 | |||||
| A7 | PF7 | input/output | ADC7 | |||||
| A8 | PK0 | input/output | ADC8 | Analog input ADC8. Pins A8–A15 (port K) also support pin-change interrupts (PCINT16–23). | ||||
| A9 | PK1 | input/output | ADC9 | |||||
| A10 | PK2 | input/output | ADC10 | |||||
| A11 | PK3 | input/output | ADC11 | |||||
| A12 | PK4 | input/output | ADC12 | |||||
| A13 | PK5 | input/output | ADC13 | |||||
| A14 | PK6 | input/output | ADC14 | |||||
| A15 | PK7 | input/output | ADC15 | |||||
| NC | – | Nezapojeno (rezerva) | ||||||
| IOREF | output | Board logic level (5 V) – shields that support both 3.3 V and 5 V are configured according to it. | ||||||
| RESET | input | Reset – connecting to GND restarts the chip (same as the RESET button). | ||||||
| 3V3 | output | 3.3 V output, max. 50 mA | ||||||
| 5V | input/output | 5 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 | – | |||||||
| VIN | input | Power 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 | – | |||||||
| AREF | input | ADC reference (default 5 V) | ||||||
| SDA | PD1 | input/output | SDA | I2C SDA – propojeno s D20 | ||||
| SCL | PD0 | input/output | SCL | I2C SCL – propojeno s D21 | ||||
| 5V | input/output | 5 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. | ||||||
| 5V | input/output | 5 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/:
- Meduino Mega2560 Pro Mini – the same ATmega2560 chip on a miniature board
More pinouts
See all pinouts on the Pinouts page.