Publication

Explanations & Tutorials

Getting Started with AVR-IoT: Pushing Data from Device to Cloud

Leverege collaborated with Microchip and Google to make AVR-IoT an out-of-the-box experience for engineers and developers.

Eric Zhang
October 23, 2018

On October 10th, Microchip released their newest development board, the AVR-IoT WG, which is a microcontroller designed for secure IoT applications. If you’ve done any IoT prototyping with MCU devices before, you’re probably familiar with many of the barriers to getting started. If not, the process looks something like this:

While none of the steps are particularly difficult individually, they can be tedious and time-consuming to complete. Our team at Leverege collaborated with Microchip and Google to simplify this process by making AVR-IoT an out-of-the-box experience for engineers and developers. Unlike most boards, AVR-IoT comes with built-in temperature and light sensors, as well as a pre-configured connection to a sandbox on Google Cloud. Now, testing sensors and visualizing data takes minutes instead of hours:

Device Graduation

The AVR-IoT WG board is unique among IoT hardware options as a full-stack starting point for solutions development. If you’re done with the sandbox, you can start customizing your own project on GCP. To keep things simple, we’ve automated as much of this walkthrough as possible, so that you can re-create the sandbox interfaces on your personal account.

To start off, you’ll need to create a project on GCP and add Firebase to the project. Firebase acts both as a real-time database and a web hosting platform for your UI. If you’re new to GCP or are creating a new project, don’t forget to enable billing for the project, otherwise, you won’t be able to view data!

AVR-IoT setting up your GCP and firebase acount

Next, we’ve created a script that will automate some of the set-up that is necessary for running this IoT project, such as enabling Pub/Sub and registering your device to an IoT Core registry. This step will take several minutes.

Type this into your cloud shell on GCP: git clone https://github.com/Leverege/microchip-avr-iot.git && cd microchip-avr-iot && bash setup.sh

Like any other cloud-connected IoT MCU device, there is a necessary authentication/security step. The process with AVR-IoT is significantly easier than it’s Arduino-family equivalents because the pre-configured security chip (ATECC608A) provides users with a PUBKEY file that can be uploaded directly to the IoT Core registry. While third-party libraries, services, and APIs can also be used to accomplish this, it may become an issue when scaling the number of devices.

Now that your cloud environment is fully configured, it’s time to set up the firmware for your device. Atmel START can be used to scaffold custom firmware from scratch or modify existing programs to suit your needs. In this example, we'll be modifying "AVR-IoT WG Sensor Node," which is the base program installed on each AVR-IoT device.

Here, we’ll be making changes to the “Cloud Configuration” and “WLAN Configuration” sections to correspond with the GCP project we set up earlier. We'll also change the WiFi network where the device is located. You can also make additional changes such as pin/clock configuration or middleware/driver inclusions on this platform.

When you’re ready to delve deeper, export the project and open it up in Atmel Studio (Currently Windows only). If you’ve decided to add additional sensors, make sure to add any relevant libraries and modify the sendToCloud function accordingly. The UI graphs will update dynamically to fit any number of sensors, so there is no need to make any changes in the Cloud.

Finally, build your solution and drop the generated .hex file into your CURIOSITY drive. If you were successful, you should see live data streaming into your new Firebase app at [yourprojectid].firebaseapp.com/device/.

If you’re looking to build something bigger, our team can help you scale your projects into full-blown solutions.

Eric Zhang

Director of Data Science

Eric enjoys experimenting with all sorts of development hardware. As a former teaching assistant, workshop coordinator, and Microsoft Student Partner, he is constantly searching for better ways to deliver educational tech content to the masses.

View Profile

Explore More from the Publication