You are on page 1of 8

The Arduino Mega 2560 is a microcontroller board based on the ATmega2560 (datasheet). It has 54 digital input/output pins (o !

hich "4 can be used as #$M outputs)% "6 analog inputs% 4 &A'Ts (hard!are serial ports)% a "6 M() cr*stal oscillator% a &+, connection% a po!er -ac.% an I/+# header% and a reset button. It contains e0er*thing needed to support the microcontroller1 simpl* connect it to a computer !ith a &+, cable or po!er it !ith a A/2to23/ adapter or batter* to get started. The Mega is compatible !ith most shields designed or the Arduino 3uemilano0e or 3iecimila.

4A564 iles7 arduino2mega25602re erence2design.)ip +chematic7 arduino2mega25602schematic.pd

Microcontroller 8perating 9oltage Input 9oltage (recommended) Input 9oltage (limits) 3igital I/8 #ins Analog Input #ins 3/ /urrent per I/8 #in 3/ /urrent or ;.;9 #in <lash Memor* +'AM 44#'8M /loc. +peed

ATmega2560 59 :2"29 62209 54 (o !hich "4 pro0ide #$M output) "6 40 mA 50 mA 256 =, o !hich > =, used b* bootloader > =, 4 =, "6 M()

The Arduino Mega2560 can be po!ered 0ia the &+, connection or !ith an e?ternal po!er suppl*. The po!er source is selected automaticall*. 4?ternal (non2&+,) po!er can come either rom an A/2to23/ adapter (!all2!art) or batter*. The adapter can be connected b* plugging a 2."mm center2positi0e plug into the board@s po!er -ac.. 6eads rom a batter* can be inserted in the 5nd and 9in pin headers o the #8$4' connector. The board can operate on an e?ternal suppl* o 6 to 20 0olts. I supplied !ith less than :9% ho!e0er% the 59 pin ma* suppl* less than i0e 0olts and the board ma* be unstable. I using more than "29% the 0oltage regulator ma* o0erheat and damage the board. The recommended range is : to "2 0olts. The Mega2560 di ers rom all preceding boards in that it does not use the <T3I &+,2to2serial dri0er chip. Instead% it eatures the Atmega>&2 programmed as a &+,2to2serial con0erter. The po!er pins are as ollo!s7

VIN. The input 0oltage to the Arduino board !hen it@s using an e?ternal po!er source (as opposed to 5 0olts rom the &+, connection or other regulated po!er source). Aou can suppl* 0oltage through this pin% or% i suppl*ing 0oltage 0ia the po!er -ac.% access it through this pin. 5V. The regulated po!er suppl* used to po!er the microcontroller and other components on the board. This can come either rom 9IB 0ia an on2board regulator% or be supplied b* &+, or another regulated 59 suppl*. 3V3. A ;.; 0olt suppl* generated b* the on2board regulator. Ma?imum current dra! is 50 mA. GND. 5round pins.

The ATmega2560 has 256 =, o lash memor* or storing code (o !hich > =, is used or the bootloader)% > =, o +'AM and 4 =, o 44#'8M (!hich can be read and !ritten !ith the 44#'8M librar*).

4ach o the 54 digital pins on the Mega can be used as an input or output% using pinMode()% digital$rite()% and digital'ead() unctions. The* operate at 5 0olts. 4ach pin can pro0ide or recei0e a ma?imum o 40 mA and has an internal pull2up resistor (disconnected b* de ault) o 20250 .8hms. In addition% some pins ha0e speciali)ed unctions7

Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16 (TX); Serial 3: 15 (RX) and 1 (TX). &sed to recei0e ('C) and transmit (TC) TT6 serial data. #ins 0 and " are also connected to the corresponding pins o the ATmega>&2 &+,2to2TT6 +erial chip . !"#ernal In#err$%#&: 2 (in#err$%# 0)' 3 (in#err$%# 1)' 18 (in#err$%# 5)' 19 (in#err$%# )' 20 (in#err$%# 3)' and 21 (in#err$%# 2). These pins can be con igured to trigger an interrupt on a lo! 0alue% a rising or alling edge% or a change in 0alue. +ee the attachInterrupt() unction or details. ()*: 0 #+ 13. #ro0ide >2bit #$M output !ith the analog$rite() unction. S(I: 50 (*IS,)' 51 (*,SI)' 52 (S-.)' 53 (SS). These pins support +#I communication% !hich% although pro0ided b* the underl*ing hard!are% is not currentl* included in the Arduino language. The +#I pins are also bro.en out on the I/+# header% !hich is ph*sicall* compatible !ith the 3uemilano0e and 3iecimila. /!D: 13. There is a built2in 643 connected to digital pin ";. $hen the pin is (I5( 0alue% the 643 is on% !hen the pin is 68$% it@s o . I2-: 20 (SD0) and 21 (S-/). +upport I2/ (T$I) communication using the $ire librar* (documentation on the $iring !ebsite). Bote that these pins are not in the same location as the I2/ pins on the 3uemilano0e.

The Mega2560 has "6 analog inputs% each o !hich pro0ide "0 bits o resolution (i.e. "024 di erent 0alues). ,* de ault the* measure rom ground to 5 0olts% though is it possible to change the upper end o their range using the A'4< pin and analog'e erence() unction. There are a couple o other pins on the board7

0R!1. 'e erence 0oltage or the analog inputs. &sed !ith analog'e erence(). Re&e#. ,ring this line 68$ to reset the microcontroller. T*picall* used to add a reset button to shields !hich bloc. the one on the board.

The Arduino Mega2560 has a number o acilities or communicating !ith a computer% another Arduino% or other microcontrollers. The ATmega2560 pro0ides our hard!are &A'Ts or TT6 (59) serial communication. An ATmega>&2 on the board channels one o these o0er &+, and pro0ides a 0irtual com port to so t!are on the computer ($indo!s machines !ill need a .in ile% but 8+C and 6inu? machines !ill recogni)e the board as a /8M port automaticall*. The Arduino so t!are includes a serial monitor !hich allo!s simple te?tual data to be sent to and rom the board. The 'C and TC 643s on the board !ill lash !hen data is being transmitted 0ia the ATmega>&2 chip and &+, connection to the computer (but not or serial communication on pins 0 and "). A +o t!are+erial librar* allo!s or serial communication on an* o the Mega@s digital pins. The ATmega2560 also supports I2/ (T$I) and +#I communication. The Arduino so t!are includes a $ire librar* to simpli * use o the I2/ bus1 see the documentation on the $iring !ebsite or details. To use the +#I communication% please see the ATmega2560 datasheet.

The Arduino Mega2560 can be programmed !ith the Arduino so t!are (do!nload). <or details% see the re erence and tutorials. The Atmega2560 on the Arduino Mega comes preburned !ith a bootloader that allo!s *ou to upload ne! code to it !ithout the use o an e?ternal hard!are programmer. It communicates using the original +T=500 protocol (re erence% / header iles). Aou can also b*pass the bootloader and program the microcontroller through the I/+# (In2/ircuit +erial #rogramming) header1 see these instructions or details.

'ather then reDuiring a ph*sical press o the reset button be ore an upload% the Arduino Mega2560 is designed in a !a* that allo!s it to be reset b* so t!are running on a connected computer. 8ne o the hard!are lo! control lines (3T') o the ATmega>&2 is connected to the reset line o the ATmega2560 0ia a "00 nano arad capacitor. $hen this line is asserted (ta.en lo!)% the reset line drops long enough to reset the chip. The Arduino so t!are uses this capabilit* to allo! *ou to upload code b* simpl* pressing the upload button in the Arduino en0ironment. This means that the bootloader can ha0e a shorter timeout% as the lo!ering o 3T' can be !ell2coordinated !ith the start o the upload. This setup has other implications. $hen the Mega2560 is connected to either a computer running Mac 8+ C or 6inu?% it resets each time a connection is made to it rom so t!are (0ia &+,). <or the ollo!ing hal 2second or so% the bootloader is running on the Mega2560. $hile it is programmed to ignore mal ormed data (i.e. an*thing besides an upload o ne! code)% it !ill intercept the irst e! b*tes o data sent to the board a ter a connection is opened. I a s.etch running on the board recei0es one2time con iguration or other data !hen it irst starts% ma.e sure that the so t!are !ith !hich it communicates !aits a second a ter opening the connection and be ore sending this data. The Mega contains a trace that can be cut to disable the auto2reset. The pads on either side o the trace can be soldered together to re2enable it. It@s labeled E'4+4T24BE. Aou ma* also be able to disable the auto2reset b* connecting a ""0 ohm resistor rom 59 to the reset line1 see this orum thread or details.

The Arduino Mega has a resettable pol* use that protects *our computer@s &+, ports rom shorts and o0ercurrent. Although most computers pro0ide their o!n internal protection% the use pro0ides an e?tra la*er o protection. I more than 500 mA is applied to the &+, port% the use !ill automaticall* brea. the connection until the short or o0erload is remo0ed.

The ma?imum length and !idth o the Mega #/, are 4 and 2." inches respecti0el*% !ith the &+, connector and po!er -ac. e?tending be*ond the ormer dimension. Three scre! holes allo! the board to be attached to a sur ace or case. Bote that the distance bet!een digital pins : and > is "60 mil (0."6E)% not an e0en multiple o the "00 mil spacing o the other pins. The Mega is designed to be compatible !ith most shields designed or the 3iecimila or 3uemilano0e. 3igital pins 0 to "; (and the ad-acent A'4< and 5B3 pins)% analog inputs 0 to 5% the po!er header% and I/+# header are all in eDui0alent locations. <urther the main &A'T (serial port) is located on the same pins (0 and ")% as are e?ternal interrupts 0 and " (pins 2 and ; respecti0el*). +#I is a0ailable through the I/+# header on both the Mega and 3uemilano0e / 3iecimila. (lea&e n+#e #2a# I2- i& n+# l+3a#ed +n #2e &a4e %in& +n #2e *e5a (20 and 21) a& #2e D$e4ilan+6e 7 Die3i4ila (anal+5 in%$#& and 5).

Arduino can sense the en0ironment b* recei0ing input rom a 0ariet* o sensors and can a ect its surroundings b* controlling lights% motors% and other actuators. The microcontroller on the board is programmed using the Arduino programming language (based on $iring) and the Arduino de0elopment en0ironment (based on #rocessing). Arduino pro-ects can be stand2alone or the* can communicate !ith so t!are on running on a computer (e.g. <lash% #rocessing% Ma?M+#). Arduino is a cross2plato orm program. AouFll ha0e to ollo! di erent instructions or *our personal 8+. /hec. on the Arduino site or the latest instructions. http://arduino.cc/en/Guide/HomePage

8nce *ou ha0e do!nloaded/un)ipped the arduino I34% *ou can #lug the Arduino to *our #/ 0ia &+, cable.

Bo! *ouFre actuall* read* to GburnH *our irst program on the arduino board. To select Gblin. ledH% the ph*sical translation o the !ell .no!n programming Ghello !orldH% select

1ile8S9e#32:++98 0rd$in+;00178!"a4%le&8 Di5i#al8<lin9 8nce *ou ha0e *our s.ecth *ouFll see something 0er* close to the screenshot on the right. In T++l&8<+ard select M45A Bo! *ou ha0e to go to T++l&8Serial(+r# and select the right serial port% the one arduino is attached to.

1.

)arran#ie&

"." The producer !arrants that its products !ill con orm to the +peci ications. This !arrant* lasts or one (") *ears rom the date o the sale. The producer shall not be liable or an* de ects that are caused b* neglect% misuse or mistreatment b* the /ustomer% including improper installation or testing% or or an* products that ha0e been altered or modi ied in an* !a* b* a /ustomer. Moreo0er% The producer shall not be liable or an* de ects that result rom /ustomer@s design% speci ications or instructions or such products. Testing and other Dualit* control techniDues are used to the e?tent the producer deems necessar*. ".2 I an* products ail to con orm to the !arrant* set orth abo0e% the producer@s sole liabilit* shall be to replace such products. The producer@s liabilit* shall be limited to products that are determined b* the producer not to con orm to such !arrant*. I the producer elects to replace such products% the producer shall ha0e a reasonable time to replacements. 'eplaced products shall be !arranted or a ne! ull !arrant* period. ".; 4C/4#T A+ +4T <8'T( A,894% #'83&/T+ A'4 #'89I343 EA+ I+E AB3 E$IT( A66 <A&6T+.E T(4 #'83&/4' 3I+/6AIM+ A66 8T(4' $A''ABTI4+% 4C#'4++ 8' IM#6I43% '45A'3IB5 #'83&/T+% IB/6&3IB5 ,&T B8T 6IMIT43 T8% ABA IM#6I43 $A''ABTI4+ 8< M4'/(ABTA,I6ITA 8' <ITB4++ <8' A #A'TI/&6A' #&'#8+4 ".4 /ustomer agrees that prior to using an* s*stems that include the producer products% /ustomer !ill test such s*stems and the unctionalit* o the products as used in such s*stems. The producer ma* pro0ide technical% applications or design ad0ice% Dualit* characteri)ation% reliabilit* data or other ser0ices. /ustomer ac.no!ledges and agrees that pro0iding these ser0ices shall not e?pand or other!ise alter the producer@s !arranties% as set orth abo0e% and no additional obligations or liabilities shall arise rom the producer pro0iding such ser0ices. ".5 The Arduino products are not authori)ed or use in sa et*2critical applications !here a ailure o the product !ould reasonabl* be e?pected to cause se0ere personal in-ur* or death. +a et*2/ritical Applications include% !ithout limitation% li e support de0ices and s*stems% eDuipment or s*stems or the operation o nuclear acilities and !eapons s*stems. Arduino products are neither designed nor intended or use in militar* or aerospace applications or en0ironments and or automoti0e applications or en0ironment. /ustomer ac.no!ledges and agrees that an* such use o Arduino products !hich is solel* at the /ustomer@s ris.% and that /ustomer is solel* responsible or compliance !ith all legal and regulator* reDuirements in connection !ith such use. ".6 /ustomer ac.no!ledges and agrees that it is solel* responsible or compliance !ith all legal% regulator* and sa et*2related reDuirements concerning its products and an* use o Arduino products in /ustomer@s applications% not!ithstanding an* applications2related in ormation or support that ma* be pro0ided b* the producer.

2.

Inde4ni=i3a#i+n

The /ustomer ac.no!ledges and agrees to de end% indemni * and hold harmless the producer rom and against an* and all third2part* losses% damages% liabilities and e?penses it incurs to the e?tent directl* caused b*7 (i) an actual breach b* a /ustomer o the representation and !arranties made under this terms and conditions or (ii) the gross negligence or !ill ul misconduct b* the /ustomer.

3.

-+n&e>$en#ial Da4a5e& )ai6er

In no e0ent the producer shall be liable to the /ustomer or an* third parties or an* special% collateral% indirect% puniti0e% incidental% conseDuential or e?emplar* damages in connection !ith or arising out o the products pro0ided hereunder% regardless o !hether the producer has been ad0ised o the possibilit* o such damages. This section !ill sur0i0e the termination o the !arrant* period.

-2an5e& #+ &%e3i=i3a#i+n&

The producer ma* ma.e changes to speci ications and product descriptions at an* time% !ithout notice. The /ustomer must not rel* on the absence or characteristics o an* eatures or instructions mar.ed Ereser0edE or Eunde ined.E The producer reser0es these or uture de inition and shall ha0e no responsibilit* !hatsoe0er or con licts or incompatibilities arising rom uture changes to them. The product in ormation on the $eb +ite or Materials is sub-ect to change !ithout notice. 3o not inali)e a design !ith this in ormation.

The producer o Arduino has -oined the Impatto IeroJ polic* o 6i e5ate.it. <or each Arduino board produced is created / loo.ed a ter hal sDuared =m o /osta 'icaFs orestFs.

You might also like