Getting Started with AVR-IoT WG

This guide teaches you how to get started using the Microchip AVR-IoT WG development kit with Atmosphere. This includes creating your first project, programming the project’s firmware into your AVR-IoT, registering the device to Atmosphere, and having its data displayed on a dashboard.

This guide demonstrates a simple project that measures temperature and light data from the board, then sends it to the cloud over Wi-Fi.

Prerequisite: You should already have an Atmosphere account.

Hardware Requirements

  • Microchip AVR-IoT WG development kit

Software Requirements

  • Atmosphere IoT Agent. 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, used to assist in connecting it to Atmosphere. You can download the Atmosphere IoT Agent from its downloads page.

The project in this guide doesn’t use Studio’s Application tab to build an app interface and since the AVR-IoT is registered to Atmosphere over Wi-Fi rather than BLE, the Atmosphere IoT app is not required here.

Step 1 of 7: Create a New Project

Navigate to Atmosphere Studio from the side menu. When you visit Studio for the first time in a session, you are brought to the Studio Projects screen.

  1. Click the New Project button. This displays a New Project window.
  2. Give the project a name. Then select the AVR-IoT WG project type and click Create.

This opens a new project in Studio.

This guide walks through the step-by-step process to perform actions in Studio, but doesn't cover the in-depth aspects of Studio itself. To learn more about using Studio, its areas and features, and Studio elements, visit the Atmosphere Studio section.

Step 2 of 7: Create the Project’s Embedded Firmware

The first aspect of building this sample project is adding elements to the Embedded tab to create the project’s embedded firmware. This involves setting two intervals to read embedded data, and to tell the interval to read the board’s temperature and ambient light sensors.

  1. Add the following elements to the canvas by double-clicking them in the Element Toolbox:
    • Interval Element Two interval elements: The interval element sets the project to run at the time set in the element’s properties, which by default is set to once per second (1000 ms).
    • Microchip MCP9808 Element MCP9808 element: The MCP9808 element reads temperature data. This is a temperature sensor that is onboard the AVR-IoT, and its element is imported in the Element Toolbox for AVR-IoT projects by default.
    • Vishay TEMT6000 Element TEMT6000 element: The TEMT6000 element reads ambient light data. This is an ambient light sensor that is onboard the AVR-IoT, and its element is imported in the Element Toolbox for AVR-IoT projects by default.

      Both the MCP9808 element and TEMT6000 elements will work as intended by default, so none of their properties need to be changed.
  2. Click the first interval element to view its properties. In its properties area, change the Time field to 5000. Then click the second interval element, and change its Time field to 500. This means the first interval will eventually run every five seconds, and the second will run every half second.
  3. Connect the first interval element to the MCP9808 element. This creates an event between them, which can be seen in either the interval element’s properties, or by clicking the connector’s Configuration Button button. The event added is within the Interval trigger, with the MCP9808 ability Read Ambient Temperature. This means that when the interval element is triggered (which is every five seconds), it will read the sensor’s ambient temperature data.
  4. Connect the second interval element to the TEMT6000 element, which also creates an event between them, Read Ambient Light. This event will read the sensor’s ambient light data when the interval element triggers every half second.

That’s all for work in the Embedded tab. To this point, two intervals have been set that will run at five seconds and half a second respectively, and when run will read the ambient temperature and ambient light data from the AVR-IoT’s onboard sensors. The Embedded tab canvas should resemble the following image:

AVR-IoT Embedded Tab

Step 3 of 7: Enable the Project’s Cloud Connectivity

The next aspect of building this sample project is enabling it for cloud connectivity. This is done both on the Embedded and Cloud tabs.

  1. While still in the Embedded tab, add two Cloud Event Element cloud event elements to the canvas. The cloud event element is a coupled element between the Embedded Cloud tabs that enables a project’s data to be sent to Atmosphere.
  2. Connect the MCP9808 element to the first cloud event element. This adds the Send Event event to the Ambient Temperature Read trigger, which sends the ambient temperature data to Atmosphere when the temperature is read every five seconds.
  3. Connect the TEMT6000 element to the second cloud event element. This adds the Send Event event to the Ambient Light Read trigger, which sends the ambient light data to Atmosphere when the light level is read every half a second.
  4. Click the Cloud tab to move to the cloud area of the project. Notice how the Element Toolbox has changed, and that the coupled cloud event elements are displayed on the canvas.
  5. Add two Cloud Storage Element cloud storage elements to the canvas, and connect one to each cloud event element. This allows Atmosphere to store data sent to it from the connected cloud event element.

That’s all for creating the project! With the added cloud connectivity, the project will send the ambient temperature and ambient light data from the Embedded tab to the Cloud tab through two cloud event elements, where they’re connected to two cloud storage elements to store each dataset on Atmosphere.

The final canvas for each tab should resemble the following images:

Embedded Cloud
AVR-IoT Embedded Tab AVR-IoT Cloud Tab

Step 4 of 7: Compile the Project

Once the project is finished, it needs to be compiled. Compiling readies the entire project’s source code for deployment.

  1. From any tab, click the Compile button in the project options menu on the top-right of the screen. You’ll see a loading graphic on the screen indicating compiling has started, and will receive a notification when the project is compiled.

Step 5 of 7: Program Firmware into the Device

With the project compiled, your AVR-IoT can be programmed with the project’s embedded firmware.

Prior to programming, ensure the device is connected to the computer via USB. It should display as a mass storage device. Then you can program your board:

  1. From the Embedded tab, click the Program Firmware button from the tab’s toolbar. This downloads a .bin file containing the project’s compiled firmware.
  2. Locate the downloaded file on your computer, and move it into the AVR-IoT device. This initiates programming of the AVR-IoT, which is represented by a series of blinking LEDs and then it will reboot.

The blue LED will then turn on, followed by the yellow LED. This indicates the device is programmed, and can now be connected to Atmosphere.

Step 6 of 7: Register the Device

With firmware installed, the device can now be recognized and connected to Atmosphere. Prior to connecting a device, ensure your Atmosphere IoT Agent is running in your system tray. This is needed to check your computer’s communication ports for a device is recognizes, which will find the AVR-IoT.

To register the AVR-IoT:

  1. Navigate to the Devices page, and click the Register Device Add Device button in the top-right to display the Add Device window. When the window opens it will automatically begin scanning for available devices within range.
  2. The list of available devices appears. Select the AVR-IoT you just programmed and click Register. This brings you to the Wi-Fi settings screen.
    • If the device doesn’t show up, try restarting the agent in your system tray. If you do so, refresh your browser and try adding a device again.
  3. Configure your Wi-Fi network settings to connect the device. When Wi-Fi settings are entered, the AVR-IoT will connect to Atmosphere over Wi-Fi and remain connected as long as the Wi-Fi connection is maintained.

The device is now registered to Atmosphere and is displayed on your Devices page.

Step 7 of 7: View Device Data

Now that the device’s data is sent to Atmosphere, let’s view it through one of the many device dashboard widgets available. In this guide we’ll use a data glance to display light levels, and a data graph to chart the temperature reading. We’ll do this directly on the device’s dashboard page itself, so click on the newly-added AVR-IoT to enter its page.

  1. To add a widget to the device’s dashboard, click the Configuration button on the side of the page. This displays the menu of available widgets. Select the Data Glance data glance widget to add a data glance to the dashboard.
  2. Once on the dashboard, click the widget’s Menu menu icon to display its menu, then click Settings.
  3. In the data glance’s settings, modify the following properties:
    • Name: Give the widget a name, such as “AVR-IoT Light Levels”
    • Units: Enter Lux for its unit of measurement.
    • Maximum Value: Select an icon that represents the data, such as the Light icon.
    • Color: Give the widget a color that represents the data, such as orange or yellow.
  4. In the Device Parameters field, click Select to enter the progression of selecting the following parameters for the data glance’s device information:
    • Select Cloud Storage: Click the cloud storage that is storing the ambient light data.
    • Select Value Select the ambient light dataset.
  5. When finished click Save. The data glance is then populated with the ambient light reading.
  6. Now add a Data Graph data graph widget to add a graph to the dashboard, then go to its settings.
  7. Give the data graph a name (such as “AVR-IoT Temperature Reading”), then in its Device Parameters field click Select to enter the progression of selecting the following parameters for the data graph’s device information:
    • Cloud Storage: Select the cloud storage that is storing the temperature data.
    • X-axis Value: Select the timestamp to go along the graph’s x-axis.
    • Y-axis Value: Select the temperature dataset to go up the graph’s y-axis.
  8. When finished click Save. This populates the data graph plotting the temperature value as time progresses, which by default is set to the last ten minutes. If you’d like to adjust the graph’s timeline or its bounds, you can edit those properties from the data graph’s menu as well.

Congratulations, you just finished a complete AVR-IoT project with Atmosphere!

If you're interested in a slightly more advanced version of this project, try out the AVR-IoT WG Onboard Sensor Demo available in Studio's Demo Projects section. This demo is similar to the project used in this guide, but also includes setting a status condition for the ambient light value in the Cloud tab, that if the light value exceeds a set limit an alarming state is triggered.