Heart beat sensor with sound output

Hello,

I want to make a system that senses a heart beat and outputs a sound for every beat detected. I have a pulse sensor amped and I figured I could use an arduino to read the data and then use the tone function to output a sound through an amplified speaker. It seemed pretty simple, but it seems that both the pulse sensor and tone function use pwm 3 and 11. I'm no expert at programming and I don't know if there is a way to use different pwm pins. Is there a simple way to make this project work?

Thanks

Ahem.

Post the code, links to the specification of the sensor devices, and a picture of what you have so far.

The tone function does use the hardware timer used for pwm on pins 3 and 11 (on boards other than the Mega). It's not obvious whether your pulse sensor needs to use the same timer, or whether you need the capability to do pwm output on pins 3 or 11.

Thanks for the replies…

I have attached the code I put together for the project. Its basically the sample code from the pulse sensor amped with an addition of a sound element. The code originally made an led fade from on to off when a heart beat is detected. I just changed it to make a sound fade from a high frequency to a lower frequency when a beat is detected. However, the code has an error in it and I believe it has to do with the PWM pins 3 and 11. The sound element works fine when I make a separate program with it.

Here is the info for the pulse sensor amped

I have also included a picture of my hardware, its really straight forward. The pulse sensor is hooked up to ground, 5v, and analog 0. The speaker is hooked up to pin 7 and ground.

I thought this would be a pretty simple thing to do with an arduino, so if anyone has some suggestions they would be much appreciated.

Thanks
rr

pulse_sensor_sound.ino (4.59 KB)

Interrupt.ino (5.58 KB)

Looks passable interesting.

I have a disposable pulse oximeter carefully salvaged from my (most recent, I think) ICU stay (peeled it off as I was transferred, stuck it in my workbook). Though a more sophisticated device (with a DE-9 type of connector), I just might be able to hack it and try it with your sketch - but don't hold your breath on this account!