« Back to 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 web site 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!

Prosys OPC UA weather station web page Prosys OPC UA weather station live web page

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, OPC UA, OPC UA PubSub, Raspberry Pi

comments powered by Disqus

About Prosys

Prosys is a leading provider of professional OPC software and services with over 10 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

Developing OPC UA applications in Android Studio

A short tutorial on how to start developing an OPC UA application in Android Studio.

OPC Day Europe 2017 - OPC UA is the Industry 4.0 Communication

OPC UA is now the Industry 4.0 Communication. Read the report from OPC Day Europe 2017.

Connecting OPC UA to Azure - Weather Station Demo

We experimented with presenting OPC UA data in Azure by creating a simple Azure web site where we are able to monitor the climate in our office.

View all blog posts »