Table of Contents

Browse the table of contents from the Ultimate Arduino MEGA 2560 Hardware Manual below. A preview is also available on the Elektor page for the Ultimate Arduino MEGA 2560 Hardware Manual on the Elektor website.


Why Buy this Arduino MEGA Hardware Manual?

Difference to the Arduino Uno Hardware Manual

Target Audience


Hardware Requirements

Software Requirements

What is Covered and What’s Not Covered

How to Use this Book

Accompanying Resources

Disclaimer, Errors and Corrections

A Note from the Author

Chapter 1 • Arduino MEGA 2560 Overview

1.1 Arduino MEGA Description and Functionality

1.1.1 Arduino MEGA 2560 Board

1.1.2 Arduino MEGA 2560 vs. Arduino Uno

1.1.3 Uses of the Arduino MEGA 2560

1.1.4 Arduino MEGA 2560 Main Parts Main Microcontroller USB Connector External Power In Reset Button Header Sockets with Arduino Pins ON LED L LED TX LED (Transmit) RX LED (Receive) ATmega16U2 Microcontroller ICSP Header ICSP Header for ATmega16U2 Mounting Holes

1.1.5 Programming

1.1.6 Extending the Hardware Add-on Boards: Shields
Stacking Shields
Shield Reverse Connection Protection Prototype Shields Strip-board Electronic Breadboard Custom PCB

1.1.7 Open-Source and Licensing

1.1.8 Third Party Compatible Boards

1.1.9 Build Quality, Warranty and Safety

1.1.10 Arduino and Genuino

1.2 Arduino MEGA 2560 Firmware

1.2.1 USB Bridge Firmware

1.2.2 Bootloader

1.3 Precautions During Handling and Usage

1.3.1 Static Electricity

1.3.2 Work Surface

1.3.3 Power

1.3.4 Voltage

1.3.5 Handling

1.3.6 Interfacing Precautions

1.4 Arduino MEGA 2560 History and Revisions

1.5 First Time Use and Basic Testing

1.5.1 New Arduino MEGA 2560 Default Behavior Computer Drivers Arduino MEGA 2560 Hardware Behavior
RX LED and L LED on Some Systems
Factory or User Loaded Sketch Running

1.5.2 Loading a Sketch to an Arduino MEGA 2560 Select Board, Processor and Port Loading a Test Sketch
Open the Test Sketch
Upload the Sketch
Modify the Sketch Serial Port Demonstration
Serial Port Sketch Example
Serial Monitor Window

1.5.3 Basic Testing Visually Inspect the Board Power LED and Voltages Check Expected Default Behavior Is the Board Recognized by the Host Computer? Load a Test Sketch

1.6 Arduino MEGA 2560 References and Help

1.6.1 Installing Software Windows MAC OS X Linux

1.6.2 Getting Started, Examples and Reference Getting Started Guides Arduino Examples and Tutorials Building Breadboard Circuits Arduino Software Reference

1.6.3 Getting Help

1.6.4 Related Open-Source Projects Fritzing Wiring Processing

1.6.5 Arduino MEGA 2560 on the Web

1.7 Arduino MEGA 2560, DUE and MEGA ADK

1.7.1 Arduino DUE vs. Arduino MEGA 2560

1.7.2 Arduino MEGA ADK vs. Arduino MEGA 2560

Chapter 2 • Hardware Technical Information

2.1 Microcontroller

2.2 Atmel, Microchip and AVR

2.3 Memory

2.3.1 Flash Memory Flash Memory Size Flash Wear Data Retention

2.3.2 SRAM Volatile Memory SRAM Size

2.3.3 EEPROM EEPROM Programming EEPROM Size EEPROM Wear

2.3.4 Adding External Memory SD Cards (SPI Interface) Flash and EEPROM Chips (SPI / TWI Interface) SPI Devices TWI and I²C Devices

2.4 Power and USB

2.4.1 USB Power

2.4.2 USB Connection and Cable

2.4.3 External Power

2.4.4 Battery Power

2.4.5 Operating Voltage

2.5 Operating Frequency

2.6 LED Indicators and Reset Button

2.6.1 ON LED

2.6.2 L LED

2.6.3 TX LED

2.6.4 RX LED

2.6.5 Reset Button

2.7 User Pin Headers

2.7.1 Power Pins GND Pins 5V Pin 3.3V Pin Vin Pin

2.7.2 IOREF Pin and Unconnected Pin

2.7.3 RESET Pin

2.7.4 Digital, PWM and Communication Pins Output Pins Pin Current Rating Input Pins PWM Pins
PWM Example Sketch
Calculating PWM Duty Cycle
PWM Frequency
PWM LED Control Example Communication Pins
Serial Port / UART Pins to USB
Serial Port / USART Pins
TWI or I²C Pins
SPI Pins

2.7.5 Analog In Pins Analog In Example Sketch Floating Analog Input Pin Calculating Analog In Voltage Analog In Pins Used as Digital I/O

2.7.6 AREF Pin and Internal ADC Reference Voltages

2.8 Programming Headers

2.8.1 MEGA 2560 with External Programmer on ICSP

2.8.2 Restore Bootloader with IDE and External Programmer

2.8.3 ATmega16u2 ICSP Header

2.8.4 ICSP Programming Resources

2.8.5 Using an Arduino as an In-System Programmer

2.9 Shared Pins

2.9.1 Serial Port Pins

2.9.2 L LED Pin

2.9.3 TWI or I²C Pins

2.9.4 ICSP SPI Pins and Reset

2.9.5 JTAG Pins

Chapter 3 • Pin Reference and Interfacing

3.1 Pin Default and Alternate Functions

3.1.1 Shared TWI Pins

3.1.2 Shared SPI Pins

3.2 ATmega2560 to Arduino MEGA 2560 Pin Mapping

3.2.1 ATmega2560 Ports

3.2.2 ATmega2560 Alternate Pin Functions

3.3 Pin Types and Interfacing

3.3.1 Digital Input / Output Pins Pins as Outputs
Why an LED Needs a Series Resistor
How to Calculate a LED Current Limiting Series Resistor
Current Sourcing and Current Sinking
Current Sourcing
Current Sinking
Current Limitation Per Pin
I/O Port Current Source and Sink Limits
Switching Heavier Loads with Transistors and Relays Pins as Inputs
Pull-down Resistor
Pull-up Resistor
Internal Pull-up Resistors

3.3.2 PWM Pins

3.3.3 Analog Pins

3.3.4 TWI Bus Pins TWI Interfacing Example
TWI Pull-up Resistors Accessing TWI Devices in Software

3.3.5 SPI Bus Pins SPI Bus Interfacing Example Accessing SPI Devices in Software Accessing SD Cards in Software

3.3.6 Serial / UART Pins Hardware Serial Port
Using the USB Port / Serial Port 0
Using Serial Port 1, Serial Port 2 and Serial Port 3
Serial Port Reference Software Serial Port

3.3.7 Power Pins GND Pins 5V Pin
External Power to 5V Regulator 3.3V Pin Vin Pin

3.3.8 Reset Pin

3.3.9 IOREF Pin

3.3.10 AREF Pin

3.4 ICSP Header on Main Microcontroller

3.5 ICSP Header on USB Microcontroller

3.6 JP5 Header on USB Microcontroller

3.7 JTAG Pins

3.8 Finding the Datasheets

3.8.1 ATmega2560 Datasheet

3.8.2 ATmega16U2 Datasheet

3.8.3 Datasheets for Other Components

Chapter 4 • Power Reference

4.1 Power Supply Specification

4.1.1 Operating Voltage

4.1.2 USB Power Input

4.1.3 External Power Jack Input

4.1.4 External Power Jack Pinout

4.1.5 Vin Pin as Power Input

4.2 Power Circuit

4.2.1 External Power In and 5V Regulator

4.2.2 Power On Indicator LED

4.2.3 USB Power In

4.2.4 Automatic Switch

4.2.5 3.3V Regulator

4.2.6 Power Header Socket

4.2.7 Differences Between the MEGA 2560 and Uno Power Circuits External Power In and 5V Regulator Power On Indicator LED USB Power In Automatic Switch 3.3V Regulator

4.3 Power Supply Protection

4.3.1 Reverse Polarity Protection

4.3.2 5V Regulator Protection Features

4.3.3 3.3V Regulator Protection Features

4.3.4 USB Overload Protection

Chapter 5 • MEGA 2560 Firmware and Bootloader

5.1 Updating the USB to Serial Bridge Firmware using DFU

5.2 Microchip Studio

5.3 USB Microcontroller Firmware

5.3.1 Backing up the ATmega16U2 Firmware with Microchip Studio

5.3.2 DFU Bootloader Firmware

5.3.3 USB to Serial Bridge Firmware

5.3.4 Programming the USB Microcontroller using ICSP

5.3.5. ATmega16U2 Fuse Settings

5.4 Main Microcontroller Bootloader

5.4.1 Backing up the ATmega2560 Firmware with Microchip Studio

5.4.2 Bootloader Firmware – stk500v2

5.4.3 Restoring the Bootloader

5.4.4 ATmega2560 Fuse Settings

5.5 The RESET-EN Solder Jumper

5.6 Alternative Firmware Programming Methods

Chapter 6 • Circuit Diagram and Components

6.1 Circuit Diagram

6.1.1 Block Diagram

6.1.2 Main Microcontroller Circuit

6.1.3 USB Microcontroller Circuit

6.1.4 Power Supply Circuit

6.2 Component List

6.3 Component Positions on the Board

6.4 Getting an Electronic Copy of the Circuit Diagram

Chapter 7 • Fault Finding and Measurement

7.1 Basic Fault Finding and Repair

7.2 Replacing the Main Arduino MEGA 2560 Microcontroller

7.2.1 Replacement Part

7.2.2 Removing the Old Microcontroller

7.2.3 Soldering the New Microcontroller

7.2.4 Loading the Bootloader

7.3 Voltage Measurements

7.3.1 Powered from USB 5V Test Points USB Power and 3.3V Circuit Test Points Measuring Voltage on the L and ON LEDs

7.3.2 Powered from External Power Supply

7.4 Waveform Patterns and Measurement

7.4.1 Testing for Presence of Microcontroller Clocks

7.4.2 Testing for PWM Waveforms

7.4.3 Testing the UART Output

7.4.4 TWI Signals

7.4.5 SPI Signals

Chapter 8 • Mechanical Dimensions and Templates

8.1 Measurements, Tolerance and Scale

8.2 Length, Width and Mass

8.3 Mounting Hole Spacing and Size

8.4 Shape Dimensions

8.5 Header Positions

8.6 Shield Reverse Connection Protection

8.7 Using Strip-board as a Shield

8.8 Drill Template and KiCad Template

Chapter 9 • Arduino Shield Compatibility

9.1 Shield Compatibility Considerations

9.2 Shield Compatibility Between Arduino Models

9.2.1 Shield Size

9.2.2 Shield Voltage

9.2.3 SPI Pin Compatibility

9.2.4 TWI Pin Compatibility

9.2.5 Shield Stacking

9.3 Compatibility Between Four Arduino Models

9.3.1 Arduino MEGA 2560

9.3.2 Arduino Due

9.3.3 Arduino Uno

9.3.4 Arduino Zero

9.3.5 5V Pin Current on MEGA and Uno

9.4 Arduino Shield Pin Compatibility

9.4.1 TWI Pins

9.4.2 SPI Pins

9.4.3 Digital Pins

9.4.4 Analog Pins

9.4.5 Power Pins

9.5 Example of Shield Compatibility Problems

9.5.1 Data Logger Shield Example Shield Power ICSP Connector TWI Pins

9.5.2 Ethernet Shield Example Shield Power ICSP Connector and Stacking

Appendix A • Specifications Quick Reference