Introduction: Heart Rate With Custom IoT

Picture of Heart Rate With Custom IoT

In this example we will measure the heartbeat with the light provides a Led and a photo-transistor. The phototransistor detects the light that passes our finger from LED. The oxygen in our blood will prevent light comes the photo-transistor and from there will draw the information to detect heartbeat.

Step 1: Neccesary Components

Picture of Neccesary Components

→ 1 CustomIoT board

→ 1 Red Led

→ 1 Green Led

→ 1 photo-transistor

Step 2: Code

Load the attached code on the board.

We read the sensor value via pin A0 and calculate the current value measured by this and previous one, giving more importance to the previous (alpha = 0.75). We make the difference to see if this value has changed a lot and we send it to flicker green led to the same frequency as the heartbeat.

int ledPin = 4;
int sensorPin = A0;
<br>double alpha = 0.75;
int period = 20;
double change = 0.0;

void <strong>setup</strong>()            

void <strong>loop</strong>()             
    static double oldValue =0;
    static double oldChange =0;
    int rawValue =analogRead(sensorPin);
    double value =alpha * oldValue + (1 - alpha) * rawValue;
    change = value-oldValue;
    digitalWrite(ledPin, change);
    oldValue = value;

Step 3: Hardware Connections

We employed a module like you see in the picture below (sensor + red Led). Connect the output of this sensor with A0 pin from our board CustomIoT. The green LED will be connected to pin 4 from the board.


ALPHAVECTOR (author)2015-08-16
ALPHAVECTOR (author)2015-08-16

not for noobs

Custodium (author)2015-03-09


You need Custom IoT board and arduino IDE for upload the code.


VinCenT_SONG (author)2015-03-08

I don't know how to load the code,could you elaborate it?

seamster (author)2015-01-14

Thanks for sharing this!

About This Instructable




More by Custodium:Heart Rate with Custom IoT
Add instructable to: