Skill Level: Intermediate

Architect an IoT-solution to perform predicitve maintenance for electric engines powered by Capgemini.


  • Hardware: Rasberry (Gateway), current sensor of the engine, light sensors
  • Services: Watson IoT Platform, Cloudant DB, Message-Hub
  • Applications: Gateway-Script to send data to the Cloud (Python); Application to perform learning and data processing (Python), Webserver to visualize the Curves/Trends (HTML, Javascript)


  1. Introduction

    The Capgemini predictive maintenance solution for electric engines is able to detect engine failures at least five hours before they occur. The solution provides a learning mode to train new reference curves of expected behavior as well as a live-processing mode to evaluate the current curves against the reference curves. The integrated python application is able to process data points of the engines current energy consumption to curves. Due to its generic character the Capgemini predictive maintenance solution can be applied to all use case were electric engines play a crucial role for the overall system availability. In the area of Digital Manufacturing the present solution is especially suitable for a lot of use cases concerning transportation systems like conveyor belts.


    Find below the overall architecture of the solution with an overview of the main bulding blocks:


    The following section provides a detailed description of how the architecture is actually set up.


  2. Create Services

    In a first step you have to create a Watson IoT Platform -, Message Hub -, and Cloudant DB Service within the corresponding Region/Organisation/Space. The following step needs to be taken:

    • Watson IoT Platform: Create a device and save the responding device credentials locally
    • Cloudant DB: Create a database which has only one doucment. Save the previous stored IoT Platform credentials within the document.
  3. Connect Sensors to the Gateway

    The next task is to enable the data transfer of the sensors to the gateway. In general, depending on the specific use case the use of different sensors could be meaningful. For example in the case of a conveyor belt we use a sensor to collect the current energy consumption of the engine as well as two light barriers to detect the start/stop of the conveyor belts transportation cycle. The sensors have a wired connection to the gateway. As gateway we choose a rasberry pi because of its easy handle as well as the availability of advanced libarys to connect devices. The sensors must be enabled for the data transfer. On the gateway-side it must be ensured that there is a connection to the internet.   

  4. Connect Gateway to Watson IoT Platform

    The communication between the Raspberry Pi device (gateway) and the Watson IoT platform service is established over MQTT protocol with the help of a python script that is running on the Raspberry Pi device. The Raspberry Pi device establishes communication with the Watson IoT platform using the credentials it retrieves form the cloudant database. The device publishes the sensor data to the Watson IoT platform in JSON format.

    A shell script has been created to invoke the Python script that communicates with the IOT Watson platform to send sensor data over MQTT protocol. This shell script is launched at the boot up of Raspberry Pi device using an utility called crontab. crontab is a background (daemon) process that lets you execute scripts at specific times.

  5. Connect Watson IoT Platform to Application

    It is neccessary to enable the connection between the python-application and the Watson IoT platform service to process the incoming data from the gateway to the application. This is realized through a API key connection. To establish this connection the following steps have to been executed:

    • Open Service “Internet of Things Platform” à Activate Button “Launch”
    • Open Tab “Apps” à Activate Button “Generate API Key” à Copy credentials
    • The credentials are used within the python application whenever the client-server-connection is established (Using the Python-IoT foundation SDK)
  6. Connect Application to Cloudant DB

    To establish the connection between the application and the Cloudant service it is neccesary to open the tab conncetion within the application. In a next step the connection to the respective Cloudant DB Service must be set-up (alternatively: set-up connection via cloud foundry manifest-file of the application). Hereby the runtime – environment varibales (vcap_services) will be deposited automatically. Afterwards the cloudant service can be called out of the python-application with these credentials.

  7. Connect Application to Webserver via Message Hub Service

    When the python-application is started a topic is created in the Messsage-Hub service. The python-application acts as a producer and publishes the most recently processed data whenever a data point is receved from the Watson IoT Platform. The Webserver acts as a consumer to the Message-Hub topic. It listens to all messages and processes the most recent one in a specified interval. The content of the message is visualized in the UI.

Join The Discussion