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!
In this walkthrough you learn all about
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.
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
- To register your devices in the Azure IoT Hub Service and to monitor the communication between them you need to install the Azure Device Explorer. Follow this link to download the SetupDeviceExplorer.msi file: https://github.com/Azure/azure-iot-sdks/releases.
Setting up your Devices
For this project, you have the following items
- Raspberry Pi 2 Model B with power supply and adaptor
- GHI FEZ HAT
- Your PC running Windows 10 or later
- An Ethernet port on the PC, or an auto-crossover USB->Ethernet adapter like the Belkin F4U047.
- Standard Ethernet cable
- A 16GB Samsung SD Card with Windows 10 IoT Core already mounted.
- Download all the source code from https://github.com/MSFTImagine/IoTWorkshop copy all the source onto a USB
- Download the IOT Core Watcher
To setup your devices perform the following steps:
Plug the GHI FEZ HAT into the Raspberry Pi 2.
Setting up your Azure Account
Creating an IoT Hub
- Enter the Azure portal, by browsing to http://portal.azure.com
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.
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
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.
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.
This conversation has been locked by the site admins. No new comments can be made.