« All blog posts

Connecting OPC UA to Azure - Weather Station Demo

04.05.2017


Cloud services and IoT solutions are becoming increasingly popular. OPC UA technology and our OPC UA Java SDK fit well in this development, enabling secure and standardized communications with devices and systems from different vendors.

We experimented with presenting OPC UA data in Azure by creating a simple Azure website where we are able to monitor the climate in our office. The system architecture is presented in the picture below.

weatherstation

Measurement device level

At the low level there is a Raspberry Pi Weather Station demo device that hosts an OPC UA Server application running with Prosys OPC UA Java SDK. The station measures temperature, pressure and humidity which are then provided on the OPC UA Server for OPC UA Clients to read. Unfortunately, the only humidity sensor of our station is placed inside the weather station. Thus, the measured humidity is hugely affected by the electronics, staying constantly very low and not representing the actual office humidity at all. We found ourselves happier with the temperature and pressure measurements, even though the temperature value has regular false spikes at 40 °C.

Data processing and Azure

In the middle there’s a customized OPC UA Client .NET implementation based on Microsoft’s OPC UA Publisher Module for the Azure IoT Gateway SDK (link). In this solution the Publisher module plays a key role in connecting between OPC UA and Azure. First, it uses OPC Foundation’s Standard Library Stack for connecting to the Weather Station OPC UA Server and reading the data of interest in the server, in this case the temperature and pressure values. Next, the received data is processed according to need: we filter out the received temperature spikes and perform some average calculations for both the temperature and pressure values to make the value changes look more gradual in the graphs. The resulting values are encoded into JSON format, after which the Azure IoT Gateway SDK is used for composing an IoT Hub compatible AMQP message and sending it to our IoT Hub in Azure.

Alternative architecture

In another possible solution we would not have included a Publisher module in an additional OPC UA Client application, instead a Publisher would have become a part of the Weather Station OPC UA Server application. This kind of solution would allow direct connection from an OPC UA Server to Azure and expectedly be the ideal solution for a majority of OPC UA to Azure use cases. We preferred our reliable Weather Station to stay unmodified and implementing a Client layer also has its own advantages. For example, if data from multiple existing OPC UA Servers is wanted in Azure, it can be easier to implement a single OCP UA Client program that collects the wanted information from all servers and sends it to Azure, as opposed to modifying each of the existing Server applications separately.

Future development

In the near future, an upcoming release of OPC UA PubSub (Publisher/Subscriber) specification will include means for OPC UA applications to connect themselves directly with cloud services, such as Azure, using protocols like AMQP or MQTT. This will make development of OPC UA to Azure applications easier and more flexible, which is why we at Prosys are already developing a PubSub implementation in Java. So stay tuned!

Do you want to know more?

If you are interested in developing your own Azure or other cloud based system with OPC UA connectivity, feel free to contact us. We can provide you software tools and professional services that enable fast development in this rapidly growing new market.

You can send us email (sales@prosysopc.com) or use the contact form.

Teppo Uimonen

Teppo Uimonen

Software Engineer

Email: teppo.uimonen@prosysopc.com

Expertise and responsibility areas: OPC & OPC UA product development and project work

Tags: Azure, IoT, Cloud, OPC UA, PubSub, Raspberry Pi, SDK for Java, Demo

comments powered by Disqus

About Prosys OPC Ltd

Prosys OPC is a leading provider of professional OPC software and services with over 20 years of experience in the field. OPC and OPC UA (Unified Architecture) are communications standards used especially by industrial and high-tech companies.

Read more about us »

Newest blog posts

Why Do Standards Matter in Smart Manufacturing?

The blog post discusses the importance of standards in smart manufacturing, envisioning a future where auto-configurable systems in manufacturing rely on standardized data formats for seamless integration and reduced costs, with a focus on the OPC UA standard family as a key enabler.

OPC UA PubSub to Cloud via MQTT

Detailed overview of the demo presented at the OPC Foundation booth

SimServer How To #3: Simulate data changes on a server using an OPC UA client

A two-part step-by-step tutorial on how to write data changes on an OPC UA server using an OPC UA client.

View all blog posts »