Board

Arduino Mega 2560 simulator, with every one of its pins

The Mega is the Arduino for a project that ran out of pins. An ATmega2560 at 16 MHz: fifty-four digital pins, sixteen analog inputs, four serial ports, six timers, 256 KB of flash and 8 KB of SRAM, at the real addresses.

Start building free
  • 7peripheral areas modeled
  • 10projects ready to run
  • Real timeon your own machine
Arduino Mega 2560: blinklive0.000 s 0.00x
Click to open it in the editor
The board is running real firmware right now. Click it to open the circuit in the editor.
The model

What is modeled

Taken from the board's own contract document and put in plain words, with what is missing beside it.

Modeled

Core
Every ATmega2560 mnemonic with datasheet cycle counts, including ELPM, EIJMP, EICALL and the three-byte return address a 256 KB flash needs
Ports
All eleven, A to L, and the pin table that turns a board pin number into the right bit of the right one
Timers
Six: timers 0 and 2 eight-bit, timers 1, 3, 4 and 5 sixteen-bit with three compare channels each
USARTs
Four. USART0 is the serial monitor; the other three drive header pins with real 8N1 frames at the baud rate you set
ADC
Sixteen channels across ports F and K, with the MUX5 bit and the 1.1 V and 2.56 V internal references
Interrupts
Eight external interrupts, pin change on three groups, and the real 57-entry vector table
The board
The real 101.5 by 53.3 mm outline, the Uno-compatible shield headers, and the 2x18 block of extra pins on the short edge

Not modeled

  • The USB-to-serial bridge. Serial reaches the monitor directly, and pins 0 and 1 stay plain GPIO.
  • Shields as physical parts, and the Arduino IDE library ecosystem. The runtime here is ours and Arduino-shaped, not the Arduino core.
  • The Mega ADK and the older Mega 1280. This is the Mega 2560 R3.
Start here

Open one and press Run

Each of these opens in the editor exactly as it is drawn here.

Libraries

Arduino libraries that compile as they are

Paste a tutorial that includes one of these and it builds. For any other library, the build names the Mokxi header that does the same job.

Servo.h
attach, write, writeMicroseconds, read, detach, on any pin
Wire.h
I2C as a master; Wire.begin() puts it on 20 (SDA) and 21 (SCL)
SPI.h
transfer and transactions, on the board’s usual SPI pins
EEPROM.h
read, write, update, get, put and EEPROM[i], kept in the chip’s own 4 KB EEPROM
LiquidCrystal_I2C.h
the 16x2 LCD behind its I2C backpack
Adafruit_GFX.h and Adafruit_SSD1306.h
the 128x64 I2C OLED: text, pixels, lines, rectangles, circles, triangles and bitmaps
Adafruit_NeoPixel.h
WS2812 strips and panels
DHT.h
the DHT11 and DHT22: temperature, humidity and the heat index, as floats you can print

And 15 more, 23 in all: OneWire.h and DallasTemperature.h; Adafruit_BME280.h, Adafruit_BMP280.h and SparkFunBME280.h; RTClib.h; Adafruit_SHT31.h; Adafruit_PCF8591.h; Adafruit_ADXL345_U.h; LedControl.h; Adafruit_LEDBackpack.h; Adafruit_TCS34725.h; Adafruit_SGP30.h; Adafruit_INA219.h; Adafruit_ADS1X15.h; Adafruit_MCP23X17.h; Bounce2.h; HX711.h.

Questions

Is it free?

Yes. Every board and every part is on the free plan, with no account needed.

Will an Uno sketch run on it?

The source will. The ELF will not: it is a different chip with a different register map, so build it for the Mega and it runs.

How many pins can I actually use?

Seventy: digital 0 to 53, then A0 to A15, which are ordinary digital pins as well as analog inputs.

What are the extra serial ports for?

A GPS, a second board, a display, anything that talks over a UART while the monitor keeps working. On an Uno those all fight over the one USART.

Try it on your own firmware

What you build here runs on the board on your desk, unchanged. Nothing to install and no account needed.