0% found this document useful (0 votes)
47 views22 pages

AZ-Delivery Mega 2560 R3 Overview

This document presents the Mega 2560 R3 board, including its specifications, pins, and features. It explains the differences with other boards and how to set up the Arduino IDE to use it.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views22 pages

AZ-Delivery Mega 2560 R3 Overview

This document presents the Mega 2560 R3 board, including its specifications, pins, and features. It explains the differences with other boards and how to set up the Arduino IDE to use it.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Welcome!

We thank you for purchasing the AZ-Delivery MEGA 2560 R3 board.


with ATmega2560. In the following pages, we will present to you
the use and configuration of this practical device.

Have fun!
Presentation

Difference between a microcontroller ATmega328P, ATmega16U2 and the Mega 2560 R3 board...

Specifications5

Broaching

MEGA 2560 R3................................................................................................................................7

Compatibility of the Shield Mega 2560 R3.........................................................................................8

Description of the pins................................................................................................................9

Serial communication interface....................................................................................................10

External interrupt interface.............................................................................................11

Analog interface

I2C Interface..................................................................................................................................13

SPI Interface.................................................................................................................................13

Embedded LED............................................................................................................................13

Driver installation..................................................................................................................14

Configure the Arduino IDE.............................................................................................................16

Code examples........................................................................................................................20

PWM - Pulse Width Modulation.............................................................................21

2
Introduction

The Mega 2560 R3 microcontroller board is the successor to the Mega board.
This is a microcontroller board based on a microcontroller.
ATmega2560 AVR. It has 54 digital input/output pins.
(14 can be used as PWM outputs), 16 inputs
analog, 4 UART (hardware serial ports), a quartz oscillator of
16MHz, a USB connection, a power socket, an ICSP connector
and a reset button.

It contains everything necessary for the microcontroller to function.


Just connect it to a computer with a USB cable or power it.
with an AC/DC adapter or a battery to start.

The Mega 2560 R3 with ATmega2560 adds SDA and SCL pins to
next to the AREF. In addition, there are two new pins placed near the
RESET brooch.

The AZ-Delivery Mega 2560 differs from the previous Mega in that it does not use
not the FTDI USB-to-serial driver chip. Instead, it has a chip
CH340 as USB-to-serial converter. This chip allows the
communication between the PC and the Mega and downloading the code to the
ATmega2560 processor.

To enable communication between the PC and the Mega, a driver for the
the CH340 chip must be installed.

3
Difference between an ATmega328P microcontroller, ATmega16U2 and the
Mega 2560 R3 board

The microcontroller with ATmega328P, ATmega16U2 is a board


microcontroller based on the ATmega328 which has 14 pins
digital input/output. 6 of them (D3, D5, D6, D9, D10, and D11)
can be used as PWM outputs and 6 analog inputs, a
serial communication line (D0, D1). The Mega 2560 R3 board provides
much more pins than the microcontroller with ATmega328P
ATmega16U2

The Mega 2560 R3 board is based on the ATmega2560. It has 54


digital input/output pins. 15 can be used as
PWM outputs, 16 analog inputs, 4 UARTs. The UARTs are ports
series materials. On the ATmega328P, ATmega16U2 cards, there is a
RX pin and a TX pin, in addition to the Mega 2560 R3 board which has 3
RX pins and 3 TX pins, 1 SDA pin and 1 SCL pin.

4
Specifications

Microcontroller ATmega2560
DC power supply 7-12V
Power supply voltage limit 6-20V
USB Tension 5V
Digital I/O connectors 54 (14 with PWM support)
Analog input connectors 16
DC consumption by I/O 40mA
DC consumption by 3.3V 50mA
Flash Memory 256KB (8KB for the bootloader)
SRAM 8KB
EEPROM 4KB
Clock frequency 16MHz
Interfaces SPI, I2C, UART
Dimensions 102x53x15mm (4.1x2x0.6in)

5
Broaching

The Mega 2560 R3 has 84 pins. The pinout is as follows:

6
MEGA 2560 R3

The Mega 2560 R3 is specially designed for projects that require


complex circuits and more memory space. Most projects
electronics can be made by the Mega, such as manufacturing
of 3D printers or the control of several motors, due to its
ability to store more instructions in code memory and
of a certain number of digital and analog input/output pins.

The Mega 2560 R3 can be powered in three ways: via the USB cable for
power the board and download the code, via the pin on the board or
through the power supply or the battery.

The Vinet plug and power supply can be used once


the code is downloaded onto this board and the project is completed.

The Mega 2560 R3 comes with a resettable polyfuse that prevents the
USB port of your computer to overheat in the presence of a high current
circulating on the map. Most computers are equipped with a capacity
to protect oneself from such devices, but adding a fuse offers a layer
of additional protection.

The Mega 2560 R3 can be used for very complex projects in


combination with other cards, shields or independently.

7
Compatibility of the Mega 2560 R3 shield

The Mega 2560 R3 is designed to be compatible with most of the


shields designed for the ATmega328P, ATmega16U2 microcontroller. The
digital pins 0 to 13 (and the adjacent AREF and GND pins), the
analog inputs 0 to 5, the power connector and the connector
ICSP are all in equivalent locations.

The main UART (serial port) is located on the same pins (0 and 1), all
like external interrupts 0 and 1 (pins 2 and 3 respectively).

The SPI is available via the ICSP header on Mega 2560 R3 boards.
and ATmega328P, ATmega16U2.

8
Description of the pins

The 5V pin is used to provide a regulated output voltage of


5VDC. It powers the controller and the other components of the board. It
can be obtained from the card, USB cable or another
regulated 5V power supply. Another voltage regulation is provided
through the 3.3V pin. The maximum current is 50mA.

The input voltage supplied to the board varies from 7V to 20V.


The voltage supplied by the power outlet is accessible through this pin.
However, the output voltage of this pin to the board will be
automatically fixed at 5V.

There are 5 ground pins available on the board, making it useful.


when more ground pins are needed for a project.

The Reset jumper is used to reset the board. By placing this


brooch on LOW, the card is reset.

9
Serial communication interface

The RXD and TXD serial pins are used for transmitting and receiving.
data series. The Rx represents data transmission while
that the Tx is used to receive data.

There are four UART (Universal Asynchronous Receiver) interfaces


Transmitter) where Serial 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).

A SoftwareSerial library allows serial communication on


any digital pin of the Mega 2560 R3.

10
External interrupt interface

Six pins are used to create external interrupts 2


interruption 0
(interruption 3) and 21 (interruption 2). These pins can be configured
to trigger an interrupt on a low value, a rising edge or
descendant, or a change in value. See the function attachInterrupt()
for more details.

AREF

The AREF stands for Analog Reference Voltage (reference voltage)


analog) which is a reference voltage for the analog inputs.
The function used for AREF in Arduino IDE is analogReference().

11
Analog interface

There are 16 analog pins built into the board, labeled from A0 to
A15. It is important to note that all these analog pins can
to be used as digital I/O pins. Each pin
analog with a resolution of 10 bits. They can measure a voltage.
from 0 to 5V. However, the upper value can be modified by using the
AREF function and analogReference() from the Arduino IDE.

12
I2C Interface

Two pins 20 and 21 support I2C communication, where 20


represents SDA (Serial Data Line) mainly used to hold the
Data and 21 represents SCL (Serial Clock Line) mainly used
to provide data synchronization between devices.

SPI Interface

SPI stands for Serial Peripheral Interface and is used for transmission of
data between the controller and other peripheral components. Four
pins 50(MISO), 51(MOSI), 52(SCK), 53(SS) are used for the
communication SPI.

The SPI is also available via the ICSP header.

Embedded LED

This board is equipped with a built-in LED connected to the pin.


Digital 13. A high value turns on the LED and a low value turns it off.
The simple examples of the Arduino IDE can be used
to test the Mega 2560 R3 for the first time.

13
Driver installation

To use the Mega 2560 R3 with the Arduino IDE on Windows, the driver
USB must be installed. The driver can be downloaded from thislink.

Extract the downloaded file and open the folder where the file is.
It has been extracted. Run the installation file called [Link].

14
Once the installation is complete, open the device manager of
Windows and check if the driver is present. The Mega must be connected to
PC via a USB cable. If the driver is correctly installed, it will display
as shown in the following image:

15
Configure the Arduino IDE
If the Arduino IDE is not installed, follow thelinkand download the file
installation for the OS of your choice. The version of the Arduino IDE used
in this eBook is the 1.8.13.

For Windows users, launch the .exe file and follow the instructions.
instructions.

16
For Linux users, download a file named
the .[Link] extension, which needs to be extracted. When it is extracted, go to the
directory extracted and open the terminal in this directory. Two .sh scripts
must be executed, the first called [Link] and the second
called [Link].

To run the first script in the terminal, open the terminal in the
extract the directory and execute the following command:
sh [Link] user_name
user_name - is the name of a superuser in the operating system
Linux. A password for the superuser must be entered at the time of
launch of the order. Please wait a few minutes for the script to
finish.

The second script, called [Link], must be used after the installation of
first script. Run the following command in the terminal (directory
extract) :sh [Link]

After installing these scripts, go to the folder where the IDE is installed.
Arduino.

17
Almost all operating systems come with a text editor.
pre-installed (for example, Windows comes with Notepad, Linux Ubuntu with
Gedit, Linux Raspbian with Leafpad, etc.) All these text editors
perfectly suited to the purpose of this eBook.

The next step is to check if your PC can detect a card.


Atmega2560 R3.
Open the freshly installed Arduino IDE, and go to:
Tools > Board > {your card name here}

18
Code example

Blinking LED

To test this code example, no external component is necessary.


The LED_BUILTIN function in the code is used only for the LED.
integrated on the map.

void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}

voidloop() {
digitalWrite(LED_BUILTIN,HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}

20
PWM - Pulse Width Modulation

intled = 13;// Built-in LED is connected to pin 13intbrightness = 0;


intfadeAmount = 5;

void setup() {
pinMode(led, OUTPUT);
}

voidloop() {
analogWrite(led, brightness);
brightness = brightness + fadeAmount;
if(brightness <= 0 || brightness >= 255) {
-fadeAmount;
}
delay(30);
}

21
It is now time to learn and develop your own projects.
You can do it using many examples of scripts and others.
tutorials that you can find on the Internet.

For microelectronic products Arduino and Raspberry Pi


premium quality AZ-Delivery Sales is your contact
privileged. We provide a series of application examples,
complete installation guides, e-books,
libraries and full assistance.

[Link]

Have fun!

Legal Notices
Unable to access external URLs or content.

22

You might also like