Rajesh K Jeyapaul ,

Cloud Solution Architect ,Dev Advocate & Startup Mentor


Rupam Das,

Co-founder, CEO – Acculi Labs

Research Scholar, Entrepreneur, Hacker, Coder, teacher, blogger



Happy living is the success for a  Healthy Heart . Given the current lifestyle a person is exposed to various levels of stress and hardships. This certainly affects the performance of the heart behaviour.

Human heart is an Electromechanical organ which acts as a pump. Electrical signal generated by a small SA node in heart causes it’s contraction and expansion which leads to blood circulation of the body. Autonomic nervous system acts like a mediator between human bran and heart. Chemicals like Adrenaline, dopamine etc acts like a messenger of signal from brain to heart.

Therefore every emotion are stimulated at brain and are carried to heart. Heart reacts to each of these emotions and “messages” in unique ways. Therefore we use sentences like “Hearty Congratulations” and “You have broken my heart” instead of “You have broken my brain” or “Congratulations from deep of my brain”.

Though there have been some abundant studies about reaction of heart to certain emotions, we have not learnt about these correlations in a way that we should have.  So we decided to explore this area with the aid of technology.

Some fundamentals of electrical Signal of Heart

As it is being said earlier that heart is an electromechanical unit where the functioning of the heart can be quantified by measuring the electrical activities across heart.

Heart’s electrical activities are measure using standard procedure and the signal thus acquired is called an ECG signal. An ECG signal is basically vector sum of all the electrical vectors at different  strategic points around electromagnetic field of the heart.

The electro magnetic field of heart and flow of electrical vector signal is represented as below.


Just as an object in real world can be captured through camera from various angles ( like Side view, Top View, Bottom View, Front View, Isometric View), heart can also be monitored from different angles.

A standard “View” of the heart across which an electrical signal is measured is called a Lead.

Modern day ECG contains 12 such leads and are commonly known as 12 Lead ECG system.

ECG leads are further categorized into Inferior, Septal, Anterior and Lateral leads. Inferior leads are also called Limb Leads.

Following Image Shows basic notation of the leads.

A Typical ECG signal is as shown below.

PQRST is the language of ECG signals. These are distinct peaks in an ECG signal which is repeated over time and shows different properties and morphologies depending on the lead as well as the pathological and Physiological condition of the heart.


Heart Emotion Monitoring device:

As a 3D projected image is most essential for complete knowledge about a real object, 12 Lead ECG is needed for complete view of the Heart. However, in most practical purposes we use a 2D camera. View captured from even a 2D camera is often representative enough about the dominating characteristic of the object.

Taking a cue from this real world adaptation of the imaging devices, we have built a Single Lead ECG system which contains three signal acquisition points.

We capture the ECG using heart’s domainant electrical axis which is represented by Lead II.

The device developed by us is called Lyfas, which is not only capable of capturing single Lead ECG data, but at the same time it can acquire pulse signal and then combine both of them to derive blood pressure, non invasive blood sugar, respiratory signal and many more.

Here is a look at Lyfas: It is being ingeniously developed at Acculi Labs Pvt. Ltd. Bangalore. Following is a high level diagram representing the device and platform.

We used Lyfas platform to acquire ECG biosignal live during the Violin performance of the author. Rest of the article will cover signal processing details of this biosignal.


Solution Architecture

Solution Implementation:


From solution implementation perspective, the first step is to generate the heart behaviour data from the device.

Step 1: Data Generation

  • Three access points are used to connect the electrodes as shown in the above architecture diagram.
  • Data generated is captured at the device and been moved to the Edge device, in this case, smart mobile phone , using Bluetooth.
  • Data is generated @ 100KHz frequency
  • Appropriate filters are applied at Edge and then the sampled data, every 5 secs, is published to the Watson IoT Platform


Step 2: Data Publish to Watson IoT Platform and Data Storage


  • Device is registered with Bluemix Watson IoT Platform and the data is published to the platform using MQTT protocol
  • Data published is further moved to Cloudant NoSQL storage using the Bluemix NodeRed environment.


Step 3: Data Analysis using Bluemix DataScience (DSX) platform

 Using DSX which offers Apache Spark platform , data is analyzed and interpreted

  • Data from Cloudant is imported onto Apache Spark Python Notebook
  • Using libraries like numpi and framework like Panda, data is analyzed.

Solution Execution : LIVE data from a musical concert

 In a recently concluded musical concert, device was used to gather the heart emotions of musicians while performing.

The performer is connected with the device as shown above(yellow circle), where the wires from the electrode is connected to the device which is made available at the performers shirt pocket.

The data flow and analysis architecture is as below:


Data is further represented using the Apache spark python notebook. Data is loaded directly into the python notebook using the Bluemix Apache Spark.

BPM – Bits per minute (Heart beats per minute)

Value –  Average is 90BPM , min – 70BPM max – 142 BPM

IBI – InterbitInterval (msec)

Mean – 308.75msec

Min – 0

Max – 737msec  



RAMP – R amplitude (milli volt)

Mean – 526.81061806656101

Min – 185

Max – 666


The python notebook used to analyze the data is available @ https://github.com/ECoDIndia/heartEmotion     (HeartEmotion_git.py)

Note: Data is not made available to access

Next Step

Next step is to analyze and create a classification model with the data that is generated. Feature vectors to have the sad and happy moments during the LIVE musical performance. Apache Spark available at Bluemix will be used to implement the same.

Pls. feel free to reach out to us for any further information.


Rajesh K Jeyapaul – jrkumar@in.ibm.com

Rupam Das – rupam@integratedideas.co.in / www.facebook.com/rupam.das.733 / https://in.linkedin.com/in/rupamiics



2 comments on"Watson IoT Platform based Heart Emotion Analysis using Lyfas Device & Apache Spark !!"

  1. Hima Bindu June 02, 2017

    it is very useful

  2. Rajesh Jeyapaul July 20, 2017

    Thanks. We are working on a model which can be used with your own health data. Details will be shared soon.

Join The Discussion

Your email address will not be published. Required fields are marked *