Microsoft Azure has experienced tremendous growth, both in terms of use by businesses, and in capability. This article will show how we were able to use some of the capabilities of Azure to get RFID data from Azure IoT Hub to reports in Power BI (business intelligence). Our TallyPoint RF-1 UHF RFID reader can be used as an edge device to send data directly to Microsoft Azure IoT Hub enabling powerful solutions in Azure.
Azure Demo
To best understand the data flow through Azure, it’s helpful to look at an architecture picture. In the picture below, you will see the data path that we take: IoT Hub to Event Hub to Stream Analytics to Power BI.
While the diagram shows the IoT Hub connecting directly to Stream Analytics, we were unable to create a direct connection to Stream Analytics but needed to first send the data to an Event Hub. This article explains that “IoT Hub uses Event Hubs for its telemetry flow path” which likely explains the technical reason for the restriction we encountered.
Create an IoT Hub
Azure IoT Hub is the central point of your management of tens, hundreds or thousands of devices. Following the creation of an Azure subscription, our next step was to create a hub in the Azure portal. Other tutorials show how this can be done. (It is straightforward.)
Creating an IoT device
Next, we created an IoT device inside of the IoT Hub. From the IoT Hub where you wish to add a device:
Select ‘IoT Devices’ from the Explorers section on the left.
Select ‘New’ to create a new device a) Name it per convention. One good option is to use ‘tallypoint-<mac3>’ (e.g. tallypoint-f7c2f5) b) Select the option to auto-generate the keys in the creation process.
Select the device you just created and use the Primary Connection String in the tallyflow.json file on the TallyPoint reader. Here is an example Primary Connection String:
Preparing the TallyPoint RFID reader
The TallyPoint RF-1 RFID reader runs Ubuntu Core 18. Ubuntu Core is a lightweight Linux operating system that provides 10 years of security updates. For this demo, management of the TallyPoint device was done using a JSON configuration file. If desired for your application, we can implement the Azure Device Twins capability for device management.
Using the Primary Connection String from Azure, we configure the reader to send JSON data over an AMQP message queue to the IoT Hub we configured above. Our JSON configuration file is documented to show where this string should be placed (disable standard amqp and enable Azure). Since this proof-of-concept is evolving, please contact us for the latest details.
Monitoring Raw Events
After restarting the TallyFlow client software in the TallyPoint reader, start a shell in the Azure portal (icon to the right of the search area), then enter these commands. E.g.:
Now, scanning some RFID tags, here is some example output:
Create an Event Hub
The Event Hub in Azure is the bridge between the IoT Hub and Stream Analytics. An Event Hub can ingest millions of events from IoT devices. Within the Azure Portal, create the Event Hub. Once it is created, you can tie the IoT Hub events to the Event Hub. Using the IoT Hub instance, select Events from the left panel. Then create a new Event Subscription. In this Event Subscription, you can select that you wish to send device telemetry or other data to the Event Hub. Here, we are tying the Event Source to the Event Handlers. You can learn more in this Azure article.
Using Stream Analytics
The next step in sending data to where it can be further processed is by using Azure Stream Analytics. Stream Analytics (SA) takes an input(s) and output(s) to send the data from one location to another. Once you create your Stream Analytics instance, you will create the input and output channels. For example, the input on the example above is the Event Hub, which we called tfdemoHubInput. The output we selected is Power BI, and we called the output channel tfDemoBIOutput. Other input and output options are available and are shown in the Stream Analyics diagram above. Data may be converted from the input to the output using a query. Here is an example:
Power BI
In Power BI we receive a table for the data based on the query. From the example above, the fields will be subject, tag, time and direction. The data table name was specified when we created the tfdemoBIOutput channel. In Power BI, you can then use the fields from the table to create charts, graphs, tables, etc. Here are two example reports.
This first report shows the unique RFID tags that were seen on each reader.
This second report shows all of the RFID tags. It is filtered by device name.
Conclusion
Microsoft Azure is a powerful cloud platform that gives you great flexibility in the way that you process and analyze your data. Once the data from the TallyPoint RF-1 RFID reader is in IoT Hub, you can use that data in a variety of ways. It is a powerful DIY solution, or we can help you customize the Azure solution to suit your needs. Additionally, we provide a complete cloud solution, TallyFlow, that provides RFID endpoint configuration, zones, reports and tagged photos. Please contact us to learn more.