Arduino Mega
Arduino Mega
Arduino Mega
All the boards mentioned above work perfectly for a number of Arduino
Projects when you require a simple task to be completed with less number of I/O
pins and memory. However, when the nature of project goes complex, a board
with less memory fails to complete the task. This is where Arduino Mega
2560 comes handy. This board comes with 54 pins and 16 analog pins with more
memory to store the code. Sounds crazy, isn’t it? Thanks to technology that keep
your covered in every aspect and provides support in any way when it comes to
fulfilling your technical needs.
Arduino Mega 2560 is a Microcontroller board based on Atmega2560. It
comes with more memory space and I/O pins as compared to other boards
available in the market.
There are 54 digital I/O pins and 16 analog pins incorporated on the board
that make this device unique and stand out from others.
Out of 54 digital I/O, 15 are used for PWM (pulse width modulation).
A crystal oscillator of 16MHz frequency is added on the board.
This board comes with USB cable port that is used to connect and transfer
code from computer to the board.
DC power jack is coupled with the board that is used to power the board.
Some version of Arduino board lacks this feature like Arduino Pro Mini
doesn’t come with DC power jack.
ICSP header is a remarkable addition to Arduino Mega which is used for
programming the Arduino and uploading the code from the computer.
This board comes with two voltage regulator i.e. 5V and 3.3V which
provides the flexibility to regulate the voltage as per requirements as
compared to Arduino Pro Mini which comes with only one voltage
regulator.
There is no much difference between Arduino Uno and Arduino Mega
except later comes with more memory space, bigger size and more I/O
pins.
Arduino software called Arduino IDE is used to program the board which is
a common software used for all boards belonged to Arduino family.
Availability of Atmega16 on the board makes it different than Arduino Pro
Mini which uses USB to serial converter to program the board.
There is a reset button and 4 hardware serial port called USART which
produces a maximum speed for setting up communication.
Following figure shows the specifications of Arduino mega 2560
Pin Description
5V & 3.3V. This pin is used to provide output regulated voltage around 5V. This
regulated power supply powers up the controller and other components on the
board. It can be obtained from Vin of the board or USB cable or another
regulated 5V voltage supply. While another voltage regulation is provided by
3.3V pin. Maximum power it can draw is 50mA.
GND. There are 5 ground pins available on the board which makes it useful
when more than one ground pins are required for the project.
Reset. This pin is used to reset the board. Setting this pin to LOW will reset the
board.
Vin. It is the input voltage supplied to the board which ranges from 7V to 20V.
The voltage provided by the power jack can be accessed through this pin.
However, the output voltage through this pin to the board will be automatically set
up to 5V.
Serial Communication. RXD and TXD are the serial pins used to transmit and
receive serial data i.e. Rx represents the transmission of data while Tx used to
receive data. There are four combinations of these serial pins are used where
Serail 0 contains RX(0) and TX(1), Serial 1 contains TX(18) and RX(19), Serial 2
contains TX(16) and RX(17), and Serial 3 contains TX(14) and RX(15).
External Interrupts. Six pins are used for creating external interrupts i.e interrupt
0(0), interrupt 1(3), interrupt 2(21), interrupt 3(20), interrupt 4(19), interrupt 5(18).
These pins produce interrupts by a number of ways i.e. providing LOW value,
rising or falling edge or changing value to the interrupt pins.
LED. This board comes with built-in LED connected to digital pin 13. HIGH value
at this pin will turn the LED on and LOW value will turn it off. This gives you the
change of nursing your programming skills in real time.
AREF. AREF stands for Analog Reference Voltage which is a reference voltage
for analog inputs.
Analog Pins. There are 16 analog pins incorporated on the board labeled as A0
to A15. It is important to note that all these analog pins can be used as digital I/O
pins. Each analog pin comes with 10-bit resolution. These pins can measure
from ground to 5V. However, the upper value can be changed using AREF and
analogReference() function.
I2C. Two pins 20 and 21 support I2C communication where 20 represents SDA
(Serial Data Line mainly used for holding the data) and 21 represents SCL(Serial
Clock Line mainly used for providing data synchronization between the devices)
SPI Communication. SPI stands for Serial Peripheral Interface used for the
transmission of data between the controller and other peripherals components.
Four pins i.e. 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS) are used for SPI
communication.
Arduino Mega is comparatively larger than other boards available in the market.
It comes 4-inch length and 2.1-inch width. However, USB port and power jack
are slightly extended from the given dimensions.
Shield Compatibility
Arduino Mega is compatible with most of the shields designed for other
Arduino boards.
Before you intend to use a shield, make sure the operating voltage of
the shield is compatible with the board voltage. Most of the shields
operate at 3.3V or 5V which is compatible with this board, however,
shields with higher operating voltage can damage the board.
Also, the header distribution of the shield must resonate with the pin
distribution of the board, so you can simply attach the shield with the
board and make it in a running condition.
Programming
Arduino Mega 2560 can be programmed using Arduino Software called
IDE which supports C programming.
The code you make on the software is called sketch which is burned in the
software and then transferred to the board through USB cable.
This board comes with a built-in bootloader which rules out the usage of an
external burner for burning the code into the board.
The bootloader communicates using STK500 protocol.
Once you compile and burn the program on the board, you can unplug the
USB cable which eventually removes the power from the board. When you
intend to incorporate the board into your project, you can power it up using
power jack or Vin of the board.
Multitasking is another feature where Arduino mega comes handy.
However, Arduino IDE Software doesn’t support multitasking feature but
you can use other operating systems like FreeRTOS and RTX to write C
program for this purpose. This gives you the flexibility of using your own
custom build program using ISP connector.
Applications
Arduino Mega 2560 is an ideal choice for the projects requiring more memory
space to used with more number of number pins on the board. Following are the
main applications of the Arduino mega boards.
Developing 3D printer
Controlling and handling more than one motors
Interfacing of number of sensors
Sensing and detecting temperature
Water level detection projects
Home automation and security systems
Embedded Systems
IoT applications
Parallel programming and Multitasking