Developing products with Microsoft Azure Sphere has just become a lot easier with a new Azure Sphere MT3620 Starter Kit hardware and application software examples from Avnet. This highly adaptable starter kit has a range of expansion interfaces and a production-ready MT3620 based module, that enables custom hardware requirements to be rapidly prototyped and applications developed for a certified module that scales for volume production.
The Starter Kit is available for order here.
We've put together three different blogs to showcase the Avnet Azure Sphere Starter Kit and how it can be used for your next IoT project . . .
- Blog #1: Simple non-connected demo (this blog)
- Reads on-board sensors every 1 second
- Reports sensor readings to the Visual Studio debug console
- Blog #2: Hands-on connected demo using a generic IoT Hub and Time Series Insights
- Must complete blog 1 demo before moving on to blog 2
- Configures IoT Hub and Time Series Insights Azure resources
- Manipulate the device twin
- Visualize data using Time Series Insights
- Blog #3: Hands-on, connected demo using IoT Central
- Must complete blog 1 before moving on to part 3
- Walks the user though configuring a IoT Central Application to create a custom visualization and device control application
This blog walks you through the following topics:
- Key features of the Avnet Azure Sphere Starter Kit
- How to set up tools, accounts, and your Azure Sphere device for development
- Detailed instructions for downloading, building, and side-loading a sample application that exercises the on-board sensors
What’s in the box?
- Starter Kit carrier board, fitted with a certified, production-ready Azure Sphere MT3620 module
- USB cable (Type-A to Micro-B)
- Quick Start Card with links to key documentation, application example code and other downloads
Avnet Starter Kit Overview
The Avnet Azure Sphere MT3629 Starter Kit is a platform for rapid prototyping highly secure, end-to-end IoT solutions utilizing Microsoft’s Azure Sphere MCU (MT3620). There are some great features on this board.
- 3-Axis accelerometer, gyro and temperature (LSM6DSO)
- Pressure/Barometric (LPS22HH)
- Ambient light sensor
User Push Buttons
There are two user buttons on the Starter Kit. You can use these for any purpose you like.
Software-defined User RGB LED plus two single color LEDs are available, as well as two pre-assigned LED status indicators
When we designed the Starter Kit we set out to design a flexible platform that allowed designers/developers to add additional hardware features as easily as possible. To meet this requirement we included some standard expansion interfaces.
MikroE Click Board expansion sockets
We included two Click board interfaces. MikroE currently has ~645 different Click boards. These modules use a standard hardware interface and work with UART, SPI, I2C, or GPIO interfaces. There are click boards with input devices, output devices, actuators, and just about any sensor you can think of. MikroE turns out new Click boards at an incredible pace. Look for additional products on a weekly basis.
Grove expansion connector
In addition to the click board interfaces, we also included a single Grove expansion connector. Grove devices support either GPIO or I2C hardware interfaces.
We included two additional interfaces on the board that are unpopulated. Headers can be soldered to these locations.
OLED I2C interface
We included a standard I2C header interface for some of the inexpensive OLED displays on the market. To use this interface you need to solder a 4-pin through-hole header strip to the board. Here’s an example OLED display with the correct pin out: link.
We included access to UART signals under the mikroBUS #2 socket. You can solder a right-angle Pmod 2x6 socket connector to this site and have access to the signals from the edge of the board. Note that the Click sockets also have UART signals, but they lack the CTS and RTS UART signals.
Press Release: http://avnet.me/mt3620-PR
Starter Kit Users Guide: http://avnet.me/mt3620-kit-UG
Product Brief: http://avnet.me/mt3620-kit-PB
Product Page: http://avnet.me/mt3620-kit
Intro Video: http://avnet.me/mt3620-kit-intro-video-ces2019
Marketing Presentation: http://avnet.me/mt3620-kit-slides
The instructions for getting started with Azure Sphere are well documented by Microsoft on the Azure Sphere Documentation page here. My recommendation is to use the Microsoft documentation to get your device updated, claimed to your tenant, and connected to your Wi-Fi access point. Once you have all that completed, come back to this documentation to continue.
Visual Studio 2019 Enterprise, Professional, or Community version 16.04 or later; or Visual Studio 2017 version 15.9 or later are both fine for Azure Sphere development.
Link for Visual Studio 2017
- 2017 Community edition Install Link: here
- You don’t need to install any of the workloads for Azure Sphere development
Link for Visual Studio 2019
- 2019 Community edition Install Link: here
- I had to install the "Desktop development with C++" workload before the Azure Sphere SDK would install.
The diagram below shows the items you should complete on the web site before returning to this document.
First things first . . .
By default Azure Sphere is a locked down system. You can’t load any applications to the device with a physical connection, if you could, bad actors who had physical access to the device could load whatever application they wanted to onto the device. That would be bad! So when Sphere devices are deployed into the wild, they are put into field-prep mode that adds the device into a device group and assigns a product SKU to the device so that the Azure Sphere Security Service (AS3) (in the cloud) knows what OS flavor and user Application to send to the device over-the-air (OTA). Once in field-prep mode the ONLY way to change software on the device is OTA via the AS3. You can read more about OTA software deployments here.
Devices ship in a locked state, so we need to “unlock” it. This is accomplished from the “Start à Azure Sphere à Azure Sphere Developer Command Prompt Preview” command line interface (CLI) application. Go ahead and launch that application.
The first thing we need to do is to log into our Tenant. You should have setup a Tenant when you performed the install steps from the Microsoft documentation. We should have also claimed our device to our Tenant. If you did not complete these steps, please complete these tasks then come back. Since we want to change the accessibility of our device, the AS3 will first authenticate us to the tenant, then when we execute the command to change the device from field-prep to prep-debug, AS3 will confirm that our device belongs (or has been claimed) to our tenant. If not, then we won’t be able to change the status of the device. So if someone was to steal a deployed device, they could not do anything with the device outside its main purpose in life. I guess it could be used as a doorstop.
- Confirm that your device is connected to your PC using the supplied USB cable
- From the CLI enter the command > azsphere login.
- A popup window will open asking for credentials. Use the Tenant credentials that you created in the install steps.
- Next, put the device into prep-debug mode by entering the command > azsphere device prep-debug. You should see output similar to the graphic below
If you get timeout errors, like the one below.
- Confirm that your device is plugged in
- Confirm that the USB drivers are installed correctly
- Navigate to https://social.msdn.microsoft.com/Forums/en-US/home?forum=azuresphere for additional help.
Simple reference design
We’ve created an example project that demonstrates how to use some of the features on your new Azure Sphere Starter kit. The software implements the following features.
- Determine the BSSID address, Wi-Fi AP SSID and Wi-Fi Frequency
- Read X, Y, Z accelerometer data from the onboard LSM6DSO device using the I2C Interface
- Read X, Y, Z angular rate data from the onboard LSM6DSO device using the I2C Interface
- Read the temperature from the onboard LSM6DSO device using the I2C Interface
- Read the barometric pressure from the onboard LPS22HH device using the I2C Interface
- Read the temperature from the onboard LPS22HH device using the I2C Interface
- Read the state of the A and B buttons
- Send BSSID address, Wi-Fi AP SSID, Wi-Fi Frequency data, and application version to an IoT Hub or IoT Central Application
- Send X, Y, Z accelerometer data to an IoT Hub or IoT Central Application
- Send barometric pressure data to an IoT Hub or IoT Central Application
- Send button state data to an IoT Hub or IoT Central Application
- Control user RGB LEDs from the cloud using device twin properties
- Control optional Relay Click relays from the cloud using device twin properties
Pull project from GitHub
The example project is on GitHub. Before we can clone the project, we need to add GitHub support to Visual Studio.
- Open Visual Studio. From the pull down menus select “Tools à Extensions and Updates.” This will open the window shown below. Select Online, then find GitHub Extension for Visual Studio and click the Download button. Follow the on-line instructions to finish the installation.
Now that we have the GitHub extensions installed we can clone the project to our local drive.
- Open Visual Studio and from the pull down menus select “File à Open à Open from Source Control.” This will open a windows in your Visual Studio application titled “Team Explorer – Connect.” Click on the “Clone” link.
- Enter the URL to the GitHub project into the form: https://github.com/Avnet/AvnetAzureSphereStarterKitReferenceDesign.git
- Click on the “Clone” link
Run the Example Project
This project has three different build configurations
- No cloud connectivity. This is the simplest configuration. The application runs and you can monitor sensor data from the Visual Studio debug window.
- IoT Hub connectivity. This configuration requires an Azure IoT Hub and an IoT Hub connection string. Once we have the Hub configured and the application connecting to the IoT Hub, we'll explore device twins and learn how we can use device twins to make application changes from the cloud. Last, we’ll walk through how to provision a Time Series Insights (TSI) application to visualize the sensor data.
- IoT Central connectivity. This configuration leverages Microsoft’s IoT Central SaaS product. IoT Central provides a simple interface that allows users to visualize telemetry and to control connected devices.
For all three build configurations we need to open the project. Open the Solution Explorer and expand the project “AvnetStarterKitReferenceDesign.” This will display all the different resources in the project. Expand the “Header Files” and “Source Files” folders to see the source code for the project.
No cloud connectivity
The build configurations are defined in the build_options.h file. Open that file and confirm that both IOT_CENTRAL_APPLICATION and IOT_HUB_APPLICATION are both commented out. Look around lines 5-8 for the #define pre-processor directives. This will build the no cloud connectivity configuration.
One of the really cool features of the Azure Sphere development environment is that to build, link, load, and run your embedded application all you have to do is click one button. Build, link, sideload, and run the project by clicking on the “Remote GDB Debugger” button at the top of the application.
You’ll see the build and link process, then a popup window stating that Visual Studio is starting the debugger on the target. If all goes well, you should see output similar to the text below. If there is a problem, the build output will tell you what’s wrong and hopefully provide a hint on how to correct the issue.
Remote debugging from host 192.168.35.1
Version String: Avnet-Starter-Kit-reference-V1.0
Avnet Starter Kit Simple Reference Application starting.
LSM6DSO: Calibrating angular rate . . .
LSM6DSO: Please make sure the device is stationary.
LSM6DSO: Calibrating angular rate complete!
Opening Starter Kit Button A as input.
Opening Starter Kit Button B as input.
LSM6DSO: Acceleration [mg] : 62.8300, -36.9660, 1002.7180
LSM6DSO: Angular rate [dps] : 0.00, 0.00, 0.00
LSM6DSO: Temperature [degC]: 24.11
LPS22HH: Pressure [hPa] : 1063.18
LPS22HH: Temperature [degC]: 23.08
That concludes the non-connected demonstration. This demo introduced you to the Azure Sphere Starter Kit and walked you though cloning an application that reads a couple of the on-board sensors. The next tutorial will walk you through connecting your board to Azure, where you can control things on the board from the cloud, and graph telemetry data from the device.
Blog Entry #2 (link)