The overview, with examples running, is on the board page and The Arduino Mega 2560 model (every register).

The Arduino Mega 2560

The Arduino for a project that ran out of pins: fifty-four digital, sixteen analog, four serial ports, on an ATmega2560 at 16 MHz.

What it is

An ATmega2560 in its 100-pin package, on the same AVR core as the Uno, with 256 KB of flash, 8 KB of SRAM and 4 KB of EEPROM. The registers are at their real addresses, so a sketch built here runs on the board on your desk. The reference page is The Arduino Mega 2560 model.

The shield headers along the long edges are an Uno's, hole for hole. Everything past them is what the bigger package bought.

It stands beside the breadboard

The board is 101.5 by 53.3 mm, four inches by two, so like an Uno it does not go into a breadboard: wire it with jumpers from the headers.

Pins

Seventy of them, and a sketch counts them the way the silkscreen does:

  • 0 to 13 along the near end of the digital header, with the L LED on 13.
  • 14 to 21: the three extra serial ports and I2C.
  • 22 to 53: the 2x18 block standing on the short edge at the far end.
  • A0 to A15 along the bottom, which are ordinary digital pins as well.

Fifteen pins do hardware PWM with analogWrite: 2 to 13 and 44 to 46.

Underneath, the numbering is not tidy. Pins 22 to 29 count up through port A, 30 to 37 count down through port C, and 42 to 49 count down through port L. None of that shows in a sketch, because the runtime carries the table.

Four serial ports

Serial is the channel to the serial monitor, as on every board here. Serial1, Serial2 and Serial3 come out on header pins 18/19, 16/17 and 14/15, and what leaves those pins is a real 8N1 frame on a real wire at the baud rate you asked for. Jumper one port's TX to another's RX and the bytes arrive; get the baud rates wrong and you get mojibake, exactly as on the bench.

The built-in Four serial ports project wires each of the three back to its own RX, so all four are working at once with nothing else on the breadboard.

Sixteen analog inputs

analogRead(A0) to analogRead(A15). The references are AREF, the 5 V supply, an internal 1.1 V and an internal 2.56 V, the last of which an Uno does not have.

Stock Arduino libraries

A tutorial that includes Servo.h, Wire.h, SPI.h, EEPROM.h, LiquidCrystal_I2C.h, Adafruit_GFX.h with Adafruit_SSD1306.h and DHT.h compiles here as it stands. Each is Mokxi's own header under the upstream name, written on the drivers for the parts in the bin, and none of it is the upstream library's code.

  • Wire.begin() puts the I2C bus on 20 (SDA) and 21 (SCL).
  • EEPROM.h uses the chip's own 4 KB of EEPROM, through its real registers. It keeps what you wrote across a press of the board's reset, and a fresh Run starts it erased, every byte 255, because a Run is a new board.
  • Adafruit_NeoPixel.h stops with a message: a WS2812 bit is too short to make by hand on this board, and only the ESP32-C3 and ESP32-C6 drive the strip.

The code editor and compiling lists what each one covers and how it differs from the upstream library.

The firmware

Four built-in programs: Blink, Serial, Four serial ports and a twelve-LED Chaser on pins 22 to 33, one pin per lamp, with no shift register anywhere.

An Uno sketch's source will build for the Mega. An Uno's compiled ELF will not run on it: different chip, different register map, different vector table. Build it for the Mega and it runs.

What is not modeled

The 16U2 USB-to-serial bridge, SPI, TWI/I2C, the watchdog, the analog comparator and the JTAG interface. Shields are not physical parts here; wire the same circuit on the breadboard. The Mega ADK and the older Mega 1280 are different boards.

The addresses are the data sheet's and none is guessed at; the approximations are behaviors, and section 8 of the Arduino Mega 2560 model sorts every one of them. The three that show at the bench: the ADC has no error in it (no sample-and-hold, no nonlinearity, no noise, no offset), so a divider reads the same count every time where a real one wobbles; the 16 MHz crystal is exact, with no drift or jitter; and the 5 V rail is an ideal source that cannot sag, so a circuit that would brown a real board out runs cleanly here.