Short survey about QuantifiedSelf and IoT

May 3rd, 2013

Hello medical and health project fans!

I am running a very short survey here about QS, Internet of Things and motivation! I would appreciate your participation! I should also mention that I will be presenting at QS Europe Conference, so if you plan to attend I would be happy to meet you!



Very simple ECG + Pulse Oximeter

April 20th, 2013

Scott W Harden has built an updated version of his ECG circuit for tracking his heartbeat. The main goal of the update is to provide a hack for collecting heartbeat with minimal h/w cost and circuit complexity.

As you can see from the project photo above, the heartbeat detector is based on photoplethysmogram. Scott nicely describes the basics of heartbeat detection and also how LEDs can be used (with appropriate filtering) for detecting the hear rate.

The circuit indeed looks pretty simple:


Scott uses a PC soundcard to read the analog data coming from the amplifier, but obviously an Arduino or Flyport could read the analog signal and transmit it to your favorite mobile device (or Cloud app).

More information about the project, circuit setup and code can be found here.

A DIY photoplethysmographic sensor for measuring heart rate

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

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.

Blog update

July 31st, 2012

There has been some time (well, ok more than some…) since the blog has been last updated. My apologies to Medicarduino fans! I have been quite busy with daily work, projects, research papers and blogging about the Internet of Things.

I promise to be more punctual!

Also, has been featured in Connected Health: How Mobile Phones, Cloud and Big Data Will Reinvent Healthcare! Great book, covering great topics about ehealth and mhealth!



Send HeartBeat data on your phone with PulseSensor

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.

A Biofeedback Game Controller using Arduino UNO and EMG

December 19th, 2011

Brian Kaminski of Advancer Technologies describes in a his new instructable post how to utilize their EMG Sensor Kit to build a USB Biofeedback Game Controller. You can use it to play any computer game (that uses keyboard inputs) using your muscles as the controller!

The EMG Sensor is integrated with the Arduino UNO allowing four muscles to act independently or in combination with each other to control over four buttons. In his demonstration, six button setup has been selected with the left forearm controlling the B button (RUN/ATTACK), the right forearm controlling the A button (JUMP), the left bicep controlling the LEFT button, the right bicep controlling the RIGHT button, and combinations for UP and DOWN.

Check the video here:

To build the project you need the following:

1 x Arduino Uno R2 (needs the atmega8u2 USB chip which is only available on newer Arduino MCUs)
1 x Arduino Project Enclosure
1 x USB cable for your Arduino
4 x Advancer Technologies Platinum Muscle Sensor
1 x Advancer Technologies Muscle Sensor Power Supply (without headers)
1 x 12V Power Supply (Wall wart)
4 sets of EMG Cables and Electrodes

Instructions and code for the Arduino and your computer (Processing code) is provided here.

Arduino Lilypad powered shooes for the visually impaired

November 3rd, 2011

Anirudh Sharma, an IT Engineer from Rajasthan Technical University has developed a system that offers non-obtrusive navigation for the visually impaired . Calling it Le Chal (Hindi for ‘Take me there’), Sharma conceptualized and demonstrated the system at MIT (Massachusetts Institute of Technology) Media Lab Design and Innovation Workshop 2011.

The Le Chal system comprises of a pair of shoes, one of which is fitted with Vibrators, proximity sensors and a Bluetooth pad which is connected to an Android phone that calculates directions and real time location using Google Maps and the phone’s built-in GPS and compass module.

How It Works

The user simply needs to speak the final destination before the start of his journey and the Android app formulates the route, calculating turn by turn directions which are sent to the shoe wirelessly via Bluetooth. Depending on the directions or GPS coordinates and compass, different vibrators within the shoe placed at different positions, are activated to offer feedback to the user depending on the turn he/she needs to take. So essentially, the system converts navigation data into haptic feedback.

The vibrators also take into account feedback from proximity sensors, which detects physical obstructions upto a range of 10 feet. The intensity of the vibrations differ depending upon the proximity from the destination. For example, in the beginning of the journey the feedback is weaker, while as the user reaches closer to the destination the strength of the feedback increases.

According to Sharma, voice instructions can be distracting and wearable gear is obtrusive and attracts unnecessary attention. He says that the system has been designed to make it non obtrusive for the users. The shoes have been tested at a Bangalore based Blind-school. He intends to make 20 such pairs and distribute them to the visually impaired. He also wants to make the supporting app open source and publish a Do It Yourself guide on Wikipedia where other users and developers could participate and help in developing a better version. As per his presentation, the system costs barely a few hundred rupees to assemble with 8 mini vibrational motors costing Rs 90, a sole of specified dimensions, an Arduino Lilypad GSM+GPS shield custom made for Rs 400 or a wired version costing Rs 150 for all the components.

New site!

October 22nd, 2011

Medicarduino has a new site (and a new domain):

The previous blog ( is still valid and redirects here. Hope you like the change. Content is the same and will be updated with similar material and much more!




Pulse Sensor Getting Started Guide

October 15th, 2011