Overview

Skill Level: Beginner

This is an tutorial how to construct an heart rate monitor integrated with IBM Watson IoT Platform.

Ingredients

Step-by-step

  1. First construct the Circuit to connect Arduino to Pulse Sensor

    The heart pulse has tree terminals, in order left to right they are: analog sinal, VCC 5v and GND. Just connect directly to the ports Analog input 0, 5v and GND in your Arduino.step9

    Untitled-Sketch_bb

  2. Preparing Watson IoT Platform

    • First you log into your Bluemix account and select CATALOG and in Service select Internet of Things and create an platform of IoT.

     

    step1

    • In the next screen will be show an wizard to create your IoT server, is importante to select the free version of this.

    step2

    • Than, when you finish creation of server the painel of Watson IoT will be show, just click in active painel.

    step3

    • Than, on the dashboard , just click in the icon of devices, and select add new.

    step4

    step5

    • Than, into the wizard of creating a new device, you have to first create a new device type. In the device type creation just put an name and take notes the name to use in future arduino connection.

    step6

    step7

    • Now you can go back to creation device wizard, select the device type you just created and in the next step junt inform the device ID. That device ID we will use to arduino connection configuration too.

    step8

     

    • The last screen will show the most important informations that you must take notes: organization ID, device type, device id and the auth token.step9

     

     

  3. Creating arduino code

    The next step is create the code to arduino connect to Watson IoT Service. This code is an mixing of two examples: first this from¬†Bradford Needham that is an special verson to work in mkr1000 and read pulse sensor signal (download original here) and this another code from¬†Jo√ęl G√§hwiler that is an simple mqtt client example (download here). Its important that the code need to be completed with the organization ID, device type, device ID, auth Token, wifi SSID e wifi Password.

    The code for arduino can be download from here.

     

    When the code was upload and runing into arduino you can check if its working using the arduino console, and into the watson iot the detail of device show the packages that was received. 

  4. Processing data from Watson IoT

    Now we can create an service that consumes data from our Watson Iot server, for that just create an application into Watson Iot to co generate the key. 

    step10

     

    step11

    Than you go back to IBM Bluemix Catalog and create an app type Node-RED.

    step12

     

    step13

    Wait for wizard finish the Node-RED service and than access the configuration, we create an flow that uses de IBO Iot client to the the messages from Watson IoT and filter the value of BPM heart rate using switch, than if the BPM is between 700 and 900 per second they uses Twilio API to send SMS. 

    step14

     

    Thats the IBM IoT client configuration:

    step15

    step16

     

Join The Discussion