Stream analytics and IOT

Stream analytics and IOT

After successful integration with one of the biggest water treatment plant’s atomization for water tank level and temperature monitoring, we have a new requirement: to come up with a solution to measure below parameters for water quality measurement and control, also requirement was to fulfill the quality measurement in real time with stream analytics for forecasting of plant machinery’s maintenance and preventive and corrective actions and also need to implement real time dashboard solution for monitoring.

Below water quality and other parameters to measures

  • PH
  • ORP (oxidation-reduction potential)
  • DO (dissolved oxygen)
  • Chloride
  • Conductivity of water
  • Temperature
  • Water flow
  • Water pressure
  • Water level in raw and treated tanks
  • Vibration levels for all pumps and motors
  • Water pump motor RPM
  • Automatic/Remote water pump On/Off using Relays
  • Raw water Flow from outlet and inlet
  • Drop of water after treatment
  • Dam level monitoring
  • Pump outflow

Below is the solution and sample wiring circuit diagram of the sensors and micro controller I have used.


High level architecture of device to cloud communication and stream analytics


Our choice of tools

We have used Arduino Mega 2560 to read the sensor values and Raspberry pi as a central controller and internet gateway for Arduino Mega 2560 microcontroller board.

All the sensors will read the values and will send this values to Arduino Mega 2560 micro controller, here Arduino will process the analog values and will send them to central Raspberry pi controller, using Azure IoT Hub and Arduino Mega 2560 with Raspberry Pi2 device to process sensor data for real-time alerts and analytics.

Azure IoT Hub is used to collect sensor data from Arduino mega via raspberry pi, and to notify any device or mobile app when temperature crosses a threshold limit with the help of Azure Stream Analytic, Event Hub and Cloud services.

I have used Azure IoT Hub for device to cloud communication, you can also use event hub instead of IOT hub, but IOT hub will be good choice to send date from devices to cloud when you also require two way communication. For detailed difference between IOT Hub and Event hub refer:

Below is the sample stream analytics query for temperature and humidity average from IOT hub


Key advantages

Below are the few key advantages of stream analytics with IOT.

  • Disaster warning systems: Tsunamis, tornados, earthquakes and other devastating events can be detected through real time monitoring and global sensing systems can give us warning to get prepare in well advance for the devastating events.
  • Medical Emergencies: in urgent medical situations patient monitoring systems requires real time response to alert on urgent issues that requires immediate attention by doctors or staff for critical care of the patient.
  • Preventive maintenance: IOT with stream analytics can help to predict preventive maintenance by detecting and communicating wear and tear before it becomes machine failures.
  • Real-time fraud detection: as given example on azure, it can be useful to detect and prevent fraud using stream analytics.
  • Remote monitoring and Alerting: with stream analytics and IOT remote machine and human activity can be sensed and responded immediately.
  • Provides Deeper Insight through Data Visualization: Visualization of vital company information can help companies manage their key performance indicators (KPIs) on a daily basis. The data can improve sales, reduce costs, identify errors, and provide information to react faster to risks to mitigate them. Streaming Analytics accelerates decision-making and provides access to business metrics and reporting.
  • Offers Insight into Customer Behaviour: Streaming Analytics allows companies to gain visibility into what customers are buying, not buying, customer preferences, and dislikes. This gives companies the ability to generate additional profit and retain existing customers. It allows companies to rapidly respond to customer needs and increase revenues through up-selling and cross-selling of goods and services.

Work in progress

If you still reading this, below is the few glimpse of our work in progress dashboard of the water treatment plant monitoring. We have used our flagship product’s health monitor UI for creating dashboard for water treatment plant monitoring.

I have only shown temperature and water level data in below screenshot for simplicity, but you can measure and monitor all the above parameters we have seen in start of the post.



In above screen shots of dashboard we can see

  • Current operational efficiency of the plant, individual water pumps and motors.
  • Flow meters are indicating preventive maintenance for the clogs in the pipes or in the inlet valves.
  • Rise/Error in water pump’s temperature indicates preventive maintenance for cooling and oiling of the water pumps and motors.
  • Hour and day wise usage flow helps to predict the usage and demand in the coming time and helping plant engineers to calculate number of hours reserved pumps to keep running to fulfil the additional requirements.

Thank you for reading so far, stay tuned for more updates on IOT and stream analytics. If you have any query, question or suggestion feel free to write in comment below.

Tweet about this on TwitterShare on LinkedInShare on FacebookEmail this to someoneShare on Google+

Ashish Tank

view all post
Leave a comment

Please be polite. We appreciate that.

By Daniele Zedda • 18 February


By Daniele Zedda • 18 February

Share on