We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I was thinking whether its feasible to use a 8-bit counter with auto-reload to capture the number of peaks detected within 100ms.
If i measure the time between 2 heartbeats, how do i convert it to bpm?
"you could output an average of this number over several beats to get a more stable output"
Meaning i have to repeat the cycles several more times to get a more stable output?
Frequency (f) is the inverse of period (T):
f = 1/T
Measuring the time between two heartbeats gives you the period T in a unit of your choice (if you don't want to deal with fractional numbers or floating point just yet, I would suggest you use milliseconds at this point, but you'll need to do some fractional calculations later on).
For example, if you measure 750 ms, you would get
f = 1/(0.75 s) = 1.33 Hz = 80 bpm
Yes. The heartbeat has quite a bit of beat-to-beat variation, and if you don't want to see that in your application, you can average several measurements (how many depends on how stable you'd like the number and how slow of a response to changes you can accept).