I had a look at the pulsesensor website your linked to. Setting thresh to 475 shouldn't cause this problem. However, I would set it back to 512 for now. I think thresh, P, and T should all be initialized to the same number.

Does the pulse sensor work properly if you comment out the call to analogRead(potpin) here?

driverblock wrote:I had a look at the pulsesensor website your linked to. Setting thresh to 475 shouldn't cause this problem. However, I would set it back to 512 for now. I think thresh, P, and T should all be initialized to the same number.

Does the pulse sensor work properly if you comment out the call to analogRead(potpin) here?

So I have set it back to 512, try playing around with the loop path by moving the temperature sensor code to work after the pulse sensor works and change the delay to (1000). Seems to be working right but not so accurate and often shows BPM=58. And the LM35 only react to room temperature, it doesn't react to any finger touching which actually should. In this case I have also connect it through XBee module to send the data wirelessly to PC.

No. The interrupt reads the pulse sensor every 2 milliseconds, regardless of any delay in loop(). You cannot synchronize the pulse and the temperature readings with a delay().

It is possible that switching back and forth between reading the temperature and reading the pulse is causing inaccurate readings.

Without changing anything else, try these two things:- comment out the call to readAnalog(potPin), and see if the pulse reading is accurate- restore the call to readAnalog(potPin), comment out the call to analogRead(pulsePin), and see if the temperature is accurate.

Alright, so it works for temperature only, but it doesn't work for pulse only. There must be something wrong with your pulse sensor. You are going to have to talk to the pulse sensor people about that. I can't help you with it.

driverblock wrote:Alright, so it works for temperature only, but it doesn't work for pulse only. There must be something wrong with your pulse sensor. You are going to have to talk to the pulse sensor people about that. I can't help you with it.