Hussian Maanaki

Heartbeat Monitor

This project produces a heartbeat graph using a photon and a heartbeat sensor through the blynk app.

EasyFull instructions provided1,746
Heartbeat Monitor

Things used in this project

Hardware components

Particle Photon
uxcell® DC 5V Finger Heartbeat Sensor Detector Module
Breadboard (generic)
Breadboard (generic)

Software apps and online services



Read more


Heartbeat Circuit Diagram

This schematic is simply the circuit used to get the heartbeat monitor display. The sensor is said to be used for an arduino; however, given that the sensor is made up of 2 resistors (one of high resistance and the other of low resistance), an infrared light, and a phototansistor, it seemed like it would be fine for use with a photon. On the sensor there are three pins labeled (+, -, and S). The (+) goes to the voltage source produced by the photon, the (-) goes to the ground of both the breadboard and the photon, and finally the (S) goes to the photons A0 pin. Additionally the voltage source for the photon is given through the USB connection.


Heartbeat Code

The code gives an average value of the beat to give a slightly more accurate reading. As can be seen below in the code, it takes 75% of the old value and 25% of the new value and adds them up. The value that is calculated its displayed either though a graph or simply generating a list of numbers. However, using a list of numbers makes it difficult to find the peaks so graphing the values is a better option. Additionally, in lines 22-27 I believe is a filter of sorts for noise. Whenever I ran the code without these lines, the graph seemed a lot more unstable versus this bit in there.

Being the poor programmer that I am, most of this code was found online and I simply configured and added a couple things that I found to make it better.
int sensorPin=A0;
double alpha=0.75;
int period=50;
double change=0.0;
double max1=0.0;

void setup()

void loop()
  static double oldValue=1009;
  static double oldChange=0.2;

  int rawValue=analogRead(sensorPin);
  double value= alpha*oldValue +(1-alpha)* rawValue;

  if (change >= max1) {
    max1= change;
    Serial.println(" |");
  } else {

  max1 = max1 * 0.98;



Hussian Maanaki

Hussian Maanaki

1 project • 1 follower
Thanks to TkkrLab.