-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Sahil142002/main
versioning and announcement bar
- Loading branch information
Showing
417 changed files
with
6,770 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ | |
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...ioAmp-Software/Brain-BioAmp-Arduino-Firmware/1_FixedSampling/1_FixedSampling.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
Fixed Sampling - BioAmp EXG Pill | ||
https://github.com/upsidedownlabs/BioAmp-EXG-Pill | ||
|
||
Upside Down Labs invests time and resources providing this open source code, | ||
please support Upside Down Labs and open-source hardware by purchasing | ||
products from Upside Down Labs! | ||
|
||
Copyright (c) 2021 Upside Down Labs - [email protected] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
|
||
```js | ||
#define SAMPLE_RATE 125 | ||
#define BAUD_RATE 115200 | ||
#define INPUT_PIN A0 | ||
|
||
|
||
void setup() { | ||
// Serial connection begin | ||
Serial.begin(BAUD_RATE); | ||
} | ||
|
||
void loop() { | ||
// Calculate elapsed time | ||
static unsigned long past = 0; | ||
unsigned long present = micros(); | ||
unsigned long interval = present - past; | ||
past = present; | ||
|
||
// Run timer | ||
static long timer = 0; | ||
timer -= interval; | ||
|
||
// Sample | ||
if(timer < 0){ | ||
timer += 1000000 / SAMPLE_RATE; | ||
int sensor_value = analogRead(INPUT_PIN); | ||
Serial.println(sensor_value); | ||
} | ||
} | ||
|
||
``` |
99 changes: 99 additions & 0 deletions
99
docs/BioAmp-Software/Brain-BioAmp-Arduino-Firmware/2_EEGFilter/2_EEGFilter.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
EEG Filter - BioAmp EXG Pill | ||
https://github.com/upsidedownlabs/BioAmp-EXG-Pill | ||
|
||
Upside Down Labs invests time and resources providing this open source code, | ||
please support Upside Down Labs and open-source hardware by purchasing | ||
products from Upside Down Labs! | ||
|
||
Copyright (c) 2021 Upside Down Labs - [email protected] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
```js | ||
|
||
#define SAMPLE_RATE 256 | ||
#define BAUD_RATE 115200 | ||
#define INPUT_PIN A0 | ||
|
||
|
||
void setup() { | ||
// Serial connection begin | ||
Serial.begin(BAUD_RATE); | ||
} | ||
|
||
void loop() { | ||
// Calculate elapsed time | ||
static unsigned long past = 0; | ||
unsigned long present = micros(); | ||
unsigned long interval = present - past; | ||
past = present; | ||
|
||
// Run timer | ||
static long timer = 0; | ||
timer -= interval; | ||
|
||
// Sample | ||
if(timer < 0){ | ||
timer += 1000000 / SAMPLE_RATE; | ||
float sensor_value = analogRead(INPUT_PIN); | ||
float signal = EEGFilter(sensor_value); | ||
Serial.println(signal); | ||
} | ||
} | ||
|
||
// Band-Pass Butterworth IIR digital filter, generated using filter_gen.py. | ||
// Sampling rate: 256.0 Hz, frequency: [0.5, 29.5] Hz. | ||
// Filter is order 4, implemented as second-order sections (biquads). | ||
// Reference: | ||
// https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html | ||
// https://courses.ideate.cmu.edu/16-223/f2020/Arduino/FilterDemos/filter_gen.py | ||
float EEGFilter(float input) { | ||
float output = input; | ||
{ | ||
static float z1, z2; // filter section state | ||
float x = output - -0.95391350*z1 - 0.25311356*z2; | ||
output = 0.00735282*x + 0.01470564*z1 + 0.00735282*z2; | ||
z2 = z1; | ||
z1 = x; | ||
} | ||
{ | ||
static float z1, z2; // filter section state | ||
float x = output - -1.20596630*z1 - 0.60558332*z2; | ||
output = 1.00000000*x + 2.00000000*z1 + 1.00000000*z2; | ||
z2 = z1; | ||
z1 = x; | ||
} | ||
{ | ||
static float z1, z2; // filter section state | ||
float x = output - -1.97690645*z1 - 0.97706395*z2; | ||
output = 1.00000000*x + -2.00000000*z1 + 1.00000000*z2; | ||
z2 = z1; | ||
z1 = x; | ||
} | ||
{ | ||
static float z1, z2; // filter section state | ||
float x = output - -1.99071687*z1 - 0.99086813*z2; | ||
output = 1.00000000*x + -2.00000000*z1 + 1.00000000*z2; | ||
z2 = z1; | ||
z1 = x; | ||
} | ||
return output; | ||
} | ||
|
||
``` |
Binary file added
BIN
+33.1 KB
docs/BioAmp-Software/Brain-BioAmp-Arduino-Firmware/2_EEGFilter/EEGFilter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions
32
docs/BioAmp-Software/Eye-BioAmp-Arduino-Firmware/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app |
58 changes: 58 additions & 0 deletions
58
.../BioAmp-Software/Eye-BioAmp-Arduino-Firmware/1_FixedSampling/1_FixedSampling.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
Fixed Sampling - BioAmp EXG Pill | ||
https://github.com/upsidedownlabs/BioAmp-EXG-Pill | ||
|
||
Upside Down Labs invests time and resources providing this open source code, | ||
please support Upside Down Labs and open-source hardware by purchasing | ||
products from Upside Down Labs! | ||
|
||
Copyright (c) 2021 Upside Down Labs - [email protected] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
```js | ||
#define SAMPLE_RATE 125 | ||
#define BAUD_RATE 115200 | ||
#define INPUT_PIN A0 | ||
|
||
|
||
void setup() { | ||
// Serial connection begin | ||
Serial.begin(BAUD_RATE); | ||
} | ||
|
||
void loop() { | ||
// Calculate elapsed time | ||
static unsigned long past = 0; | ||
unsigned long present = micros(); | ||
unsigned long interval = present - past; | ||
past = present; | ||
|
||
// Run timer | ||
static long timer = 0; | ||
timer -= interval; | ||
|
||
// Sample | ||
if(timer < 0){ | ||
timer += 1000000 / SAMPLE_RATE; | ||
int sensor_value = analogRead(INPUT_PIN); | ||
Serial.println(sensor_value); | ||
} | ||
} | ||
``` |
102 changes: 102 additions & 0 deletions
102
docs/BioAmp-Software/Eye-BioAmp-Arduino-Firmware/2_EOGFilter/2_EOGFilter.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
EOG Filter - BioAmp EXG Pill | ||
https://github.com/upsidedownlabs/BioAmp-EXG-Pill | ||
|
||
Upside Down Labs invests time and resources providing this open source code, | ||
please support Upside Down Labs and open-source hardware by purchasing | ||
products from Upside Down Labs! | ||
|
||
Copyright (c) 2021 Upside Down Labs - [email protected] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
```js | ||
|
||
#define SAMPLE_RATE 75 | ||
#define BAUD_RATE 115200 | ||
#define INPUT_PIN A0 | ||
|
||
|
||
void setup() { | ||
// Serial connection begin | ||
Serial.begin(BAUD_RATE); | ||
} | ||
|
||
void loop() { | ||
// Calculate elapsed time | ||
static unsigned long past = 0; | ||
unsigned long present = micros(); | ||
unsigned long interval = present - past; | ||
past = present; | ||
|
||
// Run timer | ||
static long timer = 0; | ||
timer -= interval; | ||
|
||
// Sample | ||
if(timer < 0){ | ||
timer += 1000000 / SAMPLE_RATE; | ||
float sensor_value = analogRead(INPUT_PIN); | ||
float signal = EOGFilter(sensor_value); | ||
Serial.println(signal); | ||
} | ||
} | ||
|
||
// Band-Pass Butterworth IIR digital filter, generated using filter_gen.py. | ||
// Sampling rate: 500.0 Hz, frequency: [74.5, 149.5] Hz. | ||
// Filter is order 4, implemented as second-order sections (biquads). | ||
// Reference: | ||
// https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html | ||
// https://courses.ideate.cmu.edu/16-223/f2020/Arduino/FilterDemos/filter_gen.py | ||
|
||
|
||
float EOGFilter(float input) | ||
{ | ||
float output = input; | ||
{ | ||
static float z1, z2; // filter section state | ||
float x = output - 0.02977423*z1 - 0.04296318*z2; | ||
output = 0.09797471*x + 0.19594942*z1 + 0.09797471*z2; | ||
z2 = z1; | ||
z1 = x; | ||
} | ||
{ | ||
static float z1, z2; // filter section state | ||
float x = output - 0.08383952*z1 - 0.46067709*z2; | ||
output = 1.00000000*x + 2.00000000*z1 + 1.00000000*z2; | ||
z2 = z1; | ||
z1 = x; | ||
} | ||
{ | ||
static float z1, z2; // filter section state | ||
float x = output - -1.92167271*z1 - 0.92347975*z2; | ||
output = 1.00000000*x + -2.00000000*z1 + 1.00000000*z2; | ||
z2 = z1; | ||
z1 = x; | ||
} | ||
{ | ||
static float z1, z2; // filter section state | ||
float x = output - -1.96758891*z1 - 0.96933514*z2; | ||
output = 1.00000000*x + -2.00000000*z1 + 1.00000000*z2; | ||
z2 = z1; | ||
z1 = x; | ||
} | ||
return output; | ||
} | ||
|
||
``` |
Binary file added
BIN
+204 KB
docs/BioAmp-Software/Eye-BioAmp-Arduino-Firmware/2_EOGFilter/EOG-Demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+33.8 KB
docs/BioAmp-Software/Eye-BioAmp-Arduino-Firmware/2_EOGFilter/EOGFilter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.