## EKG using Arduino board + OLIMEX SHIELD-EKG-EMG board

Started by Aa, June 04, 2020, 11:41:26 am

#### Aa

##### June 04, 2020, 11:41:26 am
Hi

just finished to build EKG using Arduino board + OLIMEX SHIELD-EKG-EMG board :

I am looking for a way to measures heart pulse.
Anyone know how to derive and calculate heart pulse from the EKG info the board collected?

Thanks

#### svan

##### June 04, 2020, 09:58:42 pm #1
Thank you for posting the video; nice work.  I'm curious what lcd you used. Presumably there's an Arduino UNO along with the Olimex shield.

I'd love to see the code for the heart rate also.  I've seen some code that was pretty complex and not easily adaptable to this type of project.  It's tempting to use voltage criteria, but occasionally the baseline will wander and interfere with this approach.  My concept was that if there was a rapid increase in voltage immediately followed by a rapid decrease then it must be a heartbeat, but I never could come up with the code.  If you are successful, please post your approach.

#### Aa

##### June 04, 2020, 10:56:04 pm #2
Thanks,
I used the Elegoo UNO R3 2.8 Inches TFT Touch Screen

#### Aa

##### June 06, 2020, 06:20:16 pm #3
Quote from: svan on June 04, 2020, 09:58:42 pmMy concept was that if there was a rapid increase in voltage immediately followed by a rapid decrease then it must be a heartbeat, but I never could come up with the code.  If you are successful, please post your approach.

I calculated the pulse by checking for the voltage drop(that is very big V>1). When a voltage drop > 1 is detected I check the time with: time1 = millis()
When second voltage drop is detected I check the time again with:  time2 = millis()

Then (time2 - time1)/1000 give the time between pulses in second
and 60/(time between pulses) = pulse per minute

#### svan

##### June 06, 2020, 11:35:09 pm #4
>Then (time2 - time1)/1000 give the time between pulses in second
and 60/(time between pulses) = pulse per minute

That would work if the pulse was regular, but what if the individual had an arrhythmia with an irregular heartbeat?  Usually premature beats are followed by a compensatory pause; ie, the time between beats is not constant, it is variable.  A more accurate determination might be to count the number of beats for an entire minute instead of the time between two heartbeats.  Of course the user would then have to wait an entire minute to see a result with this technique.  A second option would be to calculate the heart rate with successive determinations and have it get increasingly accurate as time progresses.  For example, time for two beats, time for three beats, time for four beats, time for five beats, ... etc until a minute elapses.  Just some thoughts.  I will try your code.  Thanks for posting.