Archive for the ‘Projects’ 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.begin(9600);
//Serial.println("Please put on the ear clip.");
delay(5000);//
array_init();
//Serial.println("Heart rate test begin.");
attachInterrupt(0, interrupt, RISING);//set interrupt 0,digital port 2

// Initialise the ADB subsystem.
ADB::init();

// 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
{
if(data_effect)
{
heart_rate=1200000/(temp[20]-temp[0]);//60*20*1000/20_total_time
//Serial.print("Heart_rate_is:\t");
Serial.println(heart_rate);
connection->write(2, (uint8_t*)&heart_rate);
ADB::poll();
}
data_effect=1;//sign bit
}
void interrupt()
{
temp[counter]=millis();
state = !state;
//Serial.println(counter,DEC);
//Serial.println(temp[counter]);
switch(counter)
{
case(0):
sub=temp[counter]-temp[20];
//Serial.println(sub);
break;
default:
sub=temp[counter]-temp[counter-1];
//Serial.println(sub);
break;
}
if(sub>max_heartpluse_duty)//set 2 seconds as max heart pluse duty
{
data_effect=0;//sign bit
counter=0;
Serial.println("Heart rate measure error,test will restart!" );
array_init();
}
if (counter==20&&data_effect)
{
counter=0;
sum();
}
else if(counter!=20&&data_effect)
counter++;
else
{
counter=0;
data_effect=1;
}
}
void array_init()
{
for(unsigned char i=0;i!=20;++i)
{
temp[i]=0;
}
temp[20]=millis();
}
// 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 java.io.IOException;

import android.app.Activity;
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. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

textView1=(TextView)findViewById(R.id.textView1);

//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..");
server.start();
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() {

@Override
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.

A Biofeedback Game Controller using Arduino UNO and EMG

Monday, 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

Thursday, 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.

A wearable Breathalyzer that can detect alcohol levels

Friday, October 14th, 2011

Matt Leggett has designed a jacket that can tells you if you’re too drunk to drive!

The jacket can inform the wearer whether they’re fit to drive or not, via a built in breathalyzer. In order to check if you’re over the limit or not, you simply pull on the collar and blow into a nozzle that’s hidden away nicely. If you can’t find the nozzle, you can take it that you’re drunk.

Included in the jacket are an Arduino microprocessor, an alcohol sensor, and a series of LED’s that “provide an elegant solution to the drink driving problem.”

A breathalyzer located in the pocket of the jacket, analyses the sample and then lights, that are stitched into the forearm, indicate how drunk you are. The LED lights glow when alcohol is detected and the brighter they glow, the worse you are.

Looks interesting. Hopefully we can find some more information about the project and how it progresses!

Galvanic Skin Response Sensor with Arduino on your iPhone

Friday, September 30th, 2011

Anna Dumitriu, Tom Keene and Alex May have led a 2-day workshop at the 17th International Symposium on Electronic Art (ISEA 2011) about Biosensing and Networked Performance and instructed participants how to build and calibrate their own iPhone compatible/connectable Galvanic Skin Response Sensors (GSR) to record subtle changes in their emotional arousal.


A GSR sensor connects to an Arduino board. The Arduino generates an audio tone mapped to value of electrical resistance in the skin. A filter removes a 32KHz sampling frequency contained within the output signal, which is recieved by an iPhone/Android mobile phone via their microphone input.

According to the makers, when a 9v battery is attached, the device takes 1 second to startup, then plays a 3 second startup sequence (composed by Caryl Mann). Two sensors placed on the skin will then measure subtle changes in skin resistance. The sweat glands are controlled by the sympathetic nervous system, so skin conductance can be used as an indication of psychological or physiological arousal.

Parts list and build instructions available here. Arduino code here.

Very interesting work demonstrating the direct communication with the iPhone. We also like the signal filtering (or smoothing) implementation on the Arduino code!

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!

 

 

Another EEG toy hack with Arduino :-)

Saturday, September 17th, 2011

Frenzy from instructables.com has created another EEG hack based on a “Star Wars force trainer” toy!

He provides full instructions on how to mod the trainer and interface it with the Arduino and he also provides the appropriate Brain library  (same used with Neurosky headsets and Mattel MindFlex) to interface with the latter.

He is able to retrieve and visualize the data produced by the trainer which include Connection quality, Attention, Meditation, Delta, Theta, Low Alpha, High Alpha, Low Beta, High Beta, Low Gamma and High Gamma.

Nice work demonstrating once again how feasible it has become to acquire EEG signals with low-cost commercial – toy devices! Next step would be to try some data classification and try to actually build a train model out of the signals! :)

All steps and software available here.

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.

 

The Tacit Project: An Arduino-based sonar feedback device for the blind

Saturday, August 20th, 2011

Steve Hoefer from Grathio Labs has developed the Tacit project, basically an assistance device for sonar obstacle avoidance with haptic feedback. The device can measure the distance to objects and translate that into pressure on the wrist. It is based on our favorite Arduino Mini Pro.

According to Steve, it’s wrist mounted and senses objects from about 1 inch (2 cm) to 10 feet (3.5m).  It has generally fast response time (fractions of a second) to quickly navigate complex environments. It’s designed to help a vision impaired person to navigate complex environments.  Mounted to the back of the hand, the force feedback means it doesn’t interfere with other assistance devices that mount elsewhere and use audio feedback cues.

Steve shares in his post all the information on how to build it (parts and schematics) and the Arduino code as well. Great work and beautiful design Steve!

Check also the video for a short live demo of the prototype: