deckle studio
Open the editor
Microcontroller with real firmwareArduino Mega 2560 Rev3 (A000067)arduino_mega

Arduino Mega 2560 R3 (ATmega2560)

Arduino Mega 2560: runs real firmware (Arduino sketch, compiled for arduino:avr:mega, or Intel HEX / ELF) on an emulated ATmega2560 at 16 MHz: 54 digital pins, 16 analog inputs (A0–A15), analogWrite on 15 pins (D2–D13, D44–D46), four serial ports (Serial on D0/D1, Serial1 D18/D19, Serial2 D16/D17, Serial3 D14/D15), attachInterrupt on D2, D3, D18–D21, SPI (D50–D53), Wire (D20/D21), EEPROM (4 KB). Supply via USB, the 5V pin or VIN (7–12 V); 3V3 delivers up to 150 mA.

5VGND3V3VIND0/RX0D1/TX0~D2~D3~D4~D5~D6~D7~D8~D9~D10~D11~D12~D13D14/TX3D15/RX3D16/TX2D17/RX2D18/TX1D19/RX1D20/SDAD21/SCLD22D23D24D25D26D27D28D29D30D31D32D33D34D35D36D37D38D39D40D41D42D43~D44~D45~D46D47D48D49D50/MISOD51/MOSID52/SCKD53/SSA0A1A2A3A4A5A6A7A8A9A10A11A12A13A14A15RESETArduino Mega 2560 Rev3 (A000067)
Schematic symbol

Key data

Category
Arduino
Simulation model
Microcontroller with real firmware
Manufacturer part number
Arduino Mega 2560 Rev3 (A000067)
Reference prefix
A
Pins
75
Land pattern
Arduino_Mega2560_R3_Shield

Notes

The firmware runs on an emulated CPU core, instruction by instruction. Peripherals that the model implements (GPIO, timers, UART, SPI, I²C, ADC and others, see the description) act on the pins of the circuit, so the analog parts around the chip see the same voltages and timing as on a real board.

  • Supply the board through the 5V pin or USB; GND to ground.
  • The serial monitor shows Serial1–3 with their names; pick the port to send to.
  • Right-click the part and choose "Open in code editor" to write and compile its code; "Serial monitor" shows its UART output.
  • In the inspector you can load a demo firmware or your own ELF / Intel HEX / BIN file instead.
  • GPIO pins are real circuit pins: an LED on an output needs a series resistor, an input needs a defined level (pull-up or pull-down).
  • The debugger in the code view stops at breakpoints and shows registers, variables and the call stack.

Simulation model

An emulated CPU core runs the firmware binary instruction by instruction. The GPIO pins are pins of the analog circuit: outputs drive through a driver resistance, inputs read the voltage with thresholds.

Device
atmega2560
CPU core
AVR 8-bit
Emulator
AVR emulator
Firmware
Arduino sketch compiled in the code view (arduino-cli, arduino:avr), or your own ELF / Intel HEX / BIN file
Flash / RAM for firmware
256 KB / 8 KB
Supply pins
5V / GND
Mapped GPIO pins
71

Pins 75

simulatedreal chip onlyPin functions from the emulator and the datasheet.

PinNameFunctionsUse
5V5VSupply pinSupply input: decouple with 100 nF close to the pin
GNDGNDGround pinGround
3V33V3Output pinSupply input: decouple with 100 nF close to the pin
VINVINSupply pin · pulled down on the boardSupply input: decouple with 100 nF close to the pin
D0D0/RX0I/O pinUSART0_RXDPCINT8USB serial (Serial) through the board's USB chip: free only when you do not upload or print
D1D1/TX0I/O pinUSART0_TXDUSB serial (Serial) through the board's USB chip: free only when you do not upload or print
D2~D2I/O pinOC3BINT4PWM output: LED dimming, servos, motor drivers
D3~D3I/O pinOC3CINT5PWM output: LED dimming, servos, motor drivers
D4~D4I/O pinOC0BPWM output: LED dimming, servos, motor drivers
D5~D5I/O pinOC3AAIN1Analog input: potentiometer, sensor voltage (0 V … supply)
D6~D6I/O pinOC4APWM output: LED dimming, servos, motor drivers
D7~D7I/O pinOC4BPWM output: LED dimming, servos, motor drivers
D8~D8I/O pinOC4CPWM output: LED dimming, servos, motor drivers
D9~D9I/O pinOC2BPWM output: LED dimming, servos, motor drivers
D10~D10I/O pinOC2APCINT4PWM output: LED dimming, servos, motor drivers
D11~D11I/O pinOC1APCINT5PWM output: LED dimming, servos, motor drivers
D12~D12I/O pinOC1BPCINT6PWM output: LED dimming, servos, motor drivers
D13~D13I/O pinOC0AOC1CPCINT7On-board LED "L"; PWM (Timer0)
D14D14/TX3I/O pinUSART3_TXDPCINT10Serial data out: to the RX pin of the other device (console, GPS, modules)
D15D15/RX3I/O pinUSART3_RXDPCINT9Serial data in: from the TX pin of the other device
D16D16/TX2I/O pinUSART2_TXDSerial data out: to the RX pin of the other device (console, GPS, modules)
D17D17/RX2I/O pinUSART2_RXDSerial data in: from the TX pin of the other device
D18D18/TX1I/O pinUSART1_TXDINT3Serial data out: to the RX pin of the other device (console, GPS, modules)
D19D19/RX1I/O pinUSART1_RXDINT2Serial data in: from the TX pin of the other device
D20D20/SDAI/O pinTWI_SDAINT1I²C data: pull-up (about 4.7 kΩ) to the supply
D21D21/SCLI/O pinTWI_SCLINT0I²C clock: sensors, displays; pull-up (about 4.7 kΩ) to the supply
D22D22I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D23D23I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D24D24I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D25D25I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D26D26I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D27D27I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D28D28I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D29D29I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D30D30I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D31D31I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D32D32I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D33D33I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D34D34I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D35D35I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D36D36I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D37D37I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D38D38I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D39D39I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D40D40I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D41D41I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D42D42I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D43D43I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D44~D44I/O pinOC5CPWM output: LED dimming, servos, motor drivers
D45~D45I/O pinOC5BPWM output: LED dimming, servos, motor drivers
D46~D46I/O pinOC5APWM output: LED dimming, servos, motor drivers
D47D47I/O pinGeneral-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D48D48I/O pinICP5General-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D49D49I/O pinICP4General-purpose I/O: LEDs (with series resistor), buttons (with pull-up)
D50D50/MISOI/O pinSPI_MISOPCINT3SPI data in (MISO): from DOUT / SDO of the device
D51D51/MOSII/O pinSPI_MOSIPCINT2SPI data out (MOSI): to DIN / SDA / SDI of the device
D52D52/SCKI/O pinSPI_SCKPCINT1SPI clock: displays, flash, SD cards
D53D53/SSI/O pinSPI_SSPCINT0SPI chip select (SS): keep it an output while the SPI runs as master
A0A0I/O pinADC0Analog input: potentiometer, sensor voltage (0 V … supply)
A1A1I/O pinADC1Analog input: potentiometer, sensor voltage (0 V … supply)
A2A2I/O pinADC2Analog input: potentiometer, sensor voltage (0 V … supply)
A3A3I/O pinADC3Analog input: potentiometer, sensor voltage (0 V … supply)
A4A4I/O pinADC4Analog input: potentiometer, sensor voltage (0 V … supply)
A5A5I/O pinADC5Analog input: potentiometer, sensor voltage (0 V … supply)
A6A6I/O pinADC6Analog input: potentiometer, sensor voltage (0 V … supply)
A7A7I/O pinADC7Analog input: potentiometer, sensor voltage (0 V … supply)
A8A8I/O pinADC8PCINT16Analog input: potentiometer, sensor voltage (0 V … supply)
A9A9I/O pinADC9PCINT17Analog input: potentiometer, sensor voltage (0 V … supply)
A10A10I/O pinADC10PCINT18Analog input: potentiometer, sensor voltage (0 V … supply)
A11A11I/O pinADC11PCINT19Analog input: potentiometer, sensor voltage (0 V … supply)
A12A12I/O pinADC12PCINT20Analog input: potentiometer, sensor voltage (0 V … supply)
A13A13I/O pinADC13PCINT21Analog input: potentiometer, sensor voltage (0 V … supply)
A14A14I/O pinADC14PCINT22Analog input: potentiometer, sensor voltage (0 V … supply)
A15A15I/O pinADC15PCINT23Analog input: potentiometer, sensor voltage (0 V … supply)
RESETRESETInput pin · pulled up on the boardRESETReset, active low: pull to GND to restart the sketch

Parameters 1

Supplysupply
Defaultextern
externusb

extern: connect 5 V to the 5V pin or 7–12 V to VIN yourself; usb: the USB cable powers the board (5 V)

PCB

Verified land patternArduino_Mega2560_R3_Shield

shield for the Arduino Mega 2560 R3: your board sits on the Mega's headers (positions from Arduino's reference design)