science tinker

Arduino Mega 2560

The big Arduino: 54 digital pins, 16 analog inputs and four serial ports, for projects that run out of pins on an Uno.

Boards and wiring · Elements inside: SiCHOCuZnSn

Function: what an Arduino Mega 2560 does in a circuit

The big Arduino: 54 digital pins, 16 analog inputs and four serial ports, for projects that run out of pins on an Uno.

  • Runs larger sketches, with eight times the Uno's program memory
  • Reads and switches up to 54 digital pins and 16 analog inputs
  • Talks to several serial devices at once through four serial ports

Arduino Mega 2560 key facts

MicrocontrollerATmega2560 (8-bit AVR, 16 MHz)
Operating voltage5 V
Digital pins54 (PWM on 2 to 13 and 44 to 46)
Analog inputs16 (A0 to A15), 10-bit: 0 to 1023
I²Cpin 20 (SDA), pin 21 (SCL)
SPIpin 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS)
Serial ports4: Serial on pins 0 (RX) and 1 (TX), Serial1 on 19 and 18, Serial2 on 17 and 16, Serial3 on 15 and 14
Interrupt pins2, 3, 18, 19, 20, 21
Memory256 KB flash (8 KB bootloader), 8 KB RAM, 4 KB EEPROM
Size101.5 × 53.3 mm
Built-in LEDpin 13

How it works

The Mega is built around the ATmega2560, an 8-bit AVR chip at 16 MHz and 5 V like the Uno, but with 100 legs. It has digital pins 0 to 53, with PWM on 2 to 13 and 44 to 46, and analog inputs A0 to A15. I²C moves to pins 20 (SDA) and 21 (SCL), and there are three extra serial ports on pins 14 to 19, used in code as Serial1, Serial2 and Serial3. Text sent on a TX pin arrives at whichever RX pin it is wired to; only Serial (pins 0 and 1, the USB cable) shows in the Serial Monitor. The SPI pins are 50 to 53. Six pins can trigger interrupts: 2, 3, 18, 19, 20 and 21. Memory is much larger: 256 KB of flash, 8 KB of RAM and 4 KB of EEPROM. The left part of the board has the same pin layout as the Uno, so Uno shields fit.

What it is made of

  • Chip: Silicon die in a 100-pin flat black package (TQFP) SiCHO
  • Board: Glass-fibre and epoxy with copper tracks under solder mask CuSiO
  • Headers and sockets: Brass contacts plated with tin, in black plastic CuZnSn
  • Crystal: A thin slice of quartz in a metal can SiO

Where the materials come from: Silicon from quartz sand; copper from chalcopyrite; tin from cassiterite; zinc from sphalerite.

The chemistry

The copper tracks are made by etching: a chemical bath dissolves the copper that is not protected, leaving only the wiring pattern on the board.

Biology connection

More pins are like more nerve endings: an octopus arm has far more sensors and muscles to control than a finger, so it needs many more connections to its nervous system. Reflex arc →

Safety and the environment

On the Mega, I²C is on pins 20 and 21, not A4 and A5, and SPI is on 50 to 53. Keep the total current from all pins under about 200 mA.

Did you know? The Mega 2560 has eight times the program memory of the Uno, which is why many 3D printers use it as their controller.

Try it in the simulator

In Free build, choose Arduino Mega 2560 under Board. Use pins 22 to 53 for extra LEDs, buttons or servos, read up to 16 potentiometers on A0 to A15, and remember that I²C parts go on pins 20 (SDA) and 21 (SCL).

Questions students ask

What does an Arduino Mega 2560 do?

The big Arduino: 54 digital pins, 16 analog inputs and four serial ports, for projects that run out of pins on an Uno. Main functions: runs larger sketches, with eight times the Uno's program memory; reads and switches up to 54 digital pins and 16 analog inputs; talks to several serial devices at once through four serial ports.

When should I use an Arduino Mega instead of an Uno?

Use a Mega when a project needs more than the Uno's 20 pins, more than 2 KB of RAM, or more than one serial port: for example many servos, a large LED matrix, or a robot with many sensors. The code is written the same way, but I²C is on pins 20 and 21.

How does an Arduino Mega 2560 work?

The Mega is built around the ATmega2560, an 8-bit AVR chip at 16 MHz and 5 V like the Uno, but with 100 legs. It has digital pins 0 to 53, with PWM on 2 to 13 and 44 to 46, and analog inputs A0 to A15. I²C moves to pins 20 (SDA) and 21 (SCL), and there are three extra serial ports on pins 14 to 19, used in code as Serial1, Serial2 and Serial3. Text sent on a TX pin arrives at whichever RX pin it is wired to; only Serial (pins 0 and 1, the USB cable) shows in the Serial Monitor. The SPI pins are 50 to 53. Six pins can trigger interrupts: 2, 3, 18, 19, 20 and 21. Memory is much larger: 256 KB of flash, 8 KB of RAM and 4 KB of EEPROM. The left part of the board has the same pin layout as the Uno, so Uno shields fit.

What is an Arduino Mega 2560 made of?

Chip: Silicon die in a 100-pin flat black package (TQFP). Board: Glass-fibre and epoxy with copper tracks under solder mask. Headers and sockets: Brass contacts plated with tin, in black plastic. Crystal: A thin slice of quartz in a metal can.

Is an Arduino Mega 2560 safe? How should it be recycled?

On the Mega, I²C is on pins 20 and 21, not A4 and A5, and SPI is on 50 to 53. Keep the total current from all pins under about 200 mA.

More boards and wiring

Know someone who would use this?

It’s free for every learner. Send it to your class, team or club.

Updated · Free, no sign-up ·

Connected tools

The same idea from another angle, across the site.