I build an ECG with the PicoMite


Author Message
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 757
Posted: 06:40pm 03 Feb 2022      

Thank you lizby for your advice! I am using easyEDA as "software".

I just wanted to post a quick update with my digital filter (there are more to come!)
The filter does work really great, there is no noise at all. The next filter I am planning is to make it more resistant against hand and body movements (high pass filter).


SetTick 10, ekg_interrupt 'samplerate 100Hz
SetPin GP28, AIN
SetPin GP25, DOUT
CLS c

Do
 If x>319 Then
   x=0
 EndIf
Loop

ekg_interrupt:
 x=x+1
 ekg = Pin(GP28)

 a0 =  0.20657128
 a1 =  0.21314257
 a2 =  0.20657128
 b1 =  0.16952595
 b2 =  0.09581110

 sn_2 = s_n1
 s_n1 = s_n
 s_n  = ekg
 g_n2 = g_n1
 g_n1 = g_n
 g_n  = s_n*a0+s_n1*a1+s_n2*a2+g_n1*b1+g_n2*b2
 ekg = g_n

 Line x,0,x+10,319,1,BF
 Line x-1,ekg_alt*100,x,ekg*100,1
 ekg_alt = ekg
IReturn


I know the screen draw could be better etc, but I am concetrating right now on the plain filter implementation :)
Edited 2022-02-04 04:43 by Amnesie