Think 2021: New tools have the developer ecosystem and IBM building together Learn more

Archived | Detect change points in IoT sensor data

Archived content

Archive date: 2019-05-21

This content is no longer being updated or maintained. The content is provided “as is.” Given the rapid evolution of technology, some content, steps, or illustrations may have changed.

Note: This pattern is part of a composite pattern. These are code patterns that can be stand-alone applications or might be a continuation of another code pattern. This composite pattern consists of:


In statistical analysis, time series data consists of a sequence of data points that you can monitor and analyze over time: stock market closing values, daily high and low temperatures, social media posts. This developer journey shows you how to use IoT sensor data, IBM Watson Studio, and R software for statistical computing to analyze the data and detect change points.


The world is awash in data. More and more devices are now connected, whether for social interactions or remote monitoring and management. Auto manufacturing, weather forecasting, power grids – no aspect of our lives remains untouched by the Internet of Things. Gone are the days when a technician needed to inspect a rooftop air conditioning unit onsite to physically identify issues. No longer does a manufacturer have to wait for a finished part to manually pass a quality test to find defects.

But how do we predict failing equipment in a remote store thousands of miles away? Can we predict equipment failure and initiate a corrective action before any breakdowns occur? And can we provide those proactive responses in real time? Can we overcome the challenges of geographic distribution to improve our work and personal lives? The answer, of course, is yes.

Developers need to know how to find that kind of insight in data. This code pattern shows you how to detect when a change point occurs in time series data from an IoT sensor. You will compute statistical parameters from time series data, comparing a data set for a previous time range with a current time range. The statistical comparison between these two data sets enables you to detect any change points. You’ll use the R statistical analysis project and sample sensor data that you will load into the IBM Watson Studio cloud.

When you complete this pattern, you will understand how to:

  • Read sensor data for a single sensor.
  • Extract two time series data sets (one in the past and another in the present).
  • Compress the data sets by translating them into statistics that accurately describe their characteristics.
  • Compare the statistics, quantify them, and analyze the comparisons to detect change points in the data.



  1. Sign up for IBM Watson Studio.
  2. Create IBM Cloud services.
  3. Create a Node-RED app and inject IoT data.
  4. Create the Jupyter notebook.
  5. Add the data and configuration files.
  6. Update the Jupyter notebook with service credentials.
  7. Run the notebook.
  8. Download the results.


Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the README.

  1. Log into IBM Cloud and create IBM Cloud services.
  2. Create Node-RED Application to load IoT data into DB2 table.
  3. Read IoT data from the sample csv file.
  4. Import the sample data into a DB2 table using the Node-RED flow.
  5. Configure the parameters in .json dsx configuration file.
  6. In R notebook flow, update credentials to read relevant Sensor data subset from the DB2 table.
  7. In Watson Studio, R runs on Spark engine to ensure scalability and performance.
  8. Store the configuration file in Object storage.