Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HIDScope biquadFilter mbed
Fork of biquad2 by
Revision 0:f9aed4422fcb, committed 2015-10-16
- Comitter:
- Paashaas
- Date:
- Fri Oct 16 09:39:22 2015 +0000
- Child:
- 1:911daa1a9f4a
- Commit message:
- een nog veel mooiere filter;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HIDScope.lib Fri Oct 16 09:39:22 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tomlankhorst/code/HIDScope/#5020a2c0934b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/biquadFilter.lib Fri Oct 16 09:39:22 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/tomlankhorst/code/biquadFilter/#e3bf917ae0a3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Oct 16 09:39:22 2015 +0000
@@ -0,0 +1,100 @@
+#include "mbed.h"
+#include "HIDScope.h"
+#include "biquadFilter.h"
+
+AnalogIn emg1(A0); //onderste board
+AnalogIn emg2(A1); // 2e board
+AnalogIn emg3(A2); // 3e board
+AnalogIn emg4(A3); // bovenste board
+
+Ticker sample_ticker; // naam van de emg-ticker
+
+HIDScope scope(2); // aantal kanalen voor je HIDScope
+
+//highpass filter 20 Hz
+const double numhigh_1 = 0.956543225556877;
+const double numhigh_2 = -1.91308645113754;
+const double numhigh_3 = 0.956543225556877;
+const double denhigh_2 = -1.91197067426073;
+const double denhigh_3 = 0.9149758348014341;
+
+//notchfilter 50Hz
+//biquad 1
+const double numnotch_1_1 = 1;
+const double numnotch_1_2 = -1.97538661427765;
+const double numnotch_1_3 = 1.00000018882502;
+const double dennotch_1_2 = -1.97024348390877;
+const double dennotch_1_3 = 0.995504923090779;
+
+//biquad 2
+const double numnotch_2_1 = 1;
+const double numnotch_2_2 = -1.97538624436946;
+const double numnotch_2_3 = 1.00000018882502;
+const double dennotch_2_2 = -1.97175302143845;
+const double dennotch_2_3 = 0.995629024908953;
+
+//lowpass filter 7 Hz - envelop
+const double numlow_1 = 0.000119046743110057;
+const double numlow_2 = 0.000238093486220118;
+const double numlow_3 = 0.000119046743110057;
+const double denlow_2 = -1.968902268531908;
+const double denlow_3 = 0.9693784555043481;
+
+
+double u1 = emg1.read(); //inputvariables
+double u2 = emg2.read();
+double u3 = emg3.read();
+double u4 = emg4.read();
+
+
+biquadFilter highpass( denhigh_2 , denhigh_3 , numhigh_1 , numhigh_2 , numhigh_3); // removes artifacts
+biquadFilter notch1( dennotch_1_2 , dennotch_1_3 , numnotch_1_1 , numnotch_1_2 , numnotch_1_3 ); // removes 49-51 Hz power interference
+biquadFilter notch2( dennotch_2_2 , dennotch_2_3 , numnotch_2_1 , numnotch_2_2 , numnotch_2_3 ); //
+biquadFilter lowpass( denlow_2 , denlow_3 , numlow_1 , numlow_2 , numlow_3 ); // EMG envelope
+
+biquadFilter highpass_2( denhigh_2 , denhigh_3 , numhigh_1 , numhigh_2 , numhigh_3);
+biquadFilter notch1_2( dennotch_1_2 , dennotch_1_3 , numnotch_1_1 , numnotch_1_2 , numnotch_1_3 ); // removes 49-51 Hz power interference
+biquadFilter notch2_2( dennotch_2_2 , dennotch_2_3 , numnotch_2_1 , numnotch_2_2 , numnotch_2_3 ); //
+biquadFilter lowpass_2( denlow_2 , denlow_3 , numlow_1 , numlow_2 , numlow_3 ); // EMG envelope
+
+biquadFilter highpass_3( denhigh_2 , denhigh_3 , numhigh_1 , numhigh_2 , numhigh_3);
+biquadFilter notch1_3( dennotch_1_2 , dennotch_1_3 , numnotch_1_1 , numnotch_1_2 , numnotch_1_3 ); // removes 49-51 Hz power interference
+biquadFilter notch2_3( dennotch_2_2 , dennotch_2_3 , numnotch_2_1 , numnotch_2_2 , numnotch_2_3 ); //
+biquadFilter lowpass_3( denlow_2 , denlow_3 , numlow_1 , numlow_2 , numlow_3 ); // EMG envelope
+
+biquadFilter highpass_4( denhigh_2 , denhigh_3 , numhigh_1 , numhigh_2 , numhigh_3);
+biquadFilter notch1_4( dennotch_1_2 , dennotch_1_3 , numnotch_1_1 , numnotch_1_2 , numnotch_1_3 ); // removes 49-51 Hz power interference
+biquadFilter notch2_4( dennotch_2_2 , dennotch_2_3 , numnotch_2_1 , numnotch_2_2 , numnotch_2_3 ); //
+biquadFilter lowpass_4( denlow_2 , denlow_3 , numlow_1 , numlow_2 , numlow_3 ); // EMG envelope
+
+void myController()
+{
+
+ highpass.step (u1);
+ notch1.step (u1);
+ notch2.step (u1);
+ lowpass.step (u1);
+
+ highpass_2.step (u2);
+ notch1_2.step (u2);
+ notch2_2.step (u2);
+ lowpass_2.step (u2);
+
+ highpass_3.step (u3);
+ notch1_3.step (u3);
+ notch2_3.step (u3);
+ lowpass_3.step (u3);
+
+ highpass_4.step (u4);
+ notch1_4.step (u4);
+ notch2_4.step (u4);
+ lowpass_4.step (u4);
+
+}
+
+int main()
+{
+ sample_ticker.attach(&myController,0.002);
+ while (true){
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Oct 16 09:39:22 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file
