Arduino Mega 2560 Microcontroller

The Arduino family of microcontrollers is an easy-to-use easy-to-program set of small micro-controller boards. The usage has a wide range of applications going from hobbyist to real-world applications. The Arduino boards have a series of pins that can be used to output electronic signals as well as input either electronic or analog in nature signals. The boards can be used to turn on small LEDs and motors to regular light bulbs or even industrial motors with the help of high yield transistors or with the help of solid-state relays. On the other hand, the Arduino family of boards allows reading sensors like temperature, pressure, light, proximity, switches, analog voltages, and many more.

Arduino boards are an open-source platform with a large community of followers always providing ingenious and well-developed projects, at the same time, there are many sensors and devices coupled with software interfaces already out in the market hence allowing the creation of easy to accomplish projects.

I like to add that my purpose, aside from teaching this incredible field of electronics, is to build a robot from scratch, so I would like to invite you to come along in this adventure that I am sure will have many iterations. I am sure we will be learning something new with each of those iterations.

Please visit the Arduino Board Mega official website.

Figure 1: Arduino Mega 2560 Microcontroller pinout.

Input and Output

The Arduino 2560 Mega has 54 digital pins which can be use as input/output by using functions pinMode(), digitalWrite(), and digitalRead(). They operate at 5 volts @ 40ma and have an internal pull-up resistor (disconnected by default) of 20-50 kOhms.

Some pins have specialized functions:
Function Pins
Serial 0: 0 (RX) and 1 (TX)
Serial 1: 19 (RX) and 18 (TX)
Serial 2: 17 (RX) and 16 (TX)
Serial 3: 15 (RX) and 14 (TX)

Used to receive (RX) and transmit (TX) TTL serial data. Pins 0 and 1 are also connected to the corresponding pins of the ATmega16U2 USB-to-TTL Serial chip.

External Interrupts:
Function Pins
interrupt 0 2
interrupt 1 3
interrupt 5 18
interrupt 4 19
interrupt 3 20
interrupt 2 21

These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See function attachInterrupt() for more details.

Pulse Width Modulation or PWM: pins 2 to 13 and pins 44 to 46.

These pins provide 8-bit PWM output using function analogWrite().

Serial Peripheral Interface or SPI:
Pins Function
50 MISO (Master In Slave Out) - The Slave line for sending data to the master.
51 MOSI (Master Out Slave In) - The Master line for sending data to the peripherals.
52 SCK (Serial Clock) - The clock pulses which synchronize data transmission generated by the master.
53 SS (Slave Select) - the pin on each device that the master can use to enable and disable specific devices.

These pins support SPI communication using the SPI library. When a device's Slave Select pin is low, it communicates with the master. When it's high, it ignores the master. This allows you to have multiple SPI devices sharing the same MISO, MOSI, and CLK lines. The SPI pins are also broken out on the ICSP header, which is physically compatible with the Uno, Duemilanove and Diecimila.

LED: pin 13

Built-in LED connected to digital pin 13. When the pin has HIGH value (1), the LED is on, when the pin gets LOW (0), the LED is off.

Two-Wire Interface or TWI:

20 - SDA - Data Line

21 - SCL - Clock Line

Support TWI communication using the Wire library. Note that these pins are not in the same location as the TWI pins on the Duemilanove or Diecimila. The Mega2560 has 16 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though it is possible to change the upper end of their range using the AREF pin and analogReference() function.

AREF: Reference Voltage for the analog inputs. Used with analogReference().

Reset: When LOW the microcontroller gets a cold reset.

Visit the projects section to the right of this page and dont forget to leave your comments at the bottom of each project.

Projects

120x120

C# program - Mega 2560.

120x120

C# program - Mega 2560. Using debugging LEDs.

120x120

Evaluating the Proximity Sensor HC-SR04.

120x120

Scrolling characters using the MAX7219.

120x120

Basic Handling of an Stepper Motor.

120x120

The Camera Slider.