In this tutorial, we will have a brief overview about the Arduino Mega Board, the layout of a typical Mega board, some of the important specifications and finally the Arduino Mega Pinout.
Since the introduction of Arduino UNO as a quick prototyping board, there has always been a demand for more features than what Arduino UNO can offer. The answer to this is the Arduino Mega Board.
While Arduino Nano is a breadboard friendly version of Arduino UNO with more or less the same features, Arduino Mega is completely a different board. It can be considered as a big brother to both UNO and Nano, both in terms of size as well as features.
Arduino Mega is based on ATmega2560 Microcontroller, an 8-bit AVR Architecture based MCU from ATMEL. It is available in a 100-pin Quad Flat Package.
It is designed and developed to provide more number of IO lines (both Digital and Analog), more flash memory and more RAM when compared to UNO.
So, if you are developing some advanced robotic projects or 3D Printing hardware and want to use the Arduino environment, then Arduino Mega 2560 is the board for you.
Arduino Mega Board Layout
The following image shows the layout of a typical Arduino Mega board. Unlike Arduino Nano, all the components are placed on the top side of the PCB.
As you can notice, there is a Type-B USB connector on the left short edge of the board, which is used for powering on the board as well as programming the Microcontroller. There is also a 2.1 mm DC jack to provide external power supply. Apart from that, the layout of Arduino Mega is very much self-explanatory.
I will discuss about the pins of Arduino Mega in the Arduino Mega Pinout Section.
Technical Specifications of Arduino Mega
As Arduino Mega is based on ATmega2560 Microcontroller, the technical specifications of Arduino Mega are mostly related to the ATmega2560 MCU. But none the less, let me give you a brief overview about some important technical specifications of Arduino Mega 2560.
|Input Voltage|| |
6V – 20V (limit)
7V – 12V (recommended)
|Flash Memory|| |
256 KB (8 KB of this used by bootloader)
Digital IO Pins
|54 (of which 15 can produce PWM)|
|Analog Input Pins|| |
How to power up the Arduino Mega?
There are a couple of ways in which you can power the Mega board. The first and easy way is using the Type-B USB Connector. The next way is to provide an unregulated supply in the range of 6V to 20V to VIN pin of the Mega.
You can also supply the unregulated supply through the 2.1mm DC Jack, in which case, you can access the supplied voltage through the VIN Pin.
What are Different Memories of Arduino Mega?
Strictly speaking, this is specific to the MCU i.e., ATmega2560, used on the Arduino Mega Board. There are three different memories available in ATmega2560. They are:
- 256 KB of Flash Memory
- 8 KB of SRAM
- 4 KB of EEPROM
- 8 KB of the Flash Memory is used by the bootloader code.
What are the Input and Output Pins of Arduino Mega?
Of the 86 pins available on the Mega board, 72 pins are associated with input and output. In that 54 pins (D0 to D53) are true digital IO pins, which can be configured as per you application using pinMode(), digitalWrite() and digitalRead() functions.
All these Digital IO pins are capable of sourcing or sinking 20mA of current (maximum 40mA is allowed). An additional feature of the Digital IO pins is the availability of internal pull-up resistor (which is not connected by default). The value of the internal pull-up resistor will be in the range of 20KΩ to 50KΩ.
There are also 16 Analog Input Pins (A0 to A15). All the analog input pins provide a 10-bit resolution ADC feature, which can be read using analogRead() function.
An important point about Analog Input pins is that they can be configured as Digital IO pins, if required.
Digital IO pins 2 – 13 and 44 – 46 are capable of producing 8-bit PWM Signals. You can use analogWrite() function for this.
Communication Interfaces on Arduino Mega
Arduino Mega supports three different types of communication interfaces. They are:
- I2C or I2C
Perhaps the most common communication interface in the Arduino universe is the Serial Communication. In fact, the Arduino boards (UNO or Nano or Mega) are programmed using the serial communication.
Arduino Mega supports four hardware Serial Communication interfaces. Digital IO pins 0 and 1 are used as Serial RX0 and TX0 pins to receive and transmit serial data. These pins are connected to the serial pins of the on-board USB to Serial Converter IC.
Similarly. Digital IO pins 19 and 18 as RX1 and TX1, 17 and 16 as RX2 and TX2 and 15 and 14 as RX3 and TX3 respectively.
Digital IO Pins 20 and 21 can be configured as SDA (20) and SCL (21) to support I2C or I2C or Two Wire Interface (TWI) communication.
The final communication interface is the SPI. Digital IO Pins 50, 51 52 and 53 can be configured as SPI pins MISO, MOSI, SCK and SS respectively.
There is an on-board LED connected to digital IO pin 13. Use this LED to perform Blinky operations. The reference voltage for the internal ADC is by default set to 5V. But using the AREF pin, you can manually set the upper limit of the ADC.
Using the IOREF pin, you can set the reference voltage for Microcontroller operations.
To reset the microcontroller, you can use the on-board RESET button.
Although you can program the Arduino Mega using the USB cable, there is a provision to program the MCU using the In-Circuit Serial Programming (ICSP) interface.
The UART bootloader, which is preloaded in to the ATmega2560 Microcontroller, enables programming through serial interface. But ICSP doesn’t need any bootloader. You can program Arduino Mega using ISCP or use the ISCP of Arduino Mega to program other Arduino Boards.
Digital IO Pins 2, 3, 18, 19, 20 and 21 can be configured as External Interrupts Pins INT0, INT1, INT5, INT4, INT3 and INT2 respectively. Use attachInterrupt() function to configure the Interrupt for rising edge, falling edge or level change on the pin.
If you want use any Shields, then Arduino Mega is perfectly compatible with most of shields designed for Arduino UNO.
Arduino Mega Pinout
Now that we have seen a little bit about Arduino Mega and its important features and specifications, let us dive into the Arduino Mega Pinout. The following image shows the complete pinout of Arduino Mega Board.
As you can see from the image, I described each pin of the Arduino Mega with its Microcontroller equivalent pin, alternative functions, default functionality and other additional features.
For higher resolution image, click here.
This was a brief overview on Arduino Mega board layout, technical specifications, important features and most importantly the complete Arduino Mega Pinout information.