It took me some time to adjust it but now it works: the C code embedded on the nRF52832 is working fine: every 1/64 second, a pulse is generated on the IR LED. The ADC measures the voltage at the IR receiver, which is slightly modified by the proportion of oxygen in the blood, allowing to detect the heart beat cycles.
On the implementation side, we first need to filter the signal, sampled at 1/64 s, to remove the noise present. After high-pass and low-pass filtering, we detect the positive peaks inside the signal. When a peak is found, the firmware checks its validity: the peak must not be too low compared to previous ones. Also we check the coherence of this peak, as it cannot be too close to the previous one in time.
Once a peak is accepted, we measure the mean distance (in time) between the last 3 peaks. The heart beat per minute is given by the formula: 60*F_sampling/mean_distance.
Now I can see my heart beat in real time, through a printf on the serial com. The next step is to send the current BPM value by bluetooth. Once everything is working, I'll share the C code.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.