IoT Event Monitoring and Analytics cookbook

Posted: 10 February 2017 Modified: 19 December 2017

This cookbook (authored by Einar Karlsen, Prasanna A Mathada, Sathiskumar Palaniappan, and Rene Meyer) is a collection of developerWorks recipes that demonstrates IoT event monitoring in an end-to-end integrated cognitive IoT and analytics scenario that uses an elevator simulator to generate IoT device data. The recipes in this cookbook demonstrate how you can use several services of the IBM Cloud Platform and IBM Marketplace.

Using the elevator simulator, you can direct the elevator to travel to a specific floor, set the load, and open and close the elevator doors. The simulator also allows you to control internal metrics, such as the motor and cabin temperature. All the device data is sent to the Watson IoT Platform, and from there to a data lake for persistent storage and later analysis by IBM Data Science Experience, IBM Watson Analytics and IBM Cognos Analytics. In this scenario, if you increase the motor temperature beyond 200 degrees Fahrenheit, the elevator is automatically put into maintenance mode by the IBM Watson IoT Platform. These abnormal situations that cause the elevator to go out of function for a period of time are of course of special interest for retrospective analysis. This scenario also integrates visual recognition. Using the Watson Cognitive services of the IBM Cloud Platform, combined with a camera, it is possible to use machine learning techniques to detect when the floor of an elevator needs to be cleaned.

As you work through the recipes in this cookbook, you must take on several roles in addition to IoT developer, such as data engineer, data scientist, business analyst and software engineer. The figure below shows a high-level architecture of the devices, simulator, apps, and services from this end-to-end scenario.

First set of recipes

The first few recipes show you how to create the elevator simulator (“Simulate an elevator – All using Node-RED nodes“) and how to monitor events in the elevator (“Monitor elevator events in real time to take corrective actions using Watson IoT Platform“) using the IBM Watson IoT Platform service and Node-RED running on the IBM Cloud.

In these 2 recipes you take on the role of an IoT Developer and manage devices, transform event data, create dashboards to monitor the elevators in real time, and define rules that trigger actions to the controlled devices, thus setting up a closed loop control system. You also use the simulator to trigger that the elevators will go into maintenance mode by increasing the motor temperature beyond 200 degrees Celsius. The alerts trigger emails, but they also serve as a basis for further analysis using analytic tools. An optional recipe (“Create a rule to monitor elevator events in Watson IoT Platform and trigger an Openwhisk action“) shows how to use rules to trigger an action in OpenWhisk, which is the IBM Cloud Platform for server-less and event-based computing.

Second set of recipes

The next set of recipes show you how to store the IoT device data persistently in the landing zone of the data warehouse using the IBM Cloudant NoSQL database service (“Store elevator device data and alerts in Cloudant NoSQL DB“) and how to make the data available for analytics tools in a data warehouse that is implemented using the IBM Db2 Warehouse on Cloud service (“Create data warehouse for reporting on Elevator device data using DB2 Warehouse on Cloud“). In these two recipes, you take on the role of Data Engineer, creating a data lake and configuring the appropriate data movement jobs. Both recipes use the services on IBM Cloud and show you various options for storing data in IBM Cloudant and for populating the IBM Db2 Warehouse on Cloud data warehouse with device data.

Third set of recipes

These recipes introduce you to analytics using the device data that was captured in the data lake. One recipe (“Analyze elevator device data using IBM Data Science Experience“) shows you how to use IBM Data Science Experience and Jupyter notebooks to perform statistics on the device data. You take on the role of a Data Scientist and create a connection to a database of historic data in IBM Cloudant, transform the data using Python so that it becomes suitable for analysis, and finally generate a few archetypical matplotlib statistical diagrams to gather new insights. In another recipe (“Analyze elevator device data using IBM Watson Analytics“), you take on the role of a Business Analyst and create a connection to the dashDB data warehouse, refine the data (using IBM Data Connect under the hood), discover relevant reports, and finally combine these reports into dashboards using IBM Watson Analytics and its capabilities for self-serve and natural language reporting.

Fourth set of recipes

This set of recipes shows you how to build a dashboard for monitoring elevator status and trend using IBM Cognos Analytics. The recipe “Monitor Elevator events using IBM Cognos Analytics” will shows how to create Cognos data models and dashboards. The dashboards will give the Business Analyst a clear picture – near real time – whether the elevators are running or not, which elevators have been impacted by maintenance stops over time as well as average and maximum motor temperatures on a daily basis. For this recipe we will use the data that was stored in the data warehouse by the second set of recipes as a basis for reporting, and then define database views to retrieve the last status or the average/maximum motor temperatures per day.

However, this fast path approach to reporting means that reporting is done using very detailed time series information as a basis. The approach allows experimentation with the dashboards and a fast iteration cycle whenever the dashboards need to be changed. In real life one would not duplicate information 1-1 from the landing zone to the data warehouse, rather the data in the data warehouse would be aggregated or filtered to fit the reporting needs. The recipe “Aggregate Elevator event data using IBM Data Science Experience” will show you how to create Extract-Transform-Load jobs to store the average and maximum motor temperature in the data warehouse on a daily basis using Data Science Experience, Spark, Jupyter notebooks and Python as programming language. The third recipe titled “Processing Elevator device data using the Watson IoT Platform and Node.js Consumers” will show you how to read current IoT event data directly from the Watson IoT Platform and then save it in the DB2 Warehouse on Cloud database using a Node.js consumer application. This recipe will also introduce you to the Continuous Delivery Toolchain and its constituent DevOps tooling in form of the Eclipse Orion Web IDE, Git on IBM Cloud and the Delivery Pipeline.

Last recipe

Last but not least, in the last recipe (“Automating elevator floor maintenance with cognitive visual recognition and Watson IoT“), you take on the role of IoT developer and Cognitive Software Engineer to use the cognitive capabilities of IBM Cloud by training the IBM Watson Visual Recognition service to distinguish between clean and dirty elevators.

Stay tuned for more recipes!

The current set of recipes in this IoT Event Monitoring cookbook are built around an end-to-end IoT, cognitive and analytics scenario that use IBM Cloud and IBM Marketplace offerings. We intend to provide additional recipes in the weeks and months to come, possibly covering topics such as streaming analytics, API management, chatbots, predictive maintenance, and enterprise integration (and business intelligence) solutions. So, stay tuned for more to come!

developerWorks recipes

This cookbook is a collection of developerWorks recipes that demonstrates IoT event monitoring and analytics in an end-to-end IoT scenario using an elevator simulator.

View other IoT recipes.

Author Information

Einar Karlsen, Prasanna A Mathada, Sathiskumar Palaniappan, and Rene Meyer