Introduction: Particle Photon: Pulse Sensor

The Particle Photon is a really cool micro-controller for getting started with IoT. Programming a photon is similar to programming a Arduino Nano with a few extra functions that give it WiFi capabilities. The photon can work with IFTTT and also has various shields similar to the Arduino that give it different capabilities.

In today's instructable I'm going to show you how to build a pule sensor using the photon, this circuit streams pulse data from the module to a web page which can be accessed online. This project can be used to monitor your heart activity during exercise, jogging, etc. You can store all the data on a web server for future reference.

Step 1: Materials and Components

To start of with here is a list of all the components required to get started with the project,

To make the hand band

  • PCB
  • Velcro


  • Soldering Iron
  • Multimeter

With the addition to the above tools you will need a PC to program the photon on and an active internet connection (over WiFi).

Step 2: Circuit

There is not much of a circuit all you need to do is plug the photon a breadboard and make the following connections-

  • Red Wire form pules sensor to Photon 3.3V
  • Brown or Black wire from pulse sensor to Photon ground pin
  • Orange or Purple wire from the pulse sensor to Photon A0 Pin

These connections can be made on a breadboard or can be directly soldered on to the board. I used a 3.5mm audio Jack to connect both the boards together.

Step 3: Connecting Photon to the Internet

A first time setup requires you to connect the photon to the internet and claim it or link it to your account. This process is really simple all you need to do is download the particle app from the android play store or the IOS app from the apple store.

You need to login into your account in the app and then follow the onscreen steps to claim your photon. Make sure your photon is powered on this whole procedure and your phone is connected to the same WiFi network you want your photon to be connected to.

After claiming your photon, it should be breathing cyan, indicating a successful connection to the particle cloud.

Step 4: Web IDE (Uploading Code)

Next, visit open the Particle web IDE, copy and paste the code below. The code measures the analog data from the sensor which is connected to analog pin 0 and creates a variable of the same which can be accessed by our Web server.

Note: You should add the pulse senor library from the list of libraries, before compiling the code.


#include "PulseSensor_Spark/SparkIntervalTimer.h"

void interruptSetup(void); void serialOutput(); void serialOutputWhenBeatHappens(); void sendDataToSerial(char symbol, int data ); void ledFadeToBeat(); void arduinoSerialMonitorVisual(char symbol, int data );

extern int pulsePin; extern int blinkPin; extern volatile int BPM;; extern volatile int Signal;; extern volatile int IBI; extern volatile boolean Pulse; extern volatile boolean QS; const int numReadings = 10; int readings[numReadings]; // the readings from the analog input int readIndex = 0; // the index of the current reading int total = 0; // the running total int average = 0; int bpmm; extern int fadePin; extern int fadeRate;

void setup(){ Spark.variable("getpos", &bpmm, INT); pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat! pinMode(fadePin,OUTPUT); // pin that will fade to your heartbeat! Serial.begin(115200); // we agree to talk fast! interruptSetup(); // sets up to read Pulse Sensor signal every 2mS for (int thisReading = 0; thisReading < numReadings; thisReading++) { readings[thisReading] = 0; } }

void loop(){ // subtract the last reading: total = total - readings[readIndex]; // read from the sensor: readings[readIndex] = BPM; // add the reading to the total: total = total + readings[readIndex]; // advance to the next position in the array: readIndex = readIndex + 1;

// if we're at the end of the array... if (readIndex >= numReadings) { // ...wrap around to the beginning: readIndex = 0; }

// calculate the average: average = total / numReadings; // send it to the computer as ASCII digits bpmm = average; }

Step 5: Web Page

You can find a basic web page in the attachments, it displays the number of beats per minute from the data collected. You may have to place you sensor in the right position to get accurate readings. Open the page with a code editor (sublime text or even notepad should do) and enter your access token and device ID in the places where it says to do so.

You can open up the html file, in a chrome browser and you should be able to monitor your pulse readings.

Step 6: Finishing

After you have uploaded the code you can power on the photon and open the web page and you should see a live data feed of your pulse. You may need to add tape over the pulse sensor to prevent sweat from interfering with the circuit.

You could create a PCB with the same connections and add some Velcro so you can strap it on your hand. If you have any queries you can leave a comment below and I would be glad to help you.


Abir paul made it! (author)2016-09-01

I have buit one which can simultaneously calculate the heart rate,body temperature and radiation... and sends the data as message to the mobile

LiamL16 (author)Abir paul2017-01-16

bruh clean your board have some etiquette

GerardoG27 (author)2016-11-16

Me too im also having problems finding the PulseSensor_Spark/SparkIntervalTimer.h library

SaraR80 (author)2016-11-10

Hi, I'm having trouble finding the attachments, or basic web page to see the BPM data. Where could I find it? Thanks!

About This Instructable




More by go_cool:Particle Photon: Pulse Sensor Particle Photon: Internet Button (Notification Lamp)Arduino 8x8 LED Matrix
Add instructable to: