Project tutorial
Heart Rate Monitor Using IoT

Heart Rate Monitor Using IoT © GPL3+

This project displays the heart rate at the unit of beats per minute over the Internet so that it can be monitored from anywhere.

  • 44 respects

Components and supplies

Apps and online services

About this project

In this project we are going to make a Heart Beat Detection and Monitoring System using Arduino that will detect the heart beat using the Pulse Sensor and will show the readings in BPM (Beats Per Minute). A past few days ago we felt boring and we saw about node.js and thought of implementing something out of that........... And it finally resulted into development of this Prototype which actually Displays Heart Rate in beats per minute using IR pulse sensor..........

"For this project you may either use your PC or Mac or your Raspberry Pi."

The steps for doing this is given below.

1) Preparation of Arduino

Upload the sketch given into Arduino and make sure that you receive data in the Serial Monitor:

2) Install Node.JS

Install node.js in your pc / mac /linux pc / raspberry pi:

  • In case of mac / linux / raspberry pi open terminal and type

For mac:

brew install nodejs

For linux / raspberry pi:

sudo apt-get install nodejs

3) Install packages required for Node.JS

Run following commands on your terminal to install packages

npm install -g 
npm install -g serialport
npm install -g johnny-five
npm install -g express

4) Running the scripts

  • After installing the packages connect the Arduino board to the PC / Raspberry pi and make sure that the data is retriving in the serial monitor of Arduino ide....
  • once verified..... Now its the time to Run our scripts.. run Them in the order as mentioned Below.....
  • once you see "Communication is on!" in your terminal.
  • then open the page.html in an browser and you may see the values Displaying over there....
  • This will run your Program only in the localhost of the pc

In order to view them over internet you need the AMAZON WEB SERVICES configued.

5) Configuring the amazon Web Services (AWS)

  • At first create an account or login to your AWS account
  • move to EC2 module over There
  • Hit launch Instance button there
  • select any OS from there
  • Hit review and launch Button
  • Hit launch in the next page and create an new pair key and Download it
  • it is the file used to acces the AWS module in future Purposes
  • After creation hit Launch Instance button there
  • And choose the services shown below and click connect

  • An url along with an ssh link will be shown there
  • Now go to the file location where you downloaded the security key and run terminal in that folder and copy and paste the ssh link in the terminal and run it
  • now repeat the steps 2 and 3and 4 here now after everything is over close terminal
  • Now choose the services u chose earlier shown below and click connect
  • Now use the URL given by it and view the OUTPUT through the internet.

The video

This is updated one

The end!


This is the code that must be uploaded into the arduino
int UpperThreshold = 518;
int LowerThreshold = 490;
    int reading = 0;
    float BPM = 0.0;
    bool IgnoreReading = false;
    bool FirstPulseDetected = false;
    unsigned long FirstPulseTime = 0;
    unsigned long SecondPulseTime = 0;
    unsigned long PulseInterval = 0;

    void setup(){

    void loop(){

      reading = analogRead(0); 
      if(reading > UpperThreshold && IgnoreReading == false){
        if(FirstPulseDetected == false){
          FirstPulseTime = millis();
          FirstPulseDetected = true;
          SecondPulseTime = millis();
          PulseInterval = SecondPulseTime - FirstPulseTime;
          FirstPulseTime = SecondPulseTime;
        IgnoreReading = true;
      if(reading < LowerThreshold){
        IgnoreReading = false;

      BPM = (1.0/PulseInterval) * 60.0 * 1000;
       // uncomment these lines in case you want to view the various values in the console.....
      Serial.println(" BPM");
this contains the code to establish an connection between serial data and the server........
var SerialPort = require('serialport')
var Readline = SerialPort.parsers.Readline
var express = require('express');
var socket = require('');

var app = express();
var server = app.listen(3005);


var io = socket(server);

io.on('connection', function(socket){

var serialPort = new SerialPort('/dev/tty.usbmodem1421', {
  baudRate: 9600

var parser = new Readline()
parser.on('data', function (data) {
  //console.log('data received: ' + data)
  io.sockets.emit('map', data);

serialPort.on('open', function () {
  console.log('Communication is on!')
This is the web page which is gonna display the number of heart beats per minute in it.
<!DOCTYPE html>
        <meta charset="UTF-8">
         <script src='nerve.js'></script>
        <script src='speech.js'></script>
        <meta name="viewport" content="user-scalable=no,initial-scale=1,maximum-scale=1" />
         <script src=""></script>
                margin: 0;
                background-image: url('')
                overflow: auto;
                border-bottom-right-radius: 5px;
                border-top-right-radius: 5px;
                border-top-left-radius: 5px;
                text-align: left;
                background-color: yellow;
                border-bottom-left-radius: 5px;
                border-top-right-radius: 5px;
                border-top-left-radius: 5px;
                text-align: right;
                background-color: white;
                border: 1px solid #000;
                padding: 5px;
                margin-right: auto;
                margin-left: auto;
                width: 90%;
                max-width: 500px;
                font-family: arial;
                font-size: 20px;
                color: black;
                white-space: nowrap;
                font-weight: 600;
                font-family: arial;
                font-size: 15px;
                color: black;
                white-space: nowrap;
                font-family: arial;
                font-size: 20px;
                font-weight: 400;
                width: 10px;
                height: 10px;
                margin-left: auto;
                border-radius: 5px;
                border: 1px solid red;
                background-color: red;
                background-color: gold;
                background-color: green;
               padding: 10px;
                margin-right: auto;
                margin-left: auto;
                width: 90%;
                max-width: 500px;
                border-bottom: 1px solid #000;
                width: 100%;
                text-align: left;
                background-color: white;
                padding-bottom: 3px;
                position: relative;
                top: 4px;
                left: 5px;
                border-radius: 40px; 
                height: 80px;
                float: left;
                font-weight: 400;
                font-family: arial;
                color: green;
                color: red;
                border-top: 1px solid #000;
                width: 100%;
                position: fixed;
                bottom: 0;
                background-color: white;
                padding: 10px;
                border: none;
                resize: none;
                width: 75%;
                font-weight: 400;
                font-size: 20px;
                font-family: arial;
                overflow: hidden;
                background-color: white;
                color: #0BB5FF;
                font-size: 20px;
                padding-top: 100px;
                font-family: monospace;
                text-align: center;
                font-size: 100px;
        <h1 id="hello"></h1>
            var socket = io.connect("http://localhost:3005");
            var socket_1 = io.connect("");//give the link generated by the AWS after turning on for linking code with internet....
            socket.on('map', function(data){
                 socket_1.emit('map', data);
                 document.getElementById('hello').innerHTML = data;


circuit Diagram
Heartbeat bb qna3hn7vym


Similar projects you might like

Heart Rate Monitor (Wearable and Wireless Using ECG)

Project tutorial by Dmitry Dziuba

  • 71 respects

Detecting Heart Rate with a Photoresistor

Project tutorial by 3 developers

  • 46 respects

DIY Heart Rate Sensor

by Ingeimaks Ingeimaks

  • 40 respects

IOT - Smart Jar Using ESP8266, Arduino and Ultrasonic Sensor

Project tutorial by Team Smazee

  • 18 respects

Measure Heart Rate and SpO2 with MAX30102

Project tutorial by SurtrTech

  • 256 respects

Home Automation Using Raspberry Pi 2 And Windows 10 IoT

Project tutorial by Anurag S. Vasanwala

  • 824 respects
Add projectSign up / Login