Multiple Pulsesensors

Hello all!

I am an extreme beginner with Arduino, so please excuse my ignorance! I hope one (or several) of you can help me!

I have bought 3 pulsesensors for a project. I can each one to work individually using the code shared on

I am trying to connect all three into one arduino to blink 3 lights respectively - sensor 1 to led 1, sensor 2 to led 2, and sensor 3 to led 3. So that it can be connected to 3 different people. I have tried altering the code by triplicating every variable… but it does not seem to work. I do not need the processing function that comes with the code, nor the fading LED option. Just blink.

I have searched online and have not found anything that works, except for Justin Eastman who posted this video using two -

He has said two things -

“I just used a different analog pin that what the pulsesensor (dot) com example code. Then I just duplicated all the variables that were specific to a particular sensor. ?”


“I have achieved this by simply creating a FOR loop with an index in the interrupt code and then creating an array for all the variables with the number of sensors.”

Unfortunately I do not understand how to do the second. I tried the first but think (attached - the two files need to be in a folder named PulseSensorAmped_Arduino_1dot2_test) I have messed up somewhere along the way as I keep getting these errors -

Interrupt.ino: In function ‘void __vector_7()’:
Interrupt:255: error: expected }' at end of input Interrupt:255: error: expected }’ at end of input

Could someone please help me?! I am an art student, and need to present this project very soon! Any help will be sooooo welcome!


Andre XD

Interrupt.ino (15.2 KB)

PulseSensorAmped_Arduino_1dot2_test.ino (3.9 KB)

There's a lot of things wrong with that interrupt code.

ISR(TIMER2_COMPA_vect){                         // triggered when Timer2 counts to 124
  cli();                                      // disable interrupts while we do this

Interrupts are already disabled in an interrupt service routine.

      word runningTotal1 = 0;                  // clear the runningTotal variable

This isn't running on a PC running a Microslop operating system. Useless shit invented in Redmond has no place on the Arduino invented in Italy.

  }  if (N3 > 2500){                           // if 2.5 seconds go by without a beat

Nothing goes on the same line as the }. Period.

  sei();                                   // enable interrupts when youre done!
}// end isr

Interrupts are automatically restored when the ISR ends.

Your sketch code is missing a loop() function, too.

Thank you so much for your advice, Paul! That was my crude attempt at altering the original code from pulse, without understanding it completely, so I am not clear about which mistakes I have made.

If I was to restart editing the original code to repeat it for 3 sensors to three LEDs, what would you recommend would be the way to do this? is it to repeat each variable? Or is there some code that can repeat the whole sketch for different inputs to different outputs? Sorry about my lack of terminology, it doesn't help things be any clearer!


Post the initial code from the website that goes with your hardware. Make sure that it at least compiles. It's hard to believe that the website contains code that doesn't compile.

Then, we can help you determine what changes are needed to make the code work with multiple sensors, if that is at all possible.

I am curious, though. What is the need to connect multiple pulse sensors to the Arduino? The pulse from each one should be the same if you are wearing all three of them.

Thanks once again for getting back to me! :slight_smile:

I have attached the original files that came with the sensor - They work fine for one sensor.

I want to use three sensors for three different people. So that each is different, but on the same board. So we have one arduino board, 3 sensors, 3 LEDs, 3 people. Then we can see each LED flashing for each person.

I hope you can help me! Thank you so much for replying! I really appreciate it! XD XD XD


Interrupt.ino (5.61 KB)

PulseSensorAmped_Arduino_1dot2.ino (4.03 KB)

Changing that code will not be too difficult. All the volatile variables in the pulse sensor sketch need to become arrays. In the interrupt routine, the variables also need to be arrays. The ISR(TIMER2_COMPA_vect) function will need to have a for loop added, to loop through the arrays, collecting information from one sensor at a time.

Then, loop() in the main sketch will need to be modified to handle sending all the data to Processing. Finally, the Processing sketch will need to be modified to handle three times as much input, and visually represent the data in distinguishable ways.

The time between the clock interrupts may end up being less than the time it takes to collect one sample from each of the three sensors and compute all the data and diddle with the LEDs. If that happens you could: 1) increase the time between interrupts. This may, or may not work well. 2) use three Arduinos, each reading one sensor and sending the data to Processing. This would require changing the Processing app to deal with three input streams.

You still haven't explained why you need to connect three pulse sensors to one Arduino/Processing app.

Thank you Paul!

I am going to try and do this - it might take me a while!

I do not want to use the processing sketch as I do not need the display on the screen with the heart monitor wave etc.. I just want to keep it all in arduino - sensors and LEDs.

The reason I wanted to connect all 3 onto one board would be at a later stage to attempt to process an average heart beat from the three data streams and to represent this as a 4th LED. This is to see the effect of an installation on people's heart beats, and whether certain conditions help people become more 'in tune' with each other. But at the moment I was trying to get all three to work well in the first place.

Although, having said that I did not want to use processing, your suggestion of three boards into one processing sketch could potentially achieve this? Instead of a 4th average LED I could do a screen with the average?

I will keep you posted on how I do with your suggestion. Once again, I cannot begin to thank you enough for taking your time to help me. Really really grateful! Hope you get all the good karma in the world! XD