Skip to content

Commit c6f05d8

Browse files
committed
Merge pull request #18 from pushtheworldllc/dev
Fixed module and fixed critical stream error
2 parents a21b1da + 7d60747 commit c6f05d8

13 files changed

+795
-238
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ node_modules
3030
.idea
3131
.DS_Store
3232
public
33+
34+
# Test output files
35+
myOutput.txt
36+
37+
# Local npm builds for testing end in .tgz
38+
*.tgz

.npmignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
test/
2+
test_mocks/
3+
4+
# MIRRORED FROM .gitignore PLEASE MAINTAIN
5+
logs
6+
*.log
7+
pids
8+
*.pid
9+
*.seed
10+
lib-cov
11+
coverage
12+
.grunt
13+
.lock-wscript
14+
build/Release
15+
node_modules
16+
.idea
17+
.DS_Store
18+
public
19+
myOutput.txt
20+
*.tgz

README.md

Lines changed: 107 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,61 @@ To stop the simulator:
9898
ourBoard.simulatorStop()
9999
```
100100

101+
Impedance (signal quality)
102+
--------------------------
103+
Measuring impedance is a vital tool in ensuring great data is collected.
104+
105+
* **Good** impedance is < 5k Ohms
106+
* **Ok** impedance is 5 to 10k Ohms
107+
* **Bad** impedance is > 10k Ohms
108+
109+
To test for impedance we must apply a known test signal to which either the P, N, or both channels and then apply a little math.
110+
111+
When you start measuring for electrode impedance's, a new additional property called `impedanceArray` (indexed 1,2,3,4,5,6,7,8), can be found on the sample object from the emitted by 'sample'.
112+
113+
**Note: You must be streaming in order to measure impedance's. Takes up to 2 seconds to start measuring impedances.**
114+
115+
To start measuring all channels impedance's:
116+
```js
117+
var ourBoard = new require('openbci-sdk').OpenBCIBoard();
118+
ourBoard.connect(portName).then(function(boardSerial) {
119+
ourBoard.on('ready',function() {
120+
ourBoard.impedanceTestStartAll().then(() => {
121+
ourBoard.streamStart();
122+
});
123+
ourBoard.on('sample',function(sample) {
124+
/** Do normal Sample actions */
125+
if(sample.impedanceArray) {
126+
/** Work with impedance array */
127+
}
128+
});
129+
});
130+
}).catch(function(err) {
131+
/** Handle connection errors */
132+
});
133+
```
134+
135+
To stop measuring impedance's:
136+
```js
137+
ourBoard.impedanceTestStopAll();
138+
```
139+
140+
To apply the test signal to a specific input of a specific channel (i.e. Channel 2 test signal applied to P input and not N input):
141+
```js
142+
ourBoard.impedanceTestStartChannel(2,true,false);
143+
```
144+
145+
To stop applying the test signal to a specific channel (i.e. Stop applying signal to channel 2):
146+
```js
147+
ourBoard.impedanceTestStopChannel(2);
148+
```
149+
150+
To stop calculating impedance's every time there is a new sample:
151+
```js
152+
ourBoard.impedanceTestCalculatingStop();
153+
```
154+
You would call `.impedanceTestCalculatingStop()` if you were measuring the impedance for a specified channel. You do NOT need to call `.impedanceTestCalculatingStop()` after calling `.impedanceTestStopAll()` because it is called for you.
155+
101156
Auto-finding boards
102157
-------------------
103158
You must have the OpenBCI board connected to the PC before trying to automatically find it.
@@ -126,7 +181,7 @@ Reference Guide
126181

127182
### OpenBCIBoard (options)
128183

129-
Create new instance of an OpenBCI board on `portName`.
184+
Create new instance of an OpenBCI board.
130185

131186
**_options (optional)_**
132187

@@ -238,6 +293,50 @@ A number specifying which channel you want to get data on. Only 1-8 at this time
238293

239294
**_Returns_** a promise, fulfilled if the command was sent to the board and the `.processBytes()` function is ready to reach for the specified channel.
240295

296+
### .impedanceTestStartAll()
297+
298+
To apply test signals to all the channels and all inputs on an OpenBCI board.
299+
300+
**Note, you must be connected in order to set the test commands. Also this method can take up to 2 seconds to send all commands!**
301+
302+
**_Returns_** a promise, fulfilled once all the commands are sent to the board.
303+
304+
### .impedanceTestStopAll()
305+
306+
To stop applying test signals to all the channels and inputs on an OpenBCI board.
307+
308+
**Note, you must be connected in order to set the test commands. Also this method can take up to 2 seconds to send all commands!**
309+
310+
**_Returns_** a promise, fulfilled once all the commands are sent to the board.
311+
312+
### .impedanceTestStartChannel(channelNumber,pInput,nInput)
313+
314+
To apply the impedance test signal to an input for any given channel.
315+
316+
**_channelNumber_**
317+
318+
A number specifying which channel you want to get apply the test signal to. Only 1-8 at this time.
319+
320+
**_pInput_**
321+
322+
A bool true if you want to apply the test signal to the P input, false to not apply the test signal.
323+
324+
**_nInput_**
325+
326+
A bool true if you want to apply the test signal to the N input, false to not apply the test signal.
327+
328+
### .impedanceTestCalculatingStart()
329+
330+
To start calculating impedance's every time there is a new sample.
331+
332+
**Note, this is automatically called by `.impedanceTestStartAll()` and `.impedanceTestStartChannel()`**
333+
334+
### .impedanceTestCalculatingStop()
335+
336+
To stop calculating impedance's every time there is a new sample.
337+
338+
**Note, this is automatically called by `.impedanceTestStopAll()`**
339+
241340
### .numberOfChannels()
242341

243342
Get the current number of channels available to use. (i.e. 8 or 16).
@@ -346,13 +445,17 @@ ourBoard.write('o');
346445

347446
## Events
348447

448+
### .on('query', callback)
449+
450+
Emitted resulting in a call to `.getChannelSettings()` with the channelSettingsObject
451+
349452
### .on('ready', callback)
350453

351-
### .on('sample', callback)
454+
Emitted when the board is in a ready to start streaming state.
352455

353-
### .on('query', callback)
456+
### .on('sample', callback)
354457

355-
Emitted resulting in a call to `.getChannelSettings()` with the channelSettingsObject
458+
Emitted when there is a new sample available.
356459

357460
## Dev Notes
358461
Running

0 commit comments

Comments
 (0)