Arduino Mega

The Arduino Mega is a development board from Arduino based on the ATmega2560 microcontroller and featuring 54 digital I/O pins, 16 analog inputs, and ample space for creating complex projects. This enables the board to be used in collaboration with a wide variety of shields and other add-on boards to expand its functionality.

The Arduino Mega doesn’t include connectivity on its own, so with use in Atmosphere you can either print its data into a debug console, or give it Wi-Fi connectivity by connecting it to an Arduino-compatible Wi-Fi shield. Atmosphere supports the Adafruit WINC1500 Wi-Fi Shield, which features the Microchip WINC1500 Wi-Fi module that includes with a corresponding element by the same name in Atmosphere Studio’s Element Library.

Project Specifics

There are no imported sensors or specialized elements or tools native to Arduino Mega projects.

Hardware Specifics

Some devices may have limitations or design restrictions that cause unexpected behavior when used with Atmosphere. Specific information and details pertaining to the Arduino Mega and its performance on Atmosphere is noted below.

  • This platform does not have PWM support

Default Pin Mapping

Atmosphere configures each peripheral to a default pin for every supported device, based on ideal pairing of pins and their usage. The default pin configuration is set for convenience and enables each peripheral to work naturally without needing to be modified.

All pins can be used as general purpose input/output (GPIO) unless otherwise specified.

Arduino Mega projects start with the following pin configuration:

Pin Table

Pin Description Notes
D0 Arduino Connector D0  
D1 Arduino Connector D1  
D2 Arduino Connector D2  
D3 Arduino Connector D3  
D4 Arduino Connector D4  
D5 Arduino Connector D5  
D6 Arduino Connector D6  
D7 Arduino Connector D7  
D8 Arduino Connector D8  
D9 Arduino Connector D9  
D10 Arduino Connector D10  
D11 Arduino Connector D11  
D12 Arduino Connector D12  
D13 Arduino Connector D13  
A0 Arduino Connector Analog 0  
A1 Arduino Connector Analog 1  
A2 Arduino Connector Analog 2  
A3 Arduino Connector Analog 3  
A4 Arduino Connector Analog 4  
A5 Arduino Connector Analog 5  

Internal Arduino Mega Pins

The Arduino Mega is compiled using the Arduino SDK, so any functions and pin mappings can also be used within Atmosphere Studio.

The default pin for any peripheral can be changed within an element's properties, from an element that references that particular peripheral.

Peripherals

Below is information regarding the Arduino Mega’s exposed peripherals.

I2C

I2C1

This I2C bus is exposed via the SDA and SCL pins on the Arduino header.

SPI

SPI1

This SPI bus is exposed via the MOSI, MISO, and CLK pins on the Arduino SPI connector.

UART

UART1 (USB Debug Console)

This UART is exposed via the USB connector.

UART2

This UART is exposed via pins 19(RX) and 18(TX).

UART3

This UART is exposed via pins 17(RX) and 16(TX).

UART4

This UART is exposed via pins 15(RX) and 14(TX).

PWM

The Arduino Mega does not have PWM support.

Programming Method

Programming the Arduino Mega involves using the programmer interface in Atmosphere Studio to install embedded firmware.

Setup Configuration

Prior to programming an Arduino Mega, ensure you have the following setup configuration:

  • The Arduino Mega is connected to the computer via USB to an available communication port.
  • The computer has the necessary connectivity protocols enabled (Bluetooth Low Energy, Wi-Fi, etc.).
  • The Atmosphere IoT Agent is installed on the computer and running. The Atmosphere IoT Agent is a local application that runs in the system tray and acts as an intermediary between the computer’s connectivity protocol drivers and the browser running Atmosphere.
  • An Internet connection is maintained.
  • The project to be programmed has been compiled.

Programming Instructions

With setup complete, you can program the Arduino Mega:

  1. From Atmosphere Studio’s Embedded tab, click the Program Firmware button from the tab’s toolbar. This displays the Program Firmware window.
  2. Under Device Port, select the communication port the device is connected to.
  3. Click Program to start programming. When complete, you’ll receive a notification stating the device is programmed with the project’s embedded firmware.

When complete, the Arduino Mega is programmed with the project’s embedded firmware.

Guides and Tutorials

Get started using the Arduino Mega with Atmosphere by walking through the following guides:

Arduino Mega Guides
Getting started guide coming soon!

Demo Projects

Atmosphere includes a variety of Arduino Mega demo projects for users of all levels. Check them out by clicking the demo’s name to open the project in Atmosphere.

Name Description
Adafruit WINC1500 Wi-Fi Shield Demo A complete demo that showcases the Adafruit WINC1500 with the Arduino Mega as host. An integer is sent to the cloud every five seconds. The app then sends the current time to the device.
KMA36 Rotation Demo Measure the current angle from the KMA36 rotation sensor and Arduino Mega. Read the angle value and it’s printed to the debug console.
TE Weather Shield Demo Measure various weather values with sensors from the TE Connectivity MEAS weather shield and the Arduino Mega. Read temperature, pressure, and humidity data, and print the values to the debug console.

Videos

The Atmosphere video library contains the following videos on the Arduino Mega:

Getting started video coming soon!

Resources

The following additional resources and downloadable files are available for the Arduino Mega: