Introduction: Intel Edison: Heart Rate Monitor

About: 31 years old tinker and diy hobbyist. From Oulu, Finland. IG @mkarvonen_instructables

This is how to make a simple DIY heart rate monitor using Intel Edison.

The main build itself is pretty simple. You will need a small tube. LDR resistor and a led.

The code on the other hand needs a lot of calibrating.

I used my typical heart rate at baseline witch is about 80 beats per minute.

Mobile users put your finger HERE to see the video ;)

Step 1: Setting Up the Sensor.

This is the simple part.

Just find a tube that is roughly the size of you finger.

Make two holes on the opposite "walls".

Hot glue the LDR resistor and led in to the holes.

Then solder a resistor to the LED to ensure that it wont burn. I used 220 ohm resistor witch is good.

Then solder GND to the led's cathode and +5 Vcc to the anode.

After that solder short wire from the led's vcc (before resistor) to the first LDR resistor leg.

And lastly solder the signal cable to the last LRD resistor leg.

That's it. The basic's of the sensor is done.

I taped the outside of the sensor with black electronic tape. Just to ensure that minimal light is access to the LDR from the bottom. Also i put some black foamy stuff to the inside and cut a hole for the LDR. You will see these later in the pictures.

Step 2: Just a Quick Test.

The setup is simple. GND and Vcc go to the Edison own output's and the data singal cable from the sensor goes to analog 0 (A0).

And like i did later, the LCD screen goes to I2C port on the shield...witch you will see in the next step....

First of all. Download processing 2to graphically view the results of the readings, and possibly even seeing your own heart beat.

This will help you a lot when calibrating the sensor to the code.

You will however need a code for the program. Download it from bellow. It's the testisyke.pde.

Then load a simple program to the Edison that prints the analog sensor values to the serial then run the processing 2.

If it's not working check the serial port that it's the right one.

Step 3: Coding.

This is the most tricky part of the project. You will have to map down when your heart beats on the sensor.

The basic idea is that when the led is on and shines to the LDR the reading is about 1020. When finger is inserted on the LDR the value changes between 980-995. This is where the processing 2 comes handy. When the blood is bumping in your finger the light that goes by your finger changes slightly. Map down the right moment when the light is in the brightest and when dimmest. Your reading's may differ from mine.

Ok. so here is the code.

Few thing needed. A counter that will count the heart rate and Timer to count the time.

The timer is set to 0 at start and it will stop at 10 sec. Counter counts the beats and multiply them by six.

const int analogInPin = A0;
int Led = 13;

int sensorValue = 0;

int count=0; unsigned long time1=0; unsigned long time2;

#include #include "rgb_lcd.h"

rgb_lcd lcd;

const int colorR = 255; const int colorG = 0; const int colorB = 0;

Setup is mainly in basic settings.

void setup() {
Serial.begin(115200); pinMode(Led, OUTPUT); pinMode(Led, HIGH); lcd.begin(16, 2); lcd.setRGB(colorR, colorG, colorB); }

Then loop. This is the main program that shows the counted stuff and hold's the threshold values for the sensor that when it is time to count one, two, three, etc...

void loop() {

if(count==0) {time1=millis(); } time2=millis(); sensorValue = analogRead(analogInPin); if(time2>=time1+10000) { counter(); }

if(sensorValue >1000){ lcd.clear(); Serial.println("Insert finger"); lcd.setCursor(0,0); lcd.print("Insert Finger"); return; }

if(sensorValue ==991){ lcd.clear(); digitalWrite(Led, HIGH); increment();

Serial.println(sensorValue); Serial.println(count); Serial.println(time2); lcd.setCursor(0,0); lcd.print("Counting"); } if(sensorValue >990){ digitalWrite(Led, LOW);

} delay(200); }

Then few subroutine's.

Increment() does the adding to the count and counter counts beats and shows them with holding the value for 5 sec before continuing the program.


void increment()
{ count++;

}

void counter() { lcd.clear(); count=count*6; Serial.print("Heart beat: "); Serial.print(count); lcd.setCursor(0,0); lcd.print("Heart beat:"); lcd.setCursor(0,1); lcd.print(count); time1=0; time2=0; count=0; delay(5000);

}

Step 4: The Final Result.

The project work's great!

Few times it has shown 6 BPM right after correct reading.

Don't have a glue why but i can live with that.

Thank you for reading!

Follow me to get the latest project's first!

Happy building's :)

Protected Contest

Participated in the
Protected Contest

Explore Science Contest

Participated in the
Explore Science Contest