All about Arduino Mega 2560 Pinout and digram

The Arduino mega2560 is a microcontroller that is based on the ATmega2560 microcontroller. Arduino mega2560 is an 8-bit AVR Architecture based MCU from ATMEL. It is available in a 100-pin Quad Flat Package. 

Arduino Uno, Arduino Nano, and Arduino Micro all is good picks for projects which require less memory to store the program. However, when we get into more complex projects that require large amounts of memory and a large set of I/O interfaces, the Arduino Mega 2560 Rev3 comes into the scene. 

The Arduino mega2560 is designed and developed to provide more input-output lines consisting of both analog i/o lines and digital i/o lines. It also needs more flash memory and more RAM when compared to UNO.

Arduino mega 2560 Board Layout

The Arduino mega board consists of 54 digital input/output pins from which 15 pins are Pulse Width Modulation pins, 16 analog inputs. It also has 4 serial ports, one SPI, and one I2C communication protocol, a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button.

Arduino mega2560 Board Layout

Voltage Converter

The voltage regulator is used to convert the input voltage to 5 volts. Its primary work is to control the input voltage in order to prevent the board from any damage.

Crystal Oscillator

The Crystal oscillator available on the Arduino mega2560 board has a frequency of 16MHz. It provides the clock signal to the microcontroller. Its work is to provide basic timing and control to the board.

Reset Button

The RESET button is used to Reset the board, and it is recommended to press it each time we flash some code to the board.

USB B port

The USB B port is used to plug in the USB cable. This port is used to power the device from the 5V supply and allows us to connect the board to the computer.

Arduino mega2560 Specifications

MCUATmega2560
USB ConnectorUSB-B
In-build LED13
Digital I/O Pins54
Analog input pins16
PWM pins15
UARTYes, 4
I2CYes
SPIYes

Clock Speed

16 MHz
Flash Memory256 KB (8 KB of this used by bootloader)
SRAM8 KB
EEPROM4 KB
Digital IO Pins54 (of which 15 can produce PWM)
Analog Input Pins16
I/O Voltage5V
Input voltage (nominal)7-12V
DC Current per I/O Pin20 mA
Supported battery9V battery
Power Supply ConnectorBarrel Plug
Weight37 g
Width53.3 mm
Length101.5 mm

Pinout OF Arduino Mega2560

Let us now go through the pin description of the Arduino mega2560.

Digital Pins

The Arduino mega2560 has the most number of digital pins in the Arduino family and it is one of the reasons why it is called Arduino Mega. These 54 digital pins can only read two values i,e. High or Low. When there will be an input voltage of 5 volts it will be High and when there is no signal or voltage it will be Low. High and Low are also referred to as 1 for High and 0 for Low.

Arduino mega digital pin
1PE0 Digital pin 0 
2PE1 Digital pin 1 
3PE4 Digital pin 2
4PE5 Digital pin 3
5PG5 Digital pin 4 
6PE3 Digital pin 5
7PH3 Digital pin 6 
8PH4 Digital pin 7
9PH5Digital pin 8 
10PH6Digital pin 9 
11PB4 Digital pin 10 
12PB5Digital pin 11
13PB6 Digital pin 12 
14PB7 Digital pin 13 
15PJ1 Digital pin 14 
16PJ0 Digital pin 15 
17PH1 Digital pin 16 
18PH0 Digital pin 17 
19PD3 Digital pin 18 
20PD2 Digital pin 19 
21PD1 Digital pin 20 
22PD0Digital pin 21
23PA0Digital pin 22
24PA1 Digital pin 23
25PA2 Digital pin 24
26PA3 Digital pin 25
27PA4 Digital pin 26
28PA5 Digital pin 27
29PA6 Digital pin 28
30PA7 Digital pin 29
31PC7Digital pin 30
32PC6 Digital pin 31
33PC5 Digital pin 32
34PC4 Digital pin 33
35PC3 Digital pin 34
36PC2 Digital pin 35
37PC1Digital pin 36
38PC0 Digital pin 37
39PD7 Digital pin 38
40PG2 Digital pin 39
41PG1 Digital pin 40
42PG0 Digital pin 41
43PL7Digital pin 42
44PL6Digital pin 43
45PL5 Digital pin 44 
46PL4 Digital pin 45 
47PL3 Digital pin 46 
48PL2 Digital pin 47
49PL1 Digital pin 48
50PL0 Digital pin 49
51PB3 Digital pin 50
52PB2 Digital pin 51
53PB1 Digital pin 52 
54PB0 Digital pin 53 

Analog Pins

Arduino Mega has 16 analog pins. These pins also get values in contrast to digital pins that receive only two values HIGH and LOW. These analog pins use an analog-to-digital converter (ADC). These pins can act as analog inputs but can also function as digital inputs or digital outputs whenever needed.

These analog pins accept input in the form of analog signals and return values that range between 0 to 1023. The Arduino Mega has a 10-bit Analog to Digital converter or 210 resolution which produces a total of 1024 values i,e. 0 to 1023.

arduino mega analog pins
1PF0 Analog pin 0
2PF1 Analog pin 1
3PF2 Analog pin 2
4PF3 Analog pin 3
5PF4 Analog pin 4
6PF5 Analog pin 5
7PF6 Analog pin 6
8PF7 Analog pin 7
9PK0 Analog pin 8
10PK1Analog pin 9
11PK2 Analog pin 10
12PK3 Analog pin 11
13PK4 Analog pin 12
14PK5 Analog pin 13
15PK6 Analog pin 14
16PaK7 Analog pin 15

Vin

It is the amount of input DC voltage that is required to operate the device.  It is also called the primary voltage for ICs present on the Arduino board. The Vcc voltage value can be negative or positive to the GND pin.

arduino mega vin pins
1AVCC(100)VCC
2VCC(10)VCC
3VCC(31)VCC
4VCC(61)VCC
5VCC(80)VCC

GND(ground)

There are a total of 7 ground pins available in Arduino mega.

arduino mega ground gnd pin
S.NoPin NameMapped Pin Name
1GND(11)GND
2GND(32)GND
3GND(64)GND
4GND(81)GND
5GND(99)GND

Communication Pins of Arduino Mega2560

UART Pins

UART stands for Universal Asynchronous Receiver and Transmitter.The UART pins available on the arduino mega board are 0, 1, 14, 15, 16, 17, 18, 19. Each UART serial port comes with two pins RX and TX. TX is used for transmitting the data and RX is used for receiving the data.

arduino mega UART Pins
S.NoPin NameMapped Pin Name
1PE0 ( RXD0/PCINT8 )Digital pin 0 (RX0)
2PE1 ( TXD0 )Digital pin 1 (TX0)
3PD2 ( RXDI/INT2 )Digital pin 19 (RX1)
4PD3 ( TXD1/INT3 )Digital pin 18 (TX1)
5PH0 ( RXD2 )Digital pin 17 (RX2)
6PH1 ( TXD2 )Digital pin 16 (TX2)
7PJ0 ( RXD3/PCINT9 )Digital pin 15 (RX3)
8PJ1 ( TXD3/PCINT10 )Digital pin 14 (TX3)

SPI Pins

It stands for Semi Peripheral Interface. The SPI pins available on arduino mega boards are 50, 51, 52, and 53. These pins are used to communicate with one or more peripheral devices quickly.

arduino spi pins

There are 3 common lines to all the peripheral devices which are:-

  • SCK– It stands for Serial Clock. These are the clock pulses that are used to synchronize the transfer of data.
  • MISO– It stands for Master Input/ Slave Output. This data line in the MISO pin is used to send the data to the master.
  • MOSI– It stands for Master Output/ Slave Input. This line is used for sending data to the peripherals or slaves.

It also have one unique line used by master which is:-

  • SS– It stands for slave select. It is used by the master device to select the slave with which it wants to establish the connection. It acts as the enable line. When a device’s Slave Select pin value is LOW, it can communicate with the master. When it’s value is HIGH, it ignores the master. 
S.NoPin NameMapped Pin Name
1PB0 ( SS/PCINT0 )Digital pin 53 (SS)
2PB1 ( SCK/PCINT1 )Digital pin 52 (SCK)
3PB2 ( MOSI/PCINT2 )Digital pin 51 (MOSI)
4PB3 ( MISO/PCINT3 )Digital pin 50 (MISO)

I2C Pins

It stands for inter – integrated circuits. I2C is a two-wire serial communication protocol. It uses two lines for sending and receiving data which are:-

arduino mega i2c pins

Serial Clock Pin or SCL.

This pin is used to transfer the clock data. It usually synchronizes the sharing of data between two devices. It is also called the clock line.

Serial Data Pin or SDA.

This pin is used by the slave and master devices to send and receive the data. This is the reason it is called the Data Line. 

S.NoPin NameMapped Pin Name
1PD0 ( SCL/INT0 )Digital pin 21 (SCL)
2PD1 ( SDA/INT1 )Digital pin 20 (SDA)

PWM Pins

It stands for Pulse Width Modulation. There are 15 PWM pins present on the arduino mega board from the set of digital pins. The PWM pins are Starting from digital pin 2 to digital pin 13 and pin 44, 45, and 46.Every PWM pin can generate the PWM signal of 23 bit resolution.

Arduino mega PWM pins
S.NoPin NameMapped Pin Name
1PE4 ( OC3B/INT4 )Digital pin 2 (PWM)
2PE5 ( OC3C/INT5 )Digital pin 3 (PWM)
3PG5 ( OC0B )Digital pin 4 (PWM)
4PE3 ( OC3A/AIN1 )Digital pin 5 (PWM)
5PH3 ( OC4A )Digital pin 6 (PWM)
6PH4 ( OC4B )Digital pin 7 (PWM)
7PH5 ( OC4C )Digital pin 8 (PWM)
8PH6 ( OC2B )Digital pin 9 (PWM)
9PB4 ( OC2A/PCINT4 )Digital pin 10 (PWM)
10PB5 ( OC1A/PCINT5 )Digital pin 11 (PWM)
11PB6 ( OC1B/PCINT6 )Digital pin 12 (PWM)
12PB7 ( OC0A/OC1C/PCINT7 )Digital pin 13 (PWM)
13PL5 ( OC5C )Digital pin 44 (PWM)
14PL4 ( OC5B )Digital pin 45 (PWM)
15PL3 ( OC5A )Digital pin 46 (PWM)

External Interrupts:-  

External interrupts of arduino mega can be formed by using 6 pins which are :-

arduino mega External Interrupts pins
  1. interrupt 0(0)
  2. interrupt 1(3)
  3. interrupt 2(21)
  4. interrupt 3(20)
  5. interrupt 4(19)
  6. interrupt 5(18)

These external interrupt pins can be used to trigger an interrupt on a low value, a rising or falling edge, or a change in value.

S.NoPin NameMapped Pin Name
1PE0 ( PCINT8 )Digital pin 0 
2PE5 ( INT5 )Digital pin 3 
3PD3 ( TXD1/INT3 )Digital pin 18 (TX1)
4PD2 ( RXDI/INT2 )Digital pin 19 (RX1)
5PD1 ( SDA/INT1 )Digital pin 20 (SDA)
6PD0 ( SCL/INT0 )Digital pin 21 (SCL)

ICSP Header

ICSP stands for In-Circuit Serial Programming. This pin is used to program the firmware of the arduino board. 

Arduino Mega ICSP header pins

There are 6 ICSP available on arduino mega boards.

S.NoPin NameMapped Pin Name
1PB2 ( MOSI/PCINT2 )Digital pin 51 (MOSI)
2PB3 ( MISO/PCINT3 )Digital pin 50 (MISO)
3PB5 ( OC1A )Digital pin 11 
4PB6 ( OC1B)Digital pin 12 
5PB7 ( OC0A/OC1C )Digital pin 13 
6PH6 ( OC2B )Digital pin 9 

Frequently Asked Questions:-

  1. Does Arduino Mega support WIFI?

No, the arduino mega does not come with in-built wi-fi.

  1. Does Arduino Mega support multithreading?

No, arduino mega does not support multithreading.

Leave a Comment