In this IoT hackfest, Microsoft worked closely with View360 Technologies to connect its telecom tower monitoring solution to the Azure cloud platform from AWS using Azure IoT Hub and Stream Analytics services. This report describes the solution, the results, and the next steps.

Customer profile

View360 Technologies is an innovative IT outsourcing and consultancy company based in India with solutions ranging from telecom tower monitoring, IT infrastructure monitoring, remote asset monitoring, energy optimization, and video surveillance. Additionally, it has telecom and infrastructure and consultancy services.

The services of a telecommunication network service provider are widely dependent on its BTS (base transceiver station) tower installations and other associated infrastructure in these locations called BTS sites. As the BTS sites spread across geography and penetrate deeply into rural areas, the challenges of maintaining the BTS sites and associated infrastructure grow.

To address these challenges, a View360 team conducted an intensive study of telecom tower operations and came up with an integrated solution, telView360.

This solution consists of three levels of intelligence—continuous event monitoring, processing and controlling of event-generated data, and communicating with a remote server. These three levels of intelligence are used to enable the telecom service provider to automate the controlling functions that ensure smooth running of BTS infrastructure and to optimize the electric power use to lower the operating costs of a BTS site.

The solution will benefit various stakeholders as follows:

  • Recording and monitoring the health of a telecom tower.
  • Detailed analysis of various devices.
  • Predictive maintenance in the long run.

The project team included the following:

  • Sudhir Rawat – Senior Technical Evangelist, Microsoft DX India
  • Gandhali Samant – Senior Technical Evangelist, Microsoft DX India
  • Surbhi Jain – Audience Marketing, Microsoft DX India
  • Satish Kottapalli – Director, View360 Technologies
  • Budida Ranjith Kumar – Developer, View360 Technologies
  • Sudhakar Rachakonda – Developer, View360 Technologies
  • Saladi Shiva Ramakrishna Deekshitulu – Developer, View360 Technologies

Pain point

Initial Scenario

View360 has its current solution running on Amazon Web Services (AWS). This solution consists of an AWS EC2 instance that acts as a listener, SQL Server database, .NET services, and ASP.NET website running on a virtual machine.

After the successful completion of this proof of concept, View360 plans to migrate its entire deployment from AWS to Azure.

View360 is not using any OS on a gateway. It is using embedded C programming and SIM900A (dual-band GSM/GPRS module, 2G Edge Network) to post the data. At present, it has two versions of implementation:

  • Version 1 is interfaced with two battery voltage measurement circuits and different kinds of sensors such as smoke, door, fuel, and temperature. These are all connected through wired interfacing with a microcontroller. Two smoke, door, temperature, and infrared sensors and one DC energy meter are directly connected with a master board.

  • Version 2 is interfaced with three battery voltage measurement circuits, sensors, and energy meters. Some are directly connected with microcontrollers and some are wireless (ZigBee). Two fuel sensors and EB energy meter are connected with wireless communication (master board communicated with slave device through ZigBee)

These parameters are continuously monitored and relayed to the cloud via a hub device. The hub device uses rs45 serial communication for most of the sensors. The fuel sensor and energy meter use ZigB for communication with the hub device. Also, they use a dual SIM-based GSM modem for Internet communication. But the solution had a few problems:

  • Currently the View360 team is using AES encryption, but for mass deployments they want device-level authentication and also a way to create and manage devices on the fly.
  • They also want to integrate automated device discovery, device configuration, and OTA firmware updates.
  • They need help with machine learning models for predicting battery backup, DG backup time, and identifying elements that have degraded and need replacements (such as air conditioners, generator battery bank, and so on).
  • Scalability is a challenge.
    • Right now, 300 devices are deployed in the field. The customer expects to have 5,000 devices within a year. Each device sends data every minute if the previous value changes. If the previous value doesn’t change for 5 minutes, it sends an event. The size of each event is 120 bytes. So, managing these devices and events at such a large scale is challenging.
    • A .NET application (around 880 lines of code) processes incoming events. However, because the customer is expecting more devices in the near future, they need a reliable way to scale the event processing.

Note: The machine learning solution will take place in the next phase.

The new solution helps manage and register devices, enabling View360 to secure devices and deal with good and bad events.

Solution

Step 1: Building the end-to-end flow

We did a small POC with the View360 team to establish the communication with the IoT hub using REST APIs with SAS token authorization. We wrote a small API to generate the SAS tokens.

    Code Snippet 1– Web API Code

    [HttpGet()]
    public string Get(string deviceId, string deviceKey, string ttl)
    {
        TimeSpan fromEpochStart = DateTime.UtcNow - new DateTime(1970,1,1,0,0,0, DateTimeKind.Utc);
        
        int timetolive = Convert.ToInt32(ttl) * 24 * 3600;
       string expiry = Convert.ToString((int)fromEpochStart.TotalSeconds + timetolive);

        string baseAddress = IOTHubName + ".azure-devices.net/devices/" + deviceId;
        string stringToSign = WebUtility.UrlEncode(baseAddress).ToLower() + "\n" + expiry;

        byte[] data = Convert.FromBase64String(WebUtility.UrlDecode(deviceKey));
        HMACSHA256 hmac = new HMACSHA256(data);
        string signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(stringToSign)));
        string token = String.Format(CultureInfo.InvariantCulture, "SharedAccessSignature sr={0}&sig={1}&se={2}",
                        WebUtility.UrlEncode(baseAddress).ToLower(), WebUtility.UrlEncode(signature), expiry);
        return WebUtility.UrlEncode(signature);

    }

GitHub link - https://github.com/gsamant/AzureIOTHubRestConnection

Once we confirmed their device could send HTTP messages to the IoT hub, we created an end-to-end flow as shown in the following architecture.

Figure 1. Data insertion architecture

Data insertion architecture

Step 2: Configuring IoT hub and Stream Analytics

We started working with device level code in C and created HTTP requests to connect to the REST API interface of the IoT hub. The sensors sent the data to the hub device, which was transmitted to the IoT hub. We wrote a Stream Analytics job to read data from the IoT hub. Here we encountered a challenge.

Challenge: Events were coming in CSV (comma-separated value) format. As per the documentation (https://docs.microsoft.com/en-us/azure/stream-analytics/stream-analytics-define-inputs), CSV formatted inputs require a header row to define fields for the data set. In any circumstance, if SIM operators are not available to establish a connection, then the hub device stores data (temporarily) in gateway storage. Adding a header for each event would have increased space, which in turn would allow storage of fewer events on the device. The customer wasn’t comfortable with this solution.

Figure 2. The sample event

Sample event

Solution: The customer agreed to provide 5-6 bytes to add for each event. We converted an event in JSON format. One column with data is as follows.

Figure 3. The modified event

Modified event

When a message enters the Azure IoT hub, Stream Analytics processes each event to extract column value and store it in the Azure SQL database. All bad events will move to Azure Blob storage for monitoring and troubleshooting.

Figure 4. Stream Analytics inputs and outputs topology

Inputs and outputs

Figure 5. Stream Analytics query

SA query

Note: The code snippet above is not complete because it contains business logic to process events.

Step 3: Data storage

After being able to read and process data, we inserted it into the Azure SQL database. In the future, data archival policy will be defined to move data to Azure Blob storage for predictions in Azure Machine Learning.

Figure 6. Output in Azure SQL database

SQL database output

All the bad events will get stored in Azure Blob storage.

Figure 7. Bad event output to Azure Blob storage

Bad event output

Figure 8. Scenes from the hackfest

Hackfest

Architecture

The schema of the solution architecture is explained above.

Device used and code artifacts

Industrial grade GSM/GPRS modules.

Below is the list of sensors:

  • Smoke sensor
  • Door sensor
  • Fuel sensor
  • Temperature sensor
  • Infrared sensor
  • Battery sensor
  • EB energy meter
  • DC energy meter

Opportunities going forward

We will continue to engage with View360 to help its team onboard more devices for the same or different sites and make sure the right architecture is in place. We’ll watch for and update the customer whenever Azure Stream Analytics provides support for events in CSV without a header.

In the next phase, View360 plans to add Power BI reports for better visualization. Also, the team is exploring Power BI Embedded to integrate the visualizations in their customer-facing website. We will continue to work with them for the integration.

On the cloud side, View360 is planning a feature to add alerts for site supervisors using Azure Functions. For example, if the diesel in a generator drops below a certain threshold, the site supervisor will be notified immediately to check for a puncture.

Once they gather enough data, they will also use Azure Machine Learning for predictive analytics.

Conclusion

The Microsoft and View360 teams worked closely to conclude a successful implementation of the IoT solution. The View360 team had their solution running on AWS. We used Azure IoT Hub and Stream Analytics services, which are platform as a service (PaaS) services, hence the integration was quick and straightforward.

We ran into a few challenges as we started developing the solution. We finished an end-to-end scenario where we read data from sensors and we could process good events and store them in Azure SQL database. The bad events were stored in Azure Blob storage. The next step is to embed visualizations in their web application using PowerBI Embedded.

The View360 team got to learn about using Azure PaaS services along the way and they were happy to see the seamless integration. Our team also learned about different types of sensors, controllers, and hardware that are being used in local industries and gained experience with connecting those to our Azure services.

Quote from the customer:

“We are delighted to partner with Microsoft for the Azure IoT services & cloud platform. While our existing solution was fine for limited deployments, there were some challenges in scaling this up for large deployments with Enterprise grade security, reliability and maintainability. Our partnership with Microsoft is helping us in making our solution best in class.

“After Indian Railways, the telecom sector is the biggest consumer of diesel. Our IoT platform helps customers monitor and optimize their energy costs, which are a big part of the operational expenses while enabling better uptime of their networks. The combined power of Cloud, Mobile, and Analytics is enabling the field workers to improve their response time, uptime and overall productivity.

“Azure enables us to create a superior customer experience by allowing us to seamlessly integrate our devices with the cloud, store and analyze the data, and visualize the same in the form of easy-to-understand dashboards. We can help customers take suitable action based on such inputs to improve operational efficiency, reduce costs, and improve profitability.”