FEZ HAT, UWP and Azure IoT

Last July I highlighted the Raspberry Pi FEZ HAT, Tipping your Raspberry Pi FEZ HAT, but I've not blogged much about it since.

I am sure glad the Coding4Fun Friend Lee Stott took the time to write up this great post on using the FEZ HAT, while also adding some great UWP AND Azure IoT Hub fun too!

Windows 10 IOT Core Beginners Walkthrough using Raspberry Pi 2 and the Fez Hat

image

In this walkthrough you learn all about

1. Raspberry Pi 2 device with Windows 10 Iot Core
2. FEZ HAT sensor hat.
3. Azure IoT Hub

The walkthrough will guide you through using a Windows 10 Universal Application, the sensors get the raw data and format it into a JSON string. That string is then shuttled off to the Azure IoT Hub, where it gathers the data and you can communicate commands directly back to the device. This walkthrough will take approx. 90 mins to complete.

Setup

The following sections are intended to setup your environment to be able to create and run your solutions with Windows 10 IoT Core.

Setting up your Software

Your machine setup includes the following items already downloaded:

...

Download Azure Device Explorer
Setting up your Devices

For this project, you have the following items

To setup your devices perform the following steps:

  1. Plug the GHI FEZ HAT into the Raspberry Pi 2.

image

...

image

...

Setting up your Azure Account
Creating an IoT Hub
  1. Enter the Azure portal, by browsing to http://portal.azure.com
  2. Create a new IoT Hub. To do this, click New in the jumpbar, then click Internet of Things, then click Azure IoT Hub.

...

Registering your device

You must register your device in order to be able to send and receive information from the Azure IoT Hub. This is done by registering a Device Identity in the IoT Hub.

  1. Open the Device Explorer app (C:\Program Files (x86)\Microsoft\DeviceExplorer\DeviceExplorer.exe) and fill the IoT Hub Connection String field with the connection string of the IoT Hub you created in previous steps and click on Update.

...

Creating a Universal App

Now that the device is configured, you will see how to create an application to read the value of the FEZ HAT sensors, and then send those values to an Azure IoT Hub.

Read FEZ HAT sensors

In order to get the information out of the hat sensors, you will take advantage of the Developers' Guide that GHI Electronics published.

...

Send telemetry data to the Azure IoT Hub

Now that you know how to read the FEZ HAT sensors data, you will send that information to an Azure IoT Hub. To do that, you will use an existing project located in the Code\WindowsIoTCorePi2FezHat-IoTHubs\Code\WindowsIoTCorePi2FezHat\Begin folder.

...

Keep building up your project
Adding extra sensors

Now that your application is sending information from your device to the cloud for one sensor - lets add some more!

...

Send commands to your device

Azure IoT Hub is a service that enables reliable and secure bi-directional communications between millions of IoT devices and an application back end. In this section you will see how to send cloud-to-device messages to your device to command it to change the color of one of the FEZ HAT leds, using the Device Explorer app as the back end.

...

Summary

In this lab, you have learned how to create a Universal app that reads from the sensors of a FEZ hat connected to a Raspberry Pi 2 running Windows 10 IoT Core, and upload those readings to an Azure IoT Hub. You also added more sensors to your application and implemented how to use the IoT Hubs Cloud-To-Device messages feature to send simple commands to your devices.

[You are going to want to click through to read the whole thing...]



Tags:

Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
    Unsubscribing
    Subscribing

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.