- Lab
- A Cloud Guru
Configure and Connect an Azure IoT Device Simulator
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!
Path Info
Table of Contents
-
Challenge
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.
-
Challenge
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.
-
Challenge
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.
-
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.