Archive for the ‘HeartBeat / ECG’ Category

A DIY photoplethysmographic sensor for measuring heart rate

Sunday, September 23rd, 2012

Meet Easy Pulse: A kit that includes all it needs to make a DIY heart rate sensor. Although it is not built using an Arduino, it is still open and easy to build.

The kit  is developed and available for purchase by Embedded Lab,

On the site you can find the schematics to make the circuit yourself:

From the site:

“This project is based on the principle of photoplethysmography (PPG) which is a non-invasive method of measuring the variation in blood volume in tissues using a light source and a detector. Since the change in blood volume is synchronous to the heart beat, this technique can be used to calculate the heart rate. Transmittance and reflectance are two basic types of photoplethysmography. For the transmittance PPG, a light source is emitted in to the tissue and a light detector is placed in the opposite side of the tissue to measure the resultant light. Because of the limited penetration depth of the light through organ tissue, the transmittance PPG is applicable to a restricted body part, such as the finger or the ear lobe. However, in the reflectance PPG, the light source and the light detector are both placed on the same side of a body part. The light is emitted into the tissue and the reflected light is measured by the detector. As the light doesn’t have to penetrate the body, the reflectance PPG can be applied to any parts of human body. In either case, the detected light reflected from or transmitted through the body part will fluctuate according to the pulsatile blood flow caused by the beating of the heart.”

The output of the kit is an analog signal that can be interpreted to detect the heart beats. So, you can still use your Arduino and write some code for forwarding the heart beats to your computer, smartphone, Cloud!

More information on the kit here.

An easy way to send your heartbeat to the Cloud

Tuesday, July 31st, 2012

Recently Seeedstudio (many thanks!) has provided me with a Grove Heart Rate ear-clip sensor:

This cool (and very low price) sensor is attached on your ear and can detect your heart’s pulse through transmitting infrared light and checking the absorption variation caused by the blood flow on your ear lobe. The site of the products provides also the Arduino code for detecting the beats and calculating an average heart rate (in bpm  - beats per minute). The sensor comes with a grove connector, so setting up and running the code took less than 5 mins! (thanks again @seeedstudio for providing me with a complete Grove kit).

After playing with it a while I realized that I could make a cool Cloud-based heart rate tracker by simply using an ADK board and my Android phone. This way I could be completely mobile (given that the 9V battery that powers the ADK board can last!).

I modified the Arduino code to send the heart rate to the Android using the ADB and made also a simple Android app that takes the heart rate and sends it to Cosm  (former Pachube) using the jpachube library.


Despite being very mobile (the cable is long enough to reach my pocket where both boards and mobile phone are) I am sure the graph-feed will stop being live quite soon (will either get bored, battery will die or will take it off to go to sleep…)

The code for the Arduino is the following:

/************************* 2011 Seeedstudio **************************
* File Name : Heart rate sensor.pde
* Author : Seeedteam
* Version : V1.0
* Date : 30/12/2011
* Description : This program can be used to measure heart rate,
the lowest pulse in the program be set to 30.

//Modified by @BuildingIoT
//for communication with Android

#include <SPI.h>
#include <Adb.h>

// Adb connection.
Connection * connection;

// Elapsed time for ADC sampling
long lastTime;

unsigned char pin = 13;
unsigned char counter=0;
unsigned int heart_rate=0;
unsigned long temp[21];
unsigned long sub=0;
volatile unsigned char state = LOW;
bool data_effect=true;
const int max_heartpluse_duty=2000;//you can change it follow your system's request.2000 meams 2 seconds. System return error if the duty overtrip 2 second.

void setup() {
pinMode(pin, OUTPUT);
//Serial.println("Please put on the ear clip.");
//Serial.println("Heart rate test begin.");
attachInterrupt(0, interrupt, RISING);//set interrupt 0,digital port 2

// Initialise the ADB subsystem.

// Open an ADB stream to the phone's shell. Auto-reconnect
connection = ADB::addConnection("tcp:4567", true, adbEventHandler);

void loop() {
digitalWrite(pin, state);


void sum()//calculate the heart rate
connection->write(2, (uint8_t*)&heart_rate);
data_effect=1;//sign bit
void interrupt()
state = !state;
if(sub>max_heartpluse_duty)//set 2 seconds as max heart pluse duty
data_effect=0;//sign bit
Serial.println("Heart rate measure error,test will restart!" );
if (counter==20&&data_effect)
else if(counter!=20&&data_effect)
void array_init()
for(unsigned char i=0;i!=20;++i)
// Event handler for the shell connection.
void adbEventHandler(Connection * connection, adb_eventType event, uint16_t length, uint8_t * data)


For the Android app all is needed is an Activity that implements the ADB server and communicates with the Arduino board:

package buildingiot.heartrate;


import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import org.microbridge.server.Server;
import org.microbridge.server.AbstractServerListener;

public class HeartRateOnCloudActivity extends Activity {

// Create TCP server (based on MicroBridge LightWeight Server).
// Note: This Server runs in a separate thread.
Server server = null;

int heartrate = 0;

TextView textView1;

/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {


//Create TCP server (based on MicroBridge LightWeight Server)
try {
server = new Server(4568); //Use the same port number used in ADK Main Board firmware
textView1.setText("Starting server..");
textView1.setText("server started!");

} catch (IOException e){
Log.e("Seeeduino ADK", "Unable to start TCP server", e);
textView1.setText("server not started!!");


server.addListener(new AbstractServerListener() {

public void onReceive(org.microbridge.server.Client client, byte[] data){
textView1.setText("got arduino data!");
String bpm = new String(data);
textView1.setText(bpm+" bpm");



To make it all work you need to have an ADB-enabled Arduino board like this one.

More examples on Android and Arduino communication can be found in my book.

Send HeartBeat data on your phone with PulseSensor

Tuesday, December 27th, 2011

or, “PulseSensor meets Android” as Kunal Mankodiya likes to entitle his YouTube video demonstrating his Android app that displays the heartbeat data as read by PulseSensor and a Bluetooth-enabled board.

Bluetooth communication is powered by Amarino:

YouTube video

Nice work, we hope to hear soon more from the user about coding details, etc.

Waiting for the first PulseSensor set to arrive…

Monday, September 26th, 2011

Another Arduino-based Graphical Heart Rate Monitor

Monday, September 26th, 2011

Wolfnexus is presenting in his blog his own experience with the Polar Heart rate module and the communication with Arduino. He also used an Adafruit 2.8″ TFT LCD touchscreen to visualize the output from the Arduino.

He also discusses schematic and code instructions. One interesting thing is that he is using interrupts for detecting heartbeats accurately and he also saves the rates in CSV format in SD card.


Nice work! It is still on progress, we are looking for future updates and wish him good luck!



Send motion, temperature and heart data to the Cloud through the CloudSensorSock

Thursday, August 25th, 2011

Mobile pervasive healthcare technologies can support a wide range of applications and services including patient monitoring and emergency response. At the same time they introduce several challenges, like data storage and management, interoperability and availability of heterogeneous resources, unified and ubiquitous access issues. One potential solution for addressing all aforementioned issues is the introduction of Cloud Computing concept.

Within this context we have developed and present the “CloudSensorSock”, a wearable – textile platform based on open hardware and software that collects motion and heartbeat data and stores them wirelessly on an open Cloud infrastructure for monitoring and further processing.

Watch the video for more information after the break.


Sleep disorder monitoring using the Arduino

Wednesday, August 10th, 2011

A nice idea for DIY monitoring of sleep disorders is presented here. The developer wanted to collect data on a suspected sleeping disorder, so he needed to record his heart rate and movement throughout the night. He borrowed an ear clip pulse sensor from a stationary exercise bike and interfaced it with an Arduino using a simple circuit which normalizes the photo-transistor’s output voltage and amplifies fluctuations. The Arduino senses rises and falls in voltage on one of its analog inputs and counts them as heartbeats. Motion is sensed with a crudely built vibrations sensor attached to the bed. It consists of a coiled thin wire pendulum which makes intermittent contact with a loop shaped electrode during vibrations. It is wired to the Arduino just like a button.

A major component of this project is a salvaged alphanumeric LCD from a defective answering machine with caller ID. The screen’s controller is a hd44780 equivalent, but the glass itself has many custom elements. Above the standard two lines with 15 characters each, there are over 80 individually addressable segments/elements. Most are arranged in 7 segment groups to produce digits. They behave like the exploded pixels of what would have been three normal characters.

The schematic from which the circuit built was based is the following:

The video presents the platform and many build details as well:

The video cannot be shown at the moment. Please try again later.

Update on the Pulse Sensor

Wednesday, August 10th, 2011

Guys from the upcoming Pulse Sensor project have provided to one of their students a prototype sensor for evaluation. He has made a nice video showing the sensor in action:

Can’t wait to receive one of the first production units and review it here! :-)

Arduino heart rate data logger

Sunday, August 7th, 2011

Another project implementation and tutorial that describes  assembly, programming and use of a device that constantly monitors heart rate and stores the data on an SD memory card. Quite useful when one needs to constant monitor heart rate and there are no options for wireless transmission of data via radio links or a mobile phone (increases cost complexity and power consumption).

As one can see, the logger utilizes the Polar Heart rate module (little dark cube particle on the right of the board).

Part lists:

 Parts list

Build, code instructions and results here.

The Anatomy of The DIY Heart Rate Monitor

Friday, August 5th, 2011

Joel Murphy and Yury Gitman from the Pulse Sensor project (also covered here) have just released basic instructions on how the ‘ve build their IR pulse sensor!


The information covers the fundamentals of the Infrared pulse sensing and basic instructions and hardware for building a prototype as the one illustrated above.

We are looking forward for more info about the tiny pulse sensor that the guys have built!

More details here.