One of the long time frustrations with Raspberry Pi development is that you needed a physical device and hardware (sensors, buttons, etc) to fully develop and test your Internet of Things (IoT) solutions. Many haven’t really seen this as an issue since deploying code to the device isn’t really that difficult. However, this presents yet another hurtle when first learning how to develop IoT solutions. This can especially be a hurtle when you need to purchase hardware in order to start learning how to develop IoT solution using Microsoft Azure IoT Suite. For this reason Microsoft has created the Raspberry Pi Azure IoT Online Simulator. This simulator does just what it sounds; it simulates the Raspberry Pi hardware so you can easily get coding IoT solutions with ease.

Raspberry Pi Device Simulator for Azure IoT 1

The Raspberry Pi Azure IoT Online Simulator is currently in a Preview state at the time of writing this article. As a result it has a limited feature set, but you can expect the features to get expanded out as Microsoft (and possibly other community members) contribute further to the project. The project is Open Source and hosted on Github, so you can view the full source code as well as submit Pull Requests yourself as well!

Raspberry Pi Device Simulator for Azure IoT 2The Raspberry Pi Azure IoT Online Simulator is broken out into the following user interface areas:

  1. Hardware Assembly – You can see your device status, and it’s hardware configuration
  2. Coding Editor – You have access to an Online Code Editor to write your app to run on the device with Node.js.
  3. Integrated Console Window – You can see the console output of your app here.

The simulator is still a bit limited currently as it only supports a “hardcoded” hardware configuration of a Raspberry Pi 3, Adafruit BME280 (Temperature, Barometric pressure, and Humidity) sensor, and a Red LED. This limitation is due to the project currently being in a Preview state. As it progresses towards GA (General Availability) you should be able to expect it to be grown out into a much more feature rich simulator environment.

The default code sample in the Raspberry Pi Azure IoT Online Simulator is written in Node.js and it is setup to perform the following actions:

  1. Connect to Azure IoT Hub
  2. Read sensor data from the BME280 sensor
  3. Send sensor data as message to Azure IoT Hub every 2 seconds
  4. Blink the LED each time a message is successfully sent to IoT Hub
  5. Write out the body of a message to the console each time one is received.

You can view the full source code for the default code sample by either going to the Raspberry Pi Azure IoT Online Simulator, or by viewing it directly on the Github project.

I look forward to seeing how this project progresses overtime, and what it becomes. This project has some great potential. And, even though it only supports Node.js for programming it still looks to have some great potential!

Microsoft MVP

Chris Pietschmann is a Microsoft MVP, HashiCorp Ambassador, and Microsoft Certified Trainer (MCT) with 20+ years of experience designing and building Cloud & Enterprise systems. He has worked with companies of all sizes from startups to large enterprises. He has a passion for technology and sharing what he learns with others to help enable them to learn faster and be more productive.
HashiCorp Ambassador Microsoft Certified Trainer (MCT) Microsoft Certified: Azure Solutions Architect