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.
- 7peripheral areas modeled
- 10projects ready to run
- Real timeon your own machine
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.
Open one and press Run
Each of these opens in the editor exactly as it is drawn here.
Every built-in project on the Arduino Mega
Each has its own page with the circuit running, the code and a parts list.
Parts wired to the Arduino Mega, step by step
Each page has the wiring with the Arduino Mega’s own pin names, the code, the common mistakes and the circuit running.
- Arduino Mega DHT22
- Arduino Mega SSD1306 OLED
- Arduino Mega I2C LCD
- Arduino Mega Servo
- Arduino Mega HC-SR04
- Arduino Mega Keypad
- Arduino Mega RC522 RFID
- Arduino Mega 28BYJ-48 Stepper
- Arduino Mega MPU6050
- Arduino Mega Relay
- Arduino Mega TM1637 Display
- Arduino Mega DS18B20
- Arduino Mega Button
- Arduino Mega PIR Sensor
- Arduino Mega BMP280
- Arduino Mega IR Receiver
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.
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.
Tutorials that use this board
Each one ends in a running circuit, on this same board.
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.
The other boards
Every one of these runs today, and every one is free.
Looking for the shorter introduction? See the Arduino Mega 2560 simulator page.
Every Arduino board in one place: the Arduino simulator.
A RISC-V chip at 160 MHz, on the real memory map.
The classic Arduino, with an ATmega328P running at 16 MHz.
The Uno’s chip on a small board that fits a breadboard.
An Uno-shaped board whose chip does its own USB serial.
A second RISC-V board, with 31 pins and simulated WiFi.
The classic ESP32 at 240 MHz, with simulated WiFi.
The ESP32-S3 at 240 MHz, with USB serial and an RGB LED.
The NodeMCU’s ESP8266 at 80 MHz, with simulated WiFi.
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.