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.
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.
| Pin | Name | Functions | Use |
|---|---|---|---|
| 5V | 5VSupply pin | Supply input: decouple with 100 nF close to the pin | |
| GND | GNDGround pin | Ground | |
| 3V3 | 3V3Output pin | Supply input: decouple with 100 nF close to the pin | |
| VIN | VINSupply pin · pulled down on the board | Supply input: decouple with 100 nF close to the pin | |
| D0 | D0/RX0I/O pin | USART0_RXDPCINT8 | USB serial (Serial) through the board's USB chip: free only when you do not upload or print |
| D1 | D1/TX0I/O pin | USART0_TXD | USB serial (Serial) through the board's USB chip: free only when you do not upload or print |
| D2 | ~D2I/O pin | OC3BINT4 | PWM output: LED dimming, servos, motor drivers |
| D3 | ~D3I/O pin | OC3CINT5 | PWM output: LED dimming, servos, motor drivers |
| D4 | ~D4I/O pin | OC0B | PWM output: LED dimming, servos, motor drivers |
| D5 | ~D5I/O pin | OC3AAIN1 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| D6 | ~D6I/O pin | OC4A | PWM output: LED dimming, servos, motor drivers |
| D7 | ~D7I/O pin | OC4B | PWM output: LED dimming, servos, motor drivers |
| D8 | ~D8I/O pin | OC4C | PWM output: LED dimming, servos, motor drivers |
| D9 | ~D9I/O pin | OC2B | PWM output: LED dimming, servos, motor drivers |
| D10 | ~D10I/O pin | OC2APCINT4 | PWM output: LED dimming, servos, motor drivers |
| D11 | ~D11I/O pin | OC1APCINT5 | PWM output: LED dimming, servos, motor drivers |
| D12 | ~D12I/O pin | OC1BPCINT6 | PWM output: LED dimming, servos, motor drivers |
| D13 | ~D13I/O pin | OC0AOC1CPCINT7 | On-board LED "L"; PWM (Timer0) |
| D14 | D14/TX3I/O pin | USART3_TXDPCINT10 | Serial data out: to the RX pin of the other device (console, GPS, modules) |
| D15 | D15/RX3I/O pin | USART3_RXDPCINT9 | Serial data in: from the TX pin of the other device |
| D16 | D16/TX2I/O pin | USART2_TXD | Serial data out: to the RX pin of the other device (console, GPS, modules) |
| D17 | D17/RX2I/O pin | USART2_RXD | Serial data in: from the TX pin of the other device |
| D18 | D18/TX1I/O pin | USART1_TXDINT3 | Serial data out: to the RX pin of the other device (console, GPS, modules) |
| D19 | D19/RX1I/O pin | USART1_RXDINT2 | Serial data in: from the TX pin of the other device |
| D20 | D20/SDAI/O pin | TWI_SDAINT1 | I²C data: pull-up (about 4.7 kΩ) to the supply |
| D21 | D21/SCLI/O pin | TWI_SCLINT0 | I²C clock: sensors, displays; pull-up (about 4.7 kΩ) to the supply |
| D22 | D22I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D23 | D23I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D24 | D24I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D25 | D25I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D26 | D26I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D27 | D27I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D28 | D28I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D29 | D29I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D30 | D30I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D31 | D31I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D32 | D32I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D33 | D33I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D34 | D34I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D35 | D35I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D36 | D36I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D37 | D37I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D38 | D38I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D39 | D39I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D40 | D40I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D41 | D41I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D42 | D42I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D43 | D43I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D44 | ~D44I/O pin | OC5C | PWM output: LED dimming, servos, motor drivers |
| D45 | ~D45I/O pin | OC5B | PWM output: LED dimming, servos, motor drivers |
| D46 | ~D46I/O pin | OC5A | PWM output: LED dimming, servos, motor drivers |
| D47 | D47I/O pin | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) | |
| D48 | D48I/O pin | ICP5 | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) |
| D49 | D49I/O pin | ICP4 | General-purpose I/O: LEDs (with series resistor), buttons (with pull-up) |
| D50 | D50/MISOI/O pin | SPI_MISOPCINT3 | SPI data in (MISO): from DOUT / SDO of the device |
| D51 | D51/MOSII/O pin | SPI_MOSIPCINT2 | SPI data out (MOSI): to DIN / SDA / SDI of the device |
| D52 | D52/SCKI/O pin | SPI_SCKPCINT1 | SPI clock: displays, flash, SD cards |
| D53 | D53/SSI/O pin | SPI_SSPCINT0 | SPI chip select (SS): keep it an output while the SPI runs as master |
| A0 | A0I/O pin | ADC0 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A1 | A1I/O pin | ADC1 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A2 | A2I/O pin | ADC2 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A3 | A3I/O pin | ADC3 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A4 | A4I/O pin | ADC4 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A5 | A5I/O pin | ADC5 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A6 | A6I/O pin | ADC6 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A7 | A7I/O pin | ADC7 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A8 | A8I/O pin | ADC8PCINT16 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A9 | A9I/O pin | ADC9PCINT17 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A10 | A10I/O pin | ADC10PCINT18 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A11 | A11I/O pin | ADC11PCINT19 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A12 | A12I/O pin | ADC12PCINT20 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A13 | A13I/O pin | ADC13PCINT21 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A14 | A14I/O pin | ADC14PCINT22 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| A15 | A15I/O pin | ADC15PCINT23 | Analog input: potentiometer, sensor voltage (0 V … supply) |
| RESET | RESETInput pin · pulled up on the board | RESET | Reset, active low: pull to GND to restart the sketch |
Parameters 1
supplyextern: connect 5 V to the 5V pin or 7–12 V to VIN yourself; usb: the USB cable powers the board (5 V)
PCB
Arduino_Mega2560_R3_Shieldshield for the Arduino Mega 2560 R3: your board sits on the Mega's headers (positions from Arduino's reference design)