Mirjam Bos / Mbed 2 deprecated emg_calibration

Dependencies:   BiQuad4th_order Biquad HIDScope MODSERIAL biquadFilter mbed

Fork of emg_calibration by Silvie van den Bogaard

Files at this revision

API Documentation at this revision

Comitter:
Mirjam
Date:
Wed Oct 31 19:59:10 2018 +0000
Parent:
1:f99650c5b9eb
Child:
3:274fb751b92d
Commit message:
Werkende calibratie met extra waardes die worden laten zien op de pc ter controle

Changed in this revision

Filter/Filter/FilterDesign.cpp Show diff for this revision Revisions of this file
Filter/Filter/FilterDesign.h Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Filter/Filter/FilterDesign.cpp	Wed Oct 31 13:30:40 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-#include "FilterDesign.h"
-#include "BiQuad.h"
-#include "BiQuad4.h"
-
-// Notch filter op 50 Hz
-double nb0 = 0.999103206817809;
-double nb1 = -1.994263409725146;
-double nb2 = 0.999103206817809;
-double na1 = -1.994263409725146;
-double na2 = 0.998206413635618;
-
-// 4th order Butterworth High pass 10 Hz
-double hpb0 = 0.922946103200875;
-double hpb1 = -3.691784412803501;
-double hpb2 = 5.537676619205252; 
-double hpb3 = -3.691784412803501;
-double hpb4 = 0.922946103200875;
-double hpa1 = -3.839672788481732;
-double hpa2 = 5.531745865737864;
-double hpa3 = -3.543889487580057;
-double hpa4 = 0.851829509414351;
-
-/*
-// 4th order Butterworth Low pass 6 Hz
-double lpb0 = 0.000000109473538449645 ;
-double lpb1 = 0.000000437894153798579 ;
-double lpb2 = 0.000000656841230697869; 
-double lpb3 = 0.000000437894153798579;
-double lpb4 = 0.000000109473538449645;
-double lpa1 = -3.903798995738811;
-double lpa2 = 5.715997307717368;
-double lpa3 = -3.720469814151233;
-double lpa4 = 0.908273253749291;
-*/
-
-//4th order Butterworth low pass 9 Hz
-double lpb0 = 0.00000054134117189603 ;
-double lpb1 = 0.00000216536468758410  ;
-double lpb2 = 0.00000324804703137616; 
-double lpb3 = 0.00000216536468758410;
-double lpb4 = 0.00000054134117189603;
-double lpa1 = -3.855703428197204;
-double lpa2 = 5.577429961461492;
-double lpa3 = -3.587322565783154;
-double lpa4 = 0.865604693977616;
-
-double gain = 10.00000;
-
-BiQuad notch50(nb0, nb1, nb2, na1, na2);
-BiQuad4 highpass(hpb0, hpb1, hpb2, hpb3, hpb4, hpa1, hpa2, hpa3, hpa4);
-BiQuad4 lowpass(lpb0, lpb1, lpb2, lpb3, lpb4, lpa1, lpa2, lpa3, lpa4);
-
-double FilterDesign(double u)
-{   
-    double y_n = notch50.step(u);
-    double y_hp = highpass.step(y_n);
-    double y_abs = abs(y_hp);
-    double y_lp = lowpass.step(y_abs);
-    double y_gain = y_lp*gain;
-    
-    return y_gain;
-}
\ No newline at end of file
--- a/Filter/Filter/FilterDesign.h	Wed Oct 31 13:30:40 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-#include "mbed.h"
- 
-double FilterDesign(double u);
\ No newline at end of file
--- a/main.cpp	Wed Oct 31 13:30:40 2018 +0000
+++ b/main.cpp	Wed Oct 31 19:59:10 2018 +0000
@@ -34,17 +34,15 @@
         if (emg2_cal > EMG_calibrated_max_2){
             EMG_calibrated_max_2 = emg2_cal;}
             
-        pc.printf("EMG1 = %f, EMG2 = %f \r\n",EMG_calibrated_max_1,EMG_calibrated_max_2);
+        pc.printf("EMG1_max = %f, EMG2_max = %f \r\nEMG1_filtered = %f \r\nEMG2_filtered = %f \r\n",EMG_calibrated_max_1,EMG_calibrated_max_2, emg1_cal, emg2_cal);
         wait(0.5f);
         }
 }
-
         
-
 int main(){
     pc.baud(115200);
-    // Attach the 'ReadEMG' function to the timer 'sample'. Frequency is 5 Hz.
-    sample.attach(&ReadEMG, 0.2f);
+    // Attach the 'ReadEMG' function to the timer 'sample'. Frequency is 50 Hz.
+    sample.attach(&ReadEMG, 0.02f);
     
     while (true) {
         led = 0;