Case Studies

NI-cRIO Connection to Azure IoT Hub

Posted in LabVIEW, Oil and Gas Engineering, Test & Measurement Automation


DMC developed a Python-based software solution to connect field devices to Azure IoT Hub.


DMC developed a custom Python web app using FastAPI. FastAPI is a modern web framework for building APIs in Python. The APIs of the web app wrapped Microsoft’s Azure IoT Hub SDK for Python. In the end, the web app exposed the following APIs:

  • Send a message to the IoT hub (device to cloud messaging)
  • Receive messages from the IoT hub (cloud to device messaging)

The customer was seeking to improve their operations by connecting their field assets to the cloud. In the field, NI CompactRIO (cRIO) controllers were running a custom LabVIEW real-time app to control hardware and log data on the field equipment. The data was all there, but the data was distributed and only accessible from HMIs out in the field. They needed a simple solution to make their data actionable and viewable centrally.

The web app’s APIs were available to the LabVIEW app via LabVIEW’s HTTP Client toolkit. When the LabVIEW app collected data, it simply made an HTTP request to the web app to send the message to the IoT hub. This limited changes and impact on the LabVIEW real-time app.

Our customer’s equipment is often in remote locations, so internet connectivity is not consistent. DMC built in a local caching implementation using SQLite. This allowed offline field devices to preserve messages without internet connection. With caching, the web app could also build larger messages, limiting the number of messages sent to the IoT hub. Azure IoT hub charges per message, so this is a cost-saving feature.

Azure IoT Hub Diagram

The connection to Azure provided our customer with valuable insights into their field equipment. They can better schedule with live data, analyze failures, and perform preventative maintenance. The Azure IoT Hub provides a secure and scalable platform for aggregating and storing data and the web app. The Azure IoT Hub also enables many data analysis and visualization tools such as CosmosDB and PowerBI dashboards.

Learn more about DMC's LabVIEW Programming and contact us today for your next project.

Customer Benefits

  • Secure
  • Scalable
  • Allowed for actionable and centrally viewable data
  • Increased ability to build larger messages
  • Limited the number of messages sent
  • Cost efficient
  • Better scheduling abilities
  • Implemented preventative maintenance