Who needs physical devices? In this lab, you will configure, modify, and test a software solution that simulates the hardware and firmware of an IoT device. Then, you will be able to practice building Azure IoT solutions — even if you don’t have a wind farm or a global network of climate-controlled warehouses at your disposal!
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Create and Connect Simulated Device to Azure IoT Hub
- Log in to the Azure portal, and navigate to the only IoT Hub already deployed in the lab subscription.
- Create a new device, and copy the primary connection string.
- Using the link in the Resources section of the lab, open the device simulator in a new browser tab or window.
- In the code pane, find and modify the connection string using the primary connection string you copied from the new device registration.
- Run the code and observe changes in the telemetry messages. Don’t forget to take note of the light flashing on the device simulator in the assembly pane when each message is delivered — that’s half the fun!
- Stop to end the code run.
- Make Minor Changes to Simulator Code
- In the code pane of the device simulator, find the code that makes up the body of the message.
- Modify the temperature telemetry to return the temperature in Fahrenheit instead of Celsius.
- Run the code and observe changes in the telemetry messages.
- Stop to end the code run.
- In the same section of the code, add a barometer reading using a reading called pressure_hPa.
- Run the code, and observe changes in the telemetry messages.
- Stop to end the code run.
- Confirm Delivery of Messages in Azure IoT Hub
Back in the Azure Portal subscription, return to the IoT Hub, and view the Device to cloud messages graph. Expand the graph to ensure you can see the full day. You should see at least a few messages generated from activities in the first 2 objectives.
To view the actual messages, which have been routed to a storage container, navigate to the only storage account deployed into the lab subscription. Drill down in the blob container to find the delivered messages.
Note: If you work especially fast, you may need to wait a few minutes for the messages to appear in the graph and in the blob container.
Optionally, download a blob to open and view the telemetry.