loading

Hey Everyone! In this Instructable, I'll show you how to make your own Arduino-based Heart Rate Monitor! But this is not just any other DIY Heat Rate Monitor; this is a Solar Powered Heart Rate Monitor!

This Heart Rate Monitor is aimed for rural areas in Africa and Asia. Here, many places lack electrical power, and due to this reason, and financial limitations, medical facilities may not be adequate.

However, this project efficiently harnesses sunlight to power itself, and can constantly measure one's heart rate. The project is much cheaper, compared to ECGs used in hospitals (not less than $300), and if miniaturised, can be as cheap as $5!

Of course, my project is now still in the development stages, but it is very much functional and will definitely make a very practical device...

Here is an introductory video...

Step 1: About Heart Rate Monitors...

Here's an explanation from http://embedded-lab.com/blog/?p=5508http://embedd...


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.


Didn't get it? Here's a simpler explanation...

The Heart Rate Sensor has two LEDs; one IR (infra red) transmitter and one IR receiver. The IR transmitter emits infrared light, that gets reflected by the blood in your finger. This reflected IR light is detected by the IR receiver.

Now when your heart beats, there is a slight increase in volume if blood in your finger. This means more IR light is reflected to the IR receiver. The receiver's signal gets amplified by an op-amp and the signal is fed to the microcontroller, which then counts each beat and calculates the beats per minute (BPM).

Step 2: Project Details...

Cost: ~$25 (excluding Arduino)

Time: A day

Difficulty: mediium........

Requirements: Basic knowledge of Arduino, Basic knowledge of electronics, using a breadboard.

Step 3: Materials...

For the HRM (heart rate monitor) circuit:

  • An HR (heart rate) sensor board - see the next step for more information on where to buy it or how to make it.
  • An Arduino Board - Any board, though I used a Mega (RadioShack)
  • Alphanumeric LCD screen - based on Hitachi driver. 16*2 and 16*1 will work...(Sparkfun)
  • Jumper wire (RadioShack)
  • Breadboard (RadioShack)
  • Any cheap powerbank (eBay, dirt cheap!)
  • Push button (RadioShack)
  • 10K resistors * 2 (RadioShack)

For Solar Charger circuit:

Tools required:

  • Soldering iron
  • Computer
  • Wire cutter/stripper
  • Hands (preferably two)

Step 4: Getting a Heart Rate Sensor Board...

Getting a premade HR board makes things much easier. I got mine from the local shop. You can try that too, but if you don't get one, try some of the following sites:

If you can't get one, you may have to make one yourself. I have uploaded two different but similar schematics using dual opamps. Then go on to the next step to see how to test them...

Step 5: Test the Heart Rate Sensor Board...

This is very easy, even for beginners in Arduino. In this step we will visualise the HR (Heart Rate) sensor output using a computer program, made in Processing. This will help us to modify the code for counting the heart rate. Follow these steps:

  1. Upload the "AnalogReadSerial" sketch to your Arduino board. You'll find it in File > Examples > Basics.
  2. Open the Processing application. Copy the code from below and paste it in the Processing window.
  3. Connect the HR sensor board to the Arduino: Power pins to +5v and 0, and the data output to A0 of the Arduino.
  4. Run the Processing program by clicking the 'play' button on the top left.

You'll get a graph of the Serial values coming from the Arduino. In the graph, X axis is time, Y axis is the Serial value. Maximum value of Y axis is 1023 (at the top of the graph), and minimum is 0 (at the bottom). When no finger is placed you'll get pretty arbitrary values, but placing you're finger without moving will create a clean "Heart Beat" on the graph, like shown in the picture above.

If you only wanted to visualize your heartbeat, you can stop here. However for going further, you need to figure out a certain 'threshold' value, that, if crossed, the Arduino will recognize as a beat. Different HR sensors may need different threshold values.

For me, I have set the value at 200.

See this video for demonstration of visualizing the Heartbeat...

Here's the code for the Processing program...

import processing.serial.*;
Serial myPort;        // The serial port
int xPos = 1;         // horizontal position of the graph 
//Variables to draw a continuous line.
int lastxPos=1;
int lastheight=0;
void setup () {
  // set the window size:
  size(600, 400);        
  // List all the available serial ports
  println(Serial.list());
  // Check the listed serial ports in your machine
  // and use the correct index number in Serial.list()[].
  myPort = new Serial(this, Serial.list()[6], 9600);  //
  // A serialEvent() is generated when a newline character is received :
  myPort.bufferUntil('\n');
  background(0);      // set inital background:
}
void draw () {
  // everything happens in the serialEvent()
}
void serialEvent (Serial myPort) {
  // get the ASCII string:
  String inString = myPort.readStringUntil('\n');
  if (inString != null) {
    inString = trim(inString);                // trim off whitespaces.
    float inByte = float(inString);           // convert to a number.
    inByte = map(inByte, 0, 1023, 0, height); //map to the screen height.
    //Drawing a line from Last inByte to the new one.
    stroke(255,255,255);     //stroke color
    strokeWeight(1);        //stroke wider
    line(lastxPos, lastheight, xPos, height - inByte); 
    lastxPos= xPos;
    lastheight= int(height-inByte);
    // at the edge of the window, go back to the beginning:
    if (xPos >= width) {
      xPos = 0;
      lastxPos= 0;
      background(0,123,255);  //Clear the screen.
    } 
    else {
      // increment the horizontal position:
      xPos++;
    }
  }
}

Step 6: Prepare the Solar Charger...

The solar panel has a voltage output of 7-12v. You cannot directly connect it to the power bank to charge, as the powerbank needs a regulated input of 5v to charge.

You can use a 7805 voltage regulator, but such linear voltage regulators are inefficient and waste a lot of part.

Switching regulators are much more efficient. The LM 2575 5volt switching regulator is said to be 80-90% efficient. Hence to charge the powerbank with a solar panel, we'll use an LM2575 based charger circuit.

See the above images, Frizing diagram and schematic to assemble the solar charger circuit on the breadboard...

Step 7: Prepare the LCD Screen...

For connecting the LCD screen to the Arduino, see the above pictures, fritzing diagram and their tags. Here are the connections in words:

  • LCD D4 to Arduino pin 8
  • LCD D5 to Arduino pin 9
  • LCD D6 to Arduino pin 10
  • LCD D7 to Arduino pin 11
  • Power pins to +5v and ground respectively
  • R/W pin (usually pin 5, but check with your LCD) to ground.
  • Contrast adjust pin (pin 3) ---10K resistor---ground (pin 3 connected to ground via resistor)

Button connections in the next step...

Step 8: The Button Circuit...

The button circuit is nothing difficult. Simply connect one terminal to +5v, and the other to the Arduino pin (the code given uses pin 2). Remember to add a 10K pull down resistor to the Arduinos pin.

Now connect the breadboard to the Arduino's power pins appropriately.

Step 9: Connect the Heart Rate Sensor...

The Board's power pins to +5v and ground, and data pin to A0 pin of Arduino. I made my own female to male wires, but you can buy them too. If you buy a board with more pins, don't hesitate to ask for help in the comments section!

Step 10: Upload the Code...

Now copy the below code to the Arduino software window and upload.

//Arduino Heart Rate Monitor - https://www.instructables.com/id/Solar-Powered-Heart-Rate-Monitor/

// Code By DangerousTim

//Last edited: 10 Nov 2014

#include <LiquidCrystal.h>

LiquidCrystal lcd(6, 7, 8, 9, 10, 11);

long measurementStartTime = 0; float beats = 0; byte sensorPin = A0; int currentSensorValue; boolean counted = false; float bpm;

void setup() { Serial.begin(9600); pinMode(sensorPin, INPUT); lcd.begin(16, 2); }

void loop() { while(digitalRead(23) == HIGH){

if (beats == 10){

beats = 0; lcd.clear(); lcd.print("Your BPM is "); bpm = ( (60000/ (millis() - measurementStartTime) ) * 10 ); lcd.print(bpm); measurementStartTime = millis(); } currentSensorValue = analogRead(sensorPin); if (currentSensorValue > 200 && counted == false) {

beats++; counted = true; } else if (currentSensorValue < 180) { counted = false; // digitalWrite(beep, LOW); } } }

Step 11: Try It Out!!!

To operate the HRM, follow these instructions:

  1. Connect the Arduino to power; either your computer or a power bank, via a USB A-B cable.
  2. Place your hand over the IR LEDs on the HR sensor board for a few seconds, without moving.
  3. Then press the button, keep it pressed.
  4. The first one or two reads will be inaccurate, but then it will stabilize.
  5. Release the button to stop measurement.

Step 12: Connecting the Power Bank...

The miniUSB connects to the power bank for recharging. Hence it will be connected to the LM2575 charger circuit's output (5v). Don't forget to test the output with a multimeter first!

To power the Arduino, simply connect a USB A-B cable from the powerbank's output to the Arduino board.

Step 13: Solar Charging!

Connect a female DC Socket to the LM2575 solar charger's input. Connect the powerbank, then connect the solar panel to the input via the DC socket.

Now go to somewhere sunny. The powerbank should show that it's charging by lighting up an LED. My powerbank would charge even when the solar panel is kept in shade outside!

Step 14: Conclusion...

Well, this for me was quite a fun project, and I'm sure you'll agree if you try making it. I hope that I made making an Arduino based HRM easier. Also this project is green, as it is powered by sunlight.

This feature makes it ideal for rural areas in developing countries, where simple commodities like electricity and batteries are not available. After it is fully developed, this cheap device can substantially improve health care in developing countries.

can anyone please explain the code?<br>while(digitalRead(23) == HIGH){<br><br> if (beats == 10){<br><br> beats = 0;<br> lcd.clear();<br> lcd.print(&quot;Your BPM is &quot;);<br> bpm = ( (60000/ (millis() - measurementStartTime) ) * 10 );<br> lcd.print(bpm);<br> measurementStartTime = millis();<br> }<br> <br> currentSensorValue = analogRead(sensorPin);<br> if (currentSensorValue &gt; 200 &amp;&amp; counted == false)<br> {<br><br> beats++;<br> counted = true; <br> }<br> else if (currentSensorValue &lt; 180)<br> {<br> counted = false; <br>// digitalWrite(beep, LOW);
<p>I see that there is inline jack but I can't seem to figure out where it goes, can you clarify this for me?</p>
<p>nice project..<br><br>I want to ask, how the connection between Heart Rate Sensor Board with arduino?</p><p>can you show me wiring diagram this connection.?<br><br>thank you<br></p>
thanks. can i use another IC instead of mcp602?
yes u can... an LM358
<p>Dear DangerousTim</p><p> hello!I am <br>Sue.I want to do the project (Solar-Powered Heart Rate Monitor).But I am a <br>beginner,so I cannot understand it well .please give me the whole circuit <br>diagram!Or the Solar Charger circuit . Thank you!</p><p>PS <br>:Im chinese so my english is limited.Please try to understand that!</p>
the really annoying thing is that you sent me 9 private messages ?. I mean, why couldn't you have JUST commented your question? and anyway, the schematics are quite clear. Pictures have no language.
<p>Nice project...</p><p>And good for learn about heart rate monitoring and solor powered system.</p>
<p>cool. but is that code works too if i using arduino uno r3?. </p>
Nope its uno compatible ;-)
<p>It is always good practice to provide proper citations and mention the sources, when you copy text or use figures from people's articles, unless you had exclusively received permission from the original author to do so. It looks like you have used some of the figures and text from these articles.</p><p><a href="http://embedded-lab.com/blog/?p=5508" rel="nofollow">http://embedded-lab.com/blog/?p=5508</a></p><p><a href="http://embedded-lab.com/blog/?p=1671" rel="nofollow">http://embedded-lab.com/blog/?p=1671</a></p>
Yes, I certainly will.... ;-)
<p>Very cool project! It would be really neat if you could make it smaller and put the whole thing in a small case with a small solar cell so it would be more portable.</p>
<p>i know... But I don't have one at the moment :-(</p>

About This Instructable

15,634views

147favorites

License:

Bio: Linux n00b, hacker
More by DangerousTim:ESP8266 Desktop Clock (WiFi Synchronised!) Linkit ONE GPS Tutorial Linkit ONE Setup Guide 
Add instructable to: