Ultimate Arduino MEGA 2560 Hardware Manual Preview
Preview the Ultimate Arduino MEGA 2560 Hardware Manual below where the full introduction chapter can be found, and the first couple of pages are displayed for each other chapter.
The preview that follows may appear slightly different from the printed book because it has been published to automatically resize for different devices connecting via the web. This means that the layout, font size and image size may be different from the printed book, but the content is still the same. It is intended for interested buyers to get a better idea of the contents of the book. Also see the Table of Contents page for a full listing of the book contents by sections and headings.
The following is copyrighted material from the Ultimate Arduino MEGA 2560 Hardware Manual for previewing purposes.
Welcome to the Ultimate Arduino MEGA 2560 Hardware Manual, a reference and user guide for the Arduino MEGA 2560 hardware and firmware. This manual provides up to date hardware information for the Arduino MEGA 2560, the easy to use open-source electronics platform used by hobbyists, makers, experimenters, educators and professionals.
Why Buy this Arduino MEGA 2560 Hardware Manual?
After the success of the Ultimate Arduino Uno Hardware Manual, ISBN: 978-3-89576- 434-9 (print), 978-3-89576-435-6 (e-book), by the same author, it was decided to make a hardware manual for the Arduino MEGA 2560. This is a natural progression, as the Arduino MEGA 2560 is the next most popular Arduino board after the Arduino Uno. Progressing from the Arduino Uno to the Arduino MEGA 2560 provides the user with more input/output pins, more communication ports and more memory which may be required by some Arduino projects.
As with the Ultimate Arduino Uno Hardware Manual, there are four main reasons to buy this book besides just wanting a handy reference manual for the Arduino MEGA 2560 hardware and firmware for use on the workbench. A discussion of these reasons follows.
1) All the Hardware Information in One Place
Although information about the Arduino MEGA 2560 hardware is available online, it is spread out over many pages and websites. Having all of the Arduino MEGA hardware information in one place, in this concise guide, is convenient and a time saver. This is especially true for new Arduino users who may not even know what to look for when getting familiar with the Arduino MEGA 2560 hardware, for example, how to extend the hardware, how to add external data memory, how to connect hardware to Arduino pins in current sinking and current sourcing configuration. It also includes practical information such as which firmware to load to the microcontroller on the MEGA 2560 board, should it be erased, and which other settings must be changed for it to work. In addition, this manual has detailed hardware technical information, a pin reference chapter, basic interfacing information, a power reference chapter, information on all firmware programs loaded on an Arduino MEGA 2560, the circuit diagram and component list, fault finding and testing steps, as well as hardware mechanical dimensions and measurements. It also includes a chapter on Arduino shield compatibility which was not included in the Ultimate Arduino Uno Hardware Manual.
2) Integrity of Information
Information on the internet about Arduino or any other subject may or may not be technically correct. Discerning which information is correct and which is incorrect is a problem, especially for those users who are new to electronics. Even hardware specifications from Arduino themselves are often badly specified or even incorrectly specified. This manual provides hardware information on the Arduino MEGA 2560 that has been carefully checked and verified to be correct.
3) Presentation of Information
Each topic or subject in this book has been broken down into smaller parts and carefully explained and described. For this reason, each chapter contains many sections, each with its own sub-heading and section number for easy reference and cross-reference. Numerous illustrations and figures are included for easier understanding of explanations and for quick and easy reference.
4) Information Not Available Elsewhere
This book contains some information that is not available online, or is hard to find. It also offers unique views and illustrations of the hardware that reveal some interesting aspects of the Arduino MEGA 2560 hardware that is not obvious when looking at the circuit diagram or other sources of information.
Difference to the Arduino Uno Hardware Manual
For those readers who already own a copy of the Ultimate Arduino Uno Hardware Manual, ISBN: 978-3-89576-434-9 (print), 978-3-89576-435-6 (e-book), this section looks at the motivation for making a separate manual for the Arduino MEGA 2560, instead of combining the two in one book.
There are some similarities between the Arduino Uno and Arduino MEGA 2560, but also many differences. It was felt that there are enough differences between the two boards to write a separate manual for each. A second reason for publishing two manuals is that it is much easier when working with an Arduino board, to pick up the correct manual for it, and not have to sift through the information for the Arduino board being used in a manual that covers more than one board or model. One can continue working with the board and specific manual knowing that everything in the manual applies to the board in use. The result of the decision to make a separate book for the Arduino MEGA 2560 is the manual that you now hold in your hands.
This manual follows the same basic layout and format as the Ultimate Arduino Uno Hardware Manual, but has been written for the Arduino MEGA 2560. Although some sections in this book are mostly the same as the Ultimate Arduino Uno Hardware Manual, such as the section in Chapter 1 on ESD, enough changes have been made to make owning this manual worthwhile for those readers who already own the Ultimate Arduino Uno Hardware Manual. Some sections of the book that would be very similar to the Ultimate Arduino Uno Hardware Manual have been extended, and new images and figures added. All this is in addition to including information on the obvious additional capabilities of the Arduino MEGA 2560. Finally, an extra chapter has been added that deals with Arduino shield compatibility between different Arduino models, including the MEGA 2560, Uno, Due and Zero. This chapter was added to give the reader an understanding of why some shields only work with some Arduino models, and also to provide information for those readers wanting to design Arduino shields that are compatible across a number of different Arduino models. To be perfectly clear, if you own an Arduino Uno, you will want to have the Ultimate Arduino Uno Hardware Manual. If you own an Arduino MEGA 2560, you will want this Ultimate Arduino MEGA 2560 Hardware Manual. Because there are some similarities between the two boards, such as the power supply circuit, this manual has been extended to make it more worthwhile for those readers who already own the Ultimate Arduino Uno Hardware Manual.
This manual has been written for anyone interested in the Arduino MEGA 2560 who would like an easy to use hardware reference. Hobbyists, makers, experimenters, teachers, students, and professionals such as electronic engineers will all find this manual to be an invaluable reference.
The Arduino MEGA 2560 is a more advanced board with enhanced features, and is usually purchased after the user has had some experience with an Arduino Uno, but this is not essential. It is assumed that the reader of this manual has at least used an Arduino on a basic level and has some basic knowledge of electronics. Basics of electronics are not explained, but it is assumed that the reader already has the knowledge to understand terms such as voltage and current, and knows what electronic components such as resistors and transistors are. Those readers who do not have this basic knowledge must at least be willing to learn, by using additional resources, be it via the internet or by using other books on the subject.
At a minimum, an Arduino MEGA 2560 will obviously be required, as well as a computer with which to program the Arduino board. This book mainly references the Arduino MEGA 2560 revision 3 (REV3 or R3) board which is the latest Arduino MEGA 2560 at the time of writing. It also mentions earlier versions of the Arduino MEGA 2560 when necessary and makes some reference to clone or compatible boards. For advanced use and for programming firmware to the Arduino MEGA 2560, one of several USB programmers can be used – see the text for more details, but most users will not need to do this.
In the pin reference and interfacing chapter, an electronic breadboard and jumper wires are used to show how to interface LEDs, transistors, a relay, an external TWI memory chip and an SD card adapter. These are just interfacing examples and users will only need the components for a particular project or interfacing example that they are interested in. Hardware testing requires at least a multimeter. Some tests require an oscilloscope, but it is not essential for every user and is only used in a small section of the book.
Without software, an Arduino MEGA 2560 does absolutely nothing. For this reason, although this is a hardware manual, the free Arduino IDE programming environment must be installed. This enables Arduino programs or sketches to be loaded to the Arduino MEGA 2560 to operate and test the hardware.
All software used in this book is either free and open-source, such as the Arduino IDE software, or free software that is not open-source. All software used can easily be downloaded from the internet at no cost. Other software, besides the Arduino IDE, is optional and will only need to be installed if required for certain tasks.
What is Covered and What’s Not Covered
This book is primarily about hardware on an Arduino MEGA 2560 board, including technical information, a pin reference, power supply information, firmware details, circuits and parts list, fault finding and measurement, as well as mechanical information, but includes some software, in the form of user programs or sketches, in order to get the hardware to work. That being said, it does not cover software programming in great detail, but does provide references to the appropriate example sketches in the Arduino IDE and online documentation where necessary. Most of the functionality of an Arduino MEGA 2560 comes from the main microcontroller on the board. This microcontroller is covered by the text in the context of Arduino and how it is set up and used by the Arduino IDE and its libraries. Advanced use of some of the internal hardware in the main microcontroller that is not available in the Arduino IDE and libraries is not covered, except to provide a pin reference for these advanced features that shows which Arduino pins are mapped to advanced hardware. Users who want to use the advanced hardware that is not available in the Arduino IDE or libraries must reference the datasheet for the main microcontroller.
How to Use this Book
It is suggested that this book is first read through once to get a good idea of its contents and a better understanding of the Arduino MEGA 2560 hardware, it can then be used as a reference manual. Although this book has been written as a manual, it is not dry like some manuals or textbooks. Anyone interested in Arduino should find it an enjoyable read.
For electronic engineers or competent hobbyists who have used other microcontroller boards, but not an Arduino MEGA 2560, this book provides an easy introduction to the Arduino MEGA hardware that will get new users started quickly with the board. The first two chapters of the book are basically a hardware user manual, while the remaining chapters are more like a reference manual, although there is some overlap between the two. The exception is the last chapter that discusses Arduino shield compatibility between different Arduino models. This chapter is basically a stand-alone technical chapter. When using the book for reference, use the index to find specific topics and use Appendix A to quickly find technical specifications. Appendix A has a cross reference for each technical specification that references the same specification in the main text, which provides detailed information.
Each section in the book cross references related material in other sections and chapters. The table of contents is also useful for referencing information, as it is a list of every section in the book.
Accompanying resources can be found on the Elektor (www.elektor.com) web page for this book and on the author’s supporting website wspublishing.net which includes links to all of the online resources so that they do not need to be typed in manually. Arduino software sketches used in the book are also available from the supporting website.
Disclaimer, Errors and Corrections
Although this manual is not an official Arduino manual, or endorsed by Arduino in any way, it has been written and thoroughly checked by a competent electronic engineer. The information in this manual has been carefully checked and proof read, but this is not a claim of infallibility, and this manual, like any work, is subject to typos and small errors that may have been missed during the proof reading process. In the event that you do find an error or typo, please use the accompanying website wspublishing.net to report it. This will be a big help to others as any corrections will be published on the supporting website.
A Note from the Author
Thank you for purchasing this Ultimate Arduino MEGA 2560 Hardware Manual! I hope that you thoroughly enjoy reading this book and using it as a reference. Please give an honest review of this book on the web page for this book at www.elektor.com, the Elektor website. This provides feedback to the author that can be used to improve future versions of this manual. When writing a review, bear in mind that this book is an Arduino MEGA 2560 hardware manual and not a software or electronics book. Review the book contents in light of its title and stated purpose. Also bear in mind that some information in this book is repeated because of the layout of the book – with Chapter 1 being an overview of the Arduino MEGA 2560, Chapter 2 containing technical information and Chapter 3 a pin reference, some information is repeated, but more details are added in each chapter. The alternative to this is to lump everything related together, in which case the book can not be laid out in an easier to read format that builds the information up from a top level view of the hardware followed by more details on each aspect of the hardware.
Chapter 1 • Arduino MEGA 2560 Overview
Before taking a closer look at each aspect of the Arduino MEGA 2560 hardware in greater depth, it is necessary to get a top level overview and general understanding of the Arduino MEGA 2560. This chapter, together with Chapter 2, can be thought of as a “hardware user manual” for the Arduino MEGA 2560 and covers all of the basics that are needed before a more comprehensive study of the Arduino MEGA 2560 hardware that is contained in the chapters that follow.
Included in this chapter is a general overview of the Arduino MEGA 2560, its main parts, and how to extend its hardware.
Basics of firmware, the software that comes factory loaded on a new Arduino MEGA 2560 board, is explained. The chapter wraps up with board handling precautions, a brief history of the Arduino MEGA 2560 and the hardware revisions that it has been through, some information on first time use, and basic testing.
In this Chapter
- A top level view of the Arduino MEGA 2560 hardware and functionality
- A brief look at the Arduino MEGA 2560 firmware and what it does
- Board handling and usage precautions
- Arduino MEGA 2560 history and revisions
- First time use and basic testing
- References to quickly find information on the Arduino MEGA 2560
- Major differences between Arduino MEGA 2560 and same sized Arduino boards
1.1 Arduino MEGA Description and Functionality
The Arduino MEGA 2560 is a single board computer that uses a microcontroller as its main processor to run software loaded via the Arduino IDE or other programming environment. It extends the capabilities and number of pins of the smaller Arduino Uno.
1.1.1 Arduino MEGA 2560 Board
Figure 1.1 shows the Arduino MEGA 2560 single board computer. The main micro- controller on the board is a surface mount device that is soldered to the top of the board. The main microcontroller is the 100-pin chip that can be seen above the text “POWER” and “ANALOG IN” in Figure 1.1.
Figure 1.1: Top View of an Arduino MEGA 2560
1.1.2 Arduino MEGA 2560 vs. Arduino Uno
As the Arduino Uno is such a popular board, a comparison between an Arduino Uno and Arduino MEGA 2560 can be helpful. Arduino Uno boards come in two main types, the first has a through-hole mounted microcontroller. The second type is the Arduino Uno SMD board, where the main microcontroller is a surface mount device (SMD), meaning that it is soldered to the top layer of the board only. In comparison, an Arduino Uno with a through- hole mounted microcontroller has a socket soldered to the board that houses the main microcontroller. The socket is through-hole mounted, meaning that while the socket is placed on the top of the board, the legs or pins of the socket pass through holes in the board and are soldered to the board on the bottom layer. This allows the microcontroller to easily be unplugged from the socket on the board and replaced by a new microcontroller if necessary. This can’t be done on the Arduino Uno SMD board. Figure 1.2 shows an Arduino Uno on the left and Arduino Uno SMD on the right.
Chapter 2 • Hardware Technical Information
A description of the Arduino MEGA 2560 hardware technical information is contained in this chapter, split up into various categories. This chapter and Chapter 1 are the hardware user manual chapters of this book.
Whereas Chapter 1 gave a broad overview of the Arduino MEGA 2560 hardware, this chapter gives more specific technical information on the hardware. It “zooms in” to the details of the Arduino MEGA 2560 and gives more information on the main microcontroller, memory types and sizes, power supply technical details and technical specifications on the programming and user headers, and other hardware on the board.
In this Chapter
- Arduino MEGA 2560 microcontroller and memory
- External and USB power specifications and connection
- Board operating frequency
- LED indicator and reset button information
- Header sockets pinout and detailed pin functions
- Programming headers pinout and functions
The main microcontroller on an Arduino MEGA 2560 is an ATmega2560 8-bit AVR from Microchip that has the full part number ATmega2560-16AU. This part number shows that the Arduino MEGA 2560 was named after the ATmega2560 microcontroller that it uses.
At the time of writing, the full part number was incorrectly specified as ATMEGA2560- 15AU in the MEGA2560_Rev3e version of the Arduino MEGA 2560 schematic or circuit diagram. As can be seen in the datasheet for the ATmega2560 microcontroller, there is no part ending with 15AU.
Table 2.1 shows a comparison between the Arduino MEGA 2560 and Arduino Uno with order codes, microcontroller part number and microcontroller chip packages.
|Board||Board Code||Microcontroller||Chip Package|
|Arduino MEGA 2560||A000067||ATmega2560-16AU||TQFP (100 pin)|
|Arduino Uno||A000066||ATmega328P-PU||PDIP (28 pin)|
On the Arduino MEGA 2560, the ATmega2560-16AU is housed in a 100-pin Thin Quad Flat Package (TQFP) which is surface mount soldered to the top of the board. Figure 2.1 shows a close-up of the microcontroller on an Arduino MEGA 2560 board.
Figure 2.1: ATmega2560-16AU Microcontroller
Chapter 3 • Pin Reference and Interfacing
The reference part of this book starts with this chapter which is an Arduino MEGA 2560 pin reference with interfacing examples.
Use this chapter as a quick reference to find pin names, alternate pin functions and the mapping of the ATmega2560 pins to the Arduino headers.
Although this book is a hardware manual for the Arduino MEGA 2560 and not a book that teaches basic electronics, it does include basic interfacing examples to help users with connecting various electronic components to an Arduino. The interfacing examples are used to illustrate various interfacing techniques and principles.
In this Chapter
- Arduino MEGA 2560 pin names, functions and alternate functions
- Arduino MEGA 2560 to main microcontroller (ATmega2560) mapping
- Why an LED must be interfaced using a series resistor
- Current sourcing and sinking configurations
- Pull-up and pull-down resistors on inputs
- TWI and SPI serial buses
- Serial ports / USARTs
- Various interfacing examples
3.1 Pin Default and Alternate Functions
Figure 3.1 on the next page shows the default Arduino MEGA 2560 pin functions as well as the alternate functions such as pins used for TWI and SPI serial buses. This figure is very revealing in that it shows what is really happening with the pins, especially the TWI and SPI pins, where the same pins appear on more than one connector.
3.1.1 Shared TWI Pins
Notice in Figure 3.1 that the TWI pins, SCL (on pin 21) and SDA (on pin 20), are routed to SCL1 and SDA1 found at the other end of the connector near the USB port (on Arduino MEGA 2560 R3 boards, not present on earlier revision boards). In other words there are no additional SCL and SDA TWI pins on Arduino MEGA 2560 R3 boards, these pins are electrically connected or wired to SCL1 and SDA1. SCL1 and SDA1 line up with the SCL and SDA pins found in the same position on Arduino Uno R3 boards.
When making an Arduino Uno sized shield that is to be compatible with both Arduino Uno and Arduino MEGA 2560 boards that uses TWI, always use the pins positioned at SCL1 and SDA1, so that TWI devices on the shield connect to TWI pins on both Arduino boards. On Arduino Uno boards, the TWI pins are also available on two analog pins, A4 and A5, but this is not the case on Arduino MEGA 2560 boards.
3.1.2 Shared SPI Pins
SPI bus pins on Arduino MEGA 2560 boards appear on digital input / output pins 50 to 53, so don’t line up with SPI pins on Arduino Uno boards. If these pins are used for SPI, then they can no longer be used as input / output pins.
Notice in Figure 3.1 that three of these pins appear on the ICSP header, namely pins 50, 51 and 52. When an external programmer is connected to the ICSP header, it will also be electrically connected to whatever circuit is connected to pins 50, 51 and 52.
Avoid using pins 50 to 53 for any other purpose except for SPI when designing a shield so that the shield will be compatible with other shields that use these pins for SPI. Start designing a shield by using pins that are not multiplexed with other pin functions first. If there are not enough pins, then the SPI or TWI pins can be used, but compatibility with other shields may be lost. To make a shield that uses SPI and is compatible with Arduino Uno sized boards, SPI connections must be taken off the ICSP header.
Chapter 4 • Power Reference
In this power reference chapter for the Arduino MEGA 2560, the power supply from both USB and external sources are explained. Specifications for external and USB power are included.
Power supply circuits on the Arduino MEGA 2560 board are simplified by breaking them up into sections in the circuit diagram. Each section is then explained.
In this Chapter
- Power sources and specifications
- On-board power supply and regulator circuit diagram
- Differences between the Arduino MEGA 2560 and Uno power circuits
- Power supply protection
4.1 Power Supply Specification
This section summarizes the power supply specification of an Arduino MEGA 2560 in the categories that follow.
4.1.1 Operating Voltage
The Arduino MEGA 2560 operates at 5V which is derived either from the USB 5V or from an external power supply that is dropped to 5V by the on-board regulator. An on-board regulator with part number LD1117S50 is specified in the Arduino MEGA 2560 Rev3e circuit diagram. In the Arduino Uno Rev3e circuit diagram, the 5V regulator has a part number of NCP1117ST50, which is essentially the same device, but from a different manufacturer. There are a number of different manufacturers that supply a compatible part for this type of regulator, and it was found that two different Arduino MEGA 2560 boards had different regulator part numbers, namely AZ1117CH-5.0 and NCP1117ST50. It is assumed that a compatible part is selected during manufacture, and the exact part could change, depending on availability. Table 4.1 summarizes three of these devices and some of their specifications.
|Part Number||Manufacturer||Output Current||Max. Input Voltage||Tolerance|
As can be seen in Table 4.1 the absolute maximum input voltage and output current of the 5V regulator used on Arduino boards can vary, depending on the device part and manufacturer. Output current that can be drawn from the regulator when on the MEGA is less then the value shown in Table 4.1 because of the heat generated in the regulator. Heat depends on input voltage, current drawn and ambient temperature.
In addition to the 5V regulator on the Arduino MEGA 2560, a 3.3V regulator drops the 5V supply to 3.3V which is available on the Arduino 3.3V pin. This regulator has an output voltage tolerance of 1.5%. The 3.3V regulator can deliver a maximum current of 150mA. Cross refer to section 3.3.7 for information on the Arduino MEGA 2560 power pins.
Chapter 5 • MEGA 2560 Firmware and Bootloader
Firmware is present on both the main Arduino MEGA 2560 microcontroller and the USB to serial bridge microcontroller. This firmware is factory loaded when the Arduino MEGA 2560 is manufactured.
Firmware on the main microcontroller is known as the bootloader and allows soft- ware sketches to be loaded to the Arduino from the Arduino IDE via the USB connection.
The USB to serial bridge microcontroller on the Arduino MEGA 2560 has DFU bootloader firmware and firmware that gives it the USB to serial bridge functionality. The DFU bootloader allows the USB to serial firmware to be updated using the USB connection without the need for an external programmer.
This chapter explains all of the firmware found on the Arduino MEGA 2560.
In this Chapter
- Updating the USB to serial firmware using DFU
- Using Microchip Studio to back up and load new firmware
- How to reload the USB to serial bridge microcontroller firmware using ICSP
- Loading the main microcontroller bootloader to an ATmega2560 chip
- Microcontroller fuse settings
- Purpose of the RESET-EN solder jumper
5.1 Updating the USB to Serial Bridge Firmware using DFU
The most basic task that an Arduino user can do with the ATmega16U2 microcontroller is to update its operational firmware using the DFU (Device Firmware Update) method. This means that the firmware or software that gives this device its USB to serial bridge function can be updated using the USB port on the Arduino MEGA 2560. Most Arduino users should never need to do this, however it is included in this manual to make it complete. Advanced users may also want to use the DFU programming method to put their own custom software into the ATmega16U2. DFU programming requires no external programmer or additional hardware device. Some additional software will need to be downloaded to do the programming.
For Windows computers, download the FLIP (Flexible In-system Programmer) software from Microchip at www.microchip.com/developmenttools/ProductDetails/FLIP For additional information on Arduino DFU programming and for DFU programming using Linux and Mac, see www.arduino.cc/en/Hacking/DFUProgramming8U2 on the Arduino website. A brief description of DFU programming an Arduino MEGA 2560 using the Microchip FLIP software on a Windows computer follows.
Before updating the ATmega16U2 firmware, download and install the FLIP software, as mentioned in the previous paragraph. Connect the Arduino MEGA 2560 to a USB port of the computer, as would be done to upload a sketch. Connect the RESET pin of the ATmega16U2 ICSP header to GND and then disconnect it in order to reset the ATmega16U2. Make sure to connect to the RESET signal on the ICSP header near the USB connector and not the one near the middle of the board. Refer to Figure 3.26 in section 3.5 of Chapter 3 for the pinout of the ICSP header. The RESET pin of the header can be connected to GND on the header or on one of the header sockets at the edge of the board.
Chapter 6 • Circuit Diagram and Components
Although the circuit diagram for the Arduino MEGA 2560 is available online in both PDF and Eagle EDA formats, this chapter enhances the circuit diagram and breaks the circuit diagram up into easier to reference and understand sections.
This chapter also includes the component list of all of the parts found on the Arduino MEGA 2560 board and in the schematic, as well as the location of parts on the board itself.
Parts are usually difficult to locate on the board, especially the smaller parts such as resistor packs and capacitors, because the board is compact and there is no space to silkscreen reference designators for the parts. The diagram in this chapter that shows the location of all components on the board is a great reference that can be used to easily locate any component.
In this Chapter
- Arduino MEGA 2560 block diagram
- Arduino MEGA 2560 circuit diagram enhanced, and split into three easy to reference figures
- Component list for the Arduino MEGA 2560
- Location of parts on the board
- Component quick reference table
6.1 Circuit Diagram
The circuit diagram for REV 3 (Rev3e) Arduino MEGA 2560 boards follows in this chapter and is shown as a block diagram that consists of three main parts, namely, the power supply circuit, the USB microcontroller circuit and the main microcontroller circuit with header sockets. Each of these three parts are then presented as separate circuits in the sections that follow. The block diagrams for the Uno and MEGA 2560 are basically the same, with the differences being the details in each block.
6.1.1 Block Diagram
The block diagram, seen in Figure 6.1, is a top level view of the Arduino MEGA 2560 circuit diagram that shows how the different parts of the circuit interconnect. The power supply circuit is supplied with power from the 2.1mm jack and from the USB 5V. This circuit then supplies 5V to the rest of the Arduino and 3.3V to the 3.3V pin. The USB microcontroller circuit connects to the main microcontroller circuit via the TX0 and RX0 serial port lines and reset line via C7. This allows the Arduino IDE to reset the main microcontroller in order to start its bootloader which then allows a new sketch to be loaded to the main microcontroller using the TX0 and RX0 lines. GND is not shown in the block diagram, but is common throughout. Vin is also omitted from the figure, but connects from the 2.1mm jack through a diode to a pin on the header sockets.
Figure 6.1: Block Diagram of Arduino MEGA 2560 Schematic or Circuit Diagram
Chapter 7 • Fault Finding and Measurement
This chapter is dedicated to fault finding on the Arduino MEGA 2560. Basic fault finding techniques are covered. An explanation of how to remove a faulty microcontroller from an Arduino MEGA 2560 and replace it with a new one is included for advanced users.
In order to test an Arduino MEGA 2560 board, various measurements need to be made. Test points on the board are shown in order to make voltage measurements to compare to when testing a faulty board. Both DC voltage measurements that can be tested with a multimeter and various AC waveform measurements are covered that can be measured using an oscilloscope.
Examples that capture PWM, UART, TWI and SPI signals on an oscilloscope in this chapter can be used as a reference when setting up an oscilloscope to test these signals in a project.
In this Chapter
- Basic fault finding on the Arduino MEGA 2560
- Replacing the Arduino MEGA 2560 main microcontroller and bootloader firmware
- Making voltage measurements using a multimeter
- Making waveform measurements using an oscilloscope
- PWM, UART, TWI and SPI signal oscilloscope examples
7.1 Basic Fault Finding and Repair
Some basic fault finding on the Arduino MEGA 2560 has already been covered in Chapter 1. Refer to section 1.5.3 – Basic Testing, for the first things to look for on a faulty Arduino MEGA 2560 board. Knowing the history of the board can be a big help when fault finding. What happened to cause it to fail? Did it fail while in use, and if so, what was connected to it? If a heavy load was connected to it, a pin on the ATmega2560 microcontroller could be burned out, or even the microcontroller itself. If the board was known to be working and then failed the next time it was used, this could point to possible mechanical damage if it was packed away in an unsuitable place, or perhaps damage from static electricity.
Except for the 16MHz crystal for the ATmega16U2 and connectors on an Arduino MEGA 2560 board, all electronic components are surface mount devices soldered to the top of the board. This makes repair more difficult for the average hobbyist or maker. Some of the bigger devices, such as the 5V regulator, are easier to replace than small devices with fine pitch pin spacing. It is up to each individual to decide whether replacing a part is too difficult or not. Inexperienced users could end up damaging the board more when attempting to do a repair, so discretion is advised.
Replacing the main microcontroller on an Arduino MEGA 2560 should only be attempted by users experienced in surface mount soldering and repair. Unlike the Arduino Uno that has a 28-pin socketed through-hole mounting microcontroller, the Arduino MEGA 2560 has a 100-pin surface mount microcontroller. Replacing this device on an Arduino MEGA 2560 makes for a challenging repair job. Although this job is fairly difficult, the next section provides information on replacing the main microcontroller for those users who are willing to attempt this repair.
In the sections that follow, test points for measuring voltages on an Arduino MEGA 2560 are shown, which can be used when fault finding in order to determine if voltages at the various points are at the correct levels, or if they indicate a fault.
Chapter 8 • Mechanical Dimensions and Templates
Dimensions of the Arduino MEGA 2560 as well as positioning and size of its mounting holes are presented in this chapter.
Dimensions are useful when making an Arduino MEGA 2560 clone board, making a shield to fit an Arduino MEGA 2560, when measuring for placing an Arduino project in an enclosure or when drilling a base plate for mounting.
Rather than including all of the dimensions and sizes on a single drawing, they have been spread over several drawings to prevent clutter and for easier reference.
In this Chapter
- Measurements, tolerance and scale
- Arduino MEGA 2560 length, width and mass
- Arduino MEGA 2560 and shield dimensions and spacing
8.1 Measurements, Tolerance and Scale
The Arduino MEGA 2560 board was designed with the Eagle EDA CAD software package using thousands of an inch as the unit of measurement (a thousandth of an inch is also referred to as a mil). Inches are therefore the “official” measurement system of the board. Dimensions in this chapter are given in inches as well as millimeters. All dimensions are subject to manufacturing tolerances so the actual board size may vary slightly from the measurements given.
Images in this chapter are not to scale. Refer to wspublishing.net for an image of the Arduino MEGA 2560 that can be printed to scale and used as a template for drilling a base plate when mounting an Arduino. Also find Arduino MEGA 2560 drill templates at the very back of this book after the index.
8.2 Length, Width and Mass
Table 8.1 and Figure 8.1 show the length and width of the Arduino MEGA 2560 board as well as the overall length when including the USB connector. As the board was designed using inches, millimeter values have been converted from inches.
|Board Length||4 in||101.6 mm||101.52 mm|
|Board Width||2.1 in||53.34 mm||53.3 mm|
|Length with USB Connector||4.25 in||107.95 mm||–|
The size of the Arduino MEGA 2560 PCB, or printed circuit board, is given as 4 inches long by 2.1 inches wide. This works out to 101.6mm long by 53.34mm wide. As can be seen in the right column of Table 8.1, dimensions given by Arduino on the Arduino MEGA 2560 REV3 page are 101.52mm long by 53.3mm wide. These values were taken from the page at the time of writing. Figure 8.1 shows the millimeter dimensions rounded to one decimal place.
Chapter 9 • Arduino Shield Compatibility
This chapter looks at what makes Arduino shields either compatible or incompatible with different Arduino models.
Four different Arduino models are used as examples to show shield compatibility problems and solutions.
Examples of commercially available shields are used to show why some shields are compatible with different Arduino models, while others only work on certain models.
In this Chapter
- Issues to consider that make shields compatible between different Arduino models
- Four different Arduino models used to show the compatibilities and the incompatibilities between them
- Practical examples of shields that have incompatibilities and others that are compatible across different Arduino boards
9.1 Shield Compatibility Considerations
The aim of this chapter is to explain Arduino shield compatibility issues for the purpose of understanding why some shields only work with some Arduino boards or models, while not with others. This chapter is also for those Arduino users who want to design shields or build prototype shields that are compatible between various Arduino models.
Although it is not mandatory to design shields that are compatible across a range of Arduino models, compatibility makes a shield more useful.
9.2 Shield Compatibility Between Arduino Models
There are five main issues when it comes to compatibility of shields between different Arduino models. This section looks at the issues that must be considered, namely shield size, shield voltage, SPI pin compatibility, TWI pin compatibility and shield stacking.
9.2.1 Shield Size
As we have already seen in this manual, an Arduino Uno sized shield can fit both an Arduino Uno sized Arduino board and an Arduino MEGA 2560 sized board. In this chapter, an Arduino Uno size shield is referred to as a half-size shield, and an Arduino MEGA 2560 size shield is referred to as a full-size shield. “Arduino board” or “Arduino boards” refer to any Arduino model or models.
Although a full-size shield will plug into a half-size Arduino, such as an Arduino Uno, the extra pins at the edges of the full-size shield will obviously not plug into anything on the Arduino and will overhang. It is therefore much more likely that a half-size shield will be made to be compatible between both Arduino sizes, while a full-size shield will be made to be compatible with full-size Arduino boards only.
9.2.2 Shield Voltage
Arduino boards operate at one of two voltages, either 5V or 3.3V. This voltage difference causes shield compatibility problems. The IOREF pin was added to newer Arduino board models to allow a shield to detect at which voltage an Arduino board is operating. The shield can then switch voltage level converters in, or simply power the shield from the Arduino board operating voltage. Current rating of the 5V and 3.3V pins must also be taken into consideration, as they vary greatly between models.
Appendix A • Specifications Quick Reference
The table that follows contains a summary of the Arduino MEGA 2560 technical specifications with references to the appropriate sections in this book where more information can be found on each parameter.