Skip to content

Commit 491f0ce

Browse files
authored
add support for mentalab devices (#542)
* initial commit for mentalab devices Signed-off-by: Andrey Parfenov <a1994ndrey@gmail.com>
1 parent 0914f98 commit 491f0ce

File tree

24 files changed

+904
-101
lines changed

24 files changed

+904
-101
lines changed

csharp_package/brainflow/brainflow/board_controller_library.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ public enum BoardIds
104104
BRAINALIVE_BOARD = 40,
105105
MUSE_2016_BOARD = 41,
106106
MUSE_2016_BLED_BOARD = 42,
107-
PIEEG_BOARD = 43
107+
PIEEG_BOARD = 43,
108+
EXPLORE_4_CHAN_BOARD = 44,
109+
EXPLORE_8_CHAN_BOARD = 45
108110
};
109111

110112

docs/SupportedBoards.rst

+110
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Supported platforms:
3232
- Windows >= 8.1
3333
- Linux
3434
- MacOS
35+
- Devices like Raspberry Pi
3536

3637
By default it generates new timestamps and stops at the end of the file. You can override it using commands:
3738

@@ -79,6 +80,8 @@ Supported platforms:
7980
- Windows >= 8.1
8081
- Linux
8182
- MacOS
83+
- Devices like Raspberry Pi
84+
- Android
8285

8386
In methods like:
8487

@@ -110,6 +113,7 @@ Supported platforms:
110113
- Windows >= 8.1
111114
- Linux
112115
- MacOS
116+
- Devices like Raspberry Pi
113117
- Android
114118

115119
OpenBCI
@@ -144,6 +148,7 @@ Supported platforms:
144148
- Windows >= 8.1
145149
- Linux
146150
- MacOS
151+
- Devices like Raspberry Pi
147152

148153
**On MacOS there are two serial ports for each device: /dev/tty..... and /dev/cu..... You HAVE to specify /dev/cu.....**
149154

@@ -179,6 +184,7 @@ Supported platforms:
179184
- Windows >= 8.1
180185
- Linux
181186
- MacOS
187+
- Devices like Raspberry Pi
182188

183189
**On MacOS there are two serial ports for each device: /dev/tty..... and /dev/cu..... You HAVE to specify /dev/cu.....**
184190

@@ -201,6 +207,7 @@ Supported platforms:
201207
- Windows >= 8.1
202208
- Linux
203209
- MacOS
210+
- Devices like Raspberry Pi
204211

205212
**On MacOS there are two serial ports for each device: /dev/tty..... and /dev/cu..... You HAVE to specify /dev/cu.....**
206213

@@ -254,6 +261,7 @@ Supported platforms:
254261
- Windows >= 8.1
255262
- Linux
256263
- MacOS
264+
- Devices like Raspberry Pi
257265
- Android
258266

259267
CytonDaisy with WIFI Shield
@@ -279,6 +287,7 @@ Supported platforms:
279287
- Windows >= 8.1
280288
- Linux
281289
- MacOS
290+
- Devices like Raspberry Pi
282291
- Android
283292

284293
NeuroMD
@@ -430,6 +439,7 @@ Supported platforms:
430439
- Windows
431440
- Linux
432441
- MacOS
442+
- Devices like Raspberry Pi
433443

434444
*Note: On Windows you may need to disable firewall to allow broadcast messages.*
435445

@@ -455,6 +465,7 @@ Supported platforms:
455465
- Windows
456466
- Linux
457467
- MacOS
468+
- Devices like Raspberry Pi
458469

459470
*Note: On Windows you may need to disable firewall to allow broadcast messages.*
460471

@@ -479,6 +490,7 @@ Supported platforms:
479490
- Windows
480491
- Linux
481492
- MacOS
493+
- Devices like Raspberry Pi
482494

483495
*Note: On Windows you may need to disable firewall to allow broadcast messages.*
484496

@@ -554,6 +566,7 @@ Supported platforms:
554566
- Windows
555567
- Linux
556568
- MacOS
569+
- Devices like Raspberry Pi
557570

558571
Muse
559572
------
@@ -822,6 +835,10 @@ Supported platforms:
822835
- Windows
823836
- Linux
824837

838+
Available commands:
839+
840+
- Set sampling rate: :code:`board.config_board("sampling_rate:500")`, for available values check docs from Ant Neuro.
841+
825842
For more information about Ant Neuro boards please refer to their User Manual.
826843

827844

@@ -852,6 +869,7 @@ Supported platforms:
852869
- Windows
853870
- Linux
854871
- MacOS
872+
- Devices like Raspberry Pi
855873

856874
Steps to find MAC address:
857875

@@ -898,3 +916,95 @@ Supported platforms:
898916
- MacOS 10.15+
899917
- Linux, compilation from source code probably will be needed
900918
- Devices like Raspberry Pi
919+
920+
921+
Mentalab
922+
---------
923+
924+
.. csv-table:: Required inputs
925+
:header: "Board", "Board Id", "serial_port", "mac_address", "ip_address", "ip_port", "ip_protocol", "other_info", "timeout", "serial_number", "file", "preset", "master_board"
926+
927+
"Explore4Channels", "BoardIds.EXPLORE_4_CHAN_BOARD (44)", "-", "Optional: MAC adress", "-", "-", "-", "-", "-", "-", "-", "-", "-"
928+
"Explore8Channels", "BoardIds.EXPLORE_8_CHAN_BOARD (45)", "-", "Optional: MAC adress", "-", "-", "-", "-", "-", "-", "-", "-", "-"
929+
930+
Explore 4 Channels Board
931+
~~~~~~~~~~~~~~~~~~~~~~~~~
932+
933+
.. image:: https://live.staticflickr.com/65535/52349031632_51bc8ea56c.jpg"
934+
:width: 500px
935+
:height: 334px
936+
937+
`Mentalab website <https://mentalab.com/>`_
938+
939+
To choose this board in BoardShim constructor please specify:
940+
941+
- board_id: 44
942+
- Optional: mac address field of BrainFlowInputParams structure
943+
944+
Supported platforms:
945+
946+
- Windows
947+
- Linux
948+
- MacOS
949+
- Devices like Raspberry Pi
950+
951+
**On Linux in order to compile and use it you may need to install :code:`libbluetooth-dev` for Debian like systems and :code:`bluez-libs-devel` for Fedora like.**
952+
953+
Available :ref:`presets-label`:
954+
955+
- *BrainFlowPresets.DEFAULT_PRESET* contains EEG data
956+
- *BrainFlowPresets.AUXILIARY_PRESET* contains Gyro and Accel data
957+
- *BrainFlowPresets.ANCILLARY_PRESET* contains battery and temperature data
958+
959+
Steps to find MAC address:
960+
961+
- On Windows: open device manager, navigate to explore device, click properties and select Bluetooth Address
962+
- On Linux: install bluez-utils and run :code:`bluetoothctl paired-devices`
963+
- On MacOS: run :code:`system_profiler SPBluetoothDataType`
964+
965+
Steps to connect:
966+
967+
- Enable device and Pair it with your laptop using bluetooth settings
968+
- Ensure that blue LED is blinking before calling :code:`board.prepare_session()`
969+
- If you see green LED probably you need to reboot a devce
970+
971+
Explore 8 Channels Board
972+
~~~~~~~~~~~~~~~~~~~~~~~~~
973+
974+
.. image:: https://live.staticflickr.com/65535/52349031632_51bc8ea56c.jpg"
975+
:width: 500px
976+
:height: 334px
977+
978+
`Mentalab website <https://mentalab.com/>`_
979+
980+
To choose this board in BoardShim constructor please specify:
981+
982+
- board_id: 44
983+
- Optional: mac address field of BrainFlowInputParams structure
984+
985+
Supported platforms:
986+
987+
- Windows
988+
- Linux
989+
- MacOS
990+
- Devices like Raspberry Pi
991+
992+
**On Linux in order to compile and use it you may need to install :code:`libbluetooth-dev` for Debian like systems and :code:`bluez-libs-devel` for Fedora like.**
993+
994+
Available :ref:`presets-label`:
995+
996+
- *BrainFlowPresets.DEFAULT_PRESET* contains EEG data
997+
- *BrainFlowPresets.AUXILIARY_PRESET* contains Gyro and Accel data
998+
- *BrainFlowPresets.ANCILLARY_PRESET* contains battery and temperature data
999+
1000+
Steps to find MAC address:
1001+
1002+
- On Windows: open device manager, navigate to explore device, click properties and select Bluetooth Address
1003+
- On Linux: install bluez-utils and run :code:`bluetoothctl paired-devices`
1004+
- On MacOS: run :code:`system_profiler SPBluetoothDataType`
1005+
1006+
Steps to connect:
1007+
1008+
- Enable device and Pair it with your laptop using bluetooth settings
1009+
- Ensure that blue LED is blinking before calling :code:`board.prepare_session()`
1010+
- If you see green LED probably you need to reboot a devce

java_package/brainflow/src/main/java/brainflow/BoardIds.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ public enum BoardIds
5454
BRAINALIVE_BOARD (40),
5555
MUSE_2016_BOARD (41),
5656
MUSE_2016_BLED_BOARD (42),
57-
PIEEG_BOARD (43);
57+
PIEEG_BOARD (43),
58+
EXPLORE_4_CHAN_BOARD (44),
59+
EXPLORE_8_CHAN_BOARD (45);
5860

5961
private final int board_id;
6062
private static final Map<Integer, BoardIds> bi_map = new HashMap<Integer, BoardIds> ();

julia_package/brainflow/src/board_shim.jl

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export BrainFlowInputParams
5050
MUSE_2016_BOARD = 41
5151
MUSE_2016_BLED_BOARD = 42
5252
PIEEG_BOARD = 43
53+
EXPLORE_4_CHAN_BOARD = 44
54+
EXPLORE_8_CHAN_BOARD = 45
5355

5456
end
5557

matlab_package/brainflow/BoardIds.m

+2
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,7 @@
4848
MUSE_2016_BOARD (41)
4949
MUSE_2016_BLED_BOARD (42)
5050
PIEEG_BOARD (43)
51+
EXPLORE_4_CHAN_BOARD (44)
52+
EXPLORE_8_CHAN_BOARD (45)
5153
end
5254
end

python_package/brainflow/board_shim.py

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class BoardIds(enum.IntEnum):
6464
MUSE_2016_BOARD = 41 #:
6565
MUSE_2016_BLED_BOARD = 42 #:
6666
PIEEG_BOARD = 43 #:
67+
EXPLORE_4_CHAN_BOARD = 44 #:
68+
EXPLORE_8_CHAN_BOARD = 45 #:
6769

6870

6971
class IpProtocolTypes(enum.IntEnum):
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import argparse
2+
import time
3+
4+
from brainflow.board_shim import BoardShim, BrainFlowInputParams, BrainFlowPresets, BoardIds
5+
from brainflow.data_filter import DataFilter
6+
7+
8+
def main():
9+
BoardShim.enable_dev_board_logger()
10+
parser = argparse.ArgumentParser()
11+
parser.add_argument('--mac-address', type=str, help='mac address', required=False, default='')
12+
args = parser.parse_args()
13+
14+
params = BrainFlowInputParams()
15+
params.mac_address = args.mac_address
16+
board = BoardShim(BoardIds.EXPLORE_4_CHAN_BOARD, params)
17+
board.prepare_session()
18+
board.start_stream()
19+
# important: for explore device config board has to be after start stream
20+
# board.config_board('sampling_rate:500')
21+
# board.config_board('test_signal:1') # 1 is a bitmask represented as int not channel num
22+
time.sleep(20)
23+
data_eeg = board.get_board_data(preset=BrainFlowPresets.DEFAULT_PRESET)
24+
data_orn = board.get_board_data(preset=BrainFlowPresets.AUXILIARY_PRESET)
25+
data_env = board.get_board_data(preset=BrainFlowPresets.ANCILLARY_PRESET)
26+
board.stop_stream()
27+
board.release_session()
28+
29+
print(data_eeg)
30+
print(data_orn)
31+
print(data_env)
32+
DataFilter.write_file(data_eeg, 'data_eeg.csv', 'w')
33+
DataFilter.write_file(data_orn, 'data_orn.csv', 'w')
34+
DataFilter.write_file(data_env, 'data_env.csv', 'w')
35+
36+
37+
if __name__ == "__main__":
38+
main()

rust_package/brainflow/src/ffi/constants.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl BoardIds {
3232
pub const FIRST: BoardIds = BoardIds::PlaybackFileBoard;
3333
}
3434
impl BoardIds {
35-
pub const LAST: BoardIds = BoardIds::PieegBoard;
35+
pub const LAST: BoardIds = BoardIds::Explore8ChanBoard;
3636
}
3737
#[repr(i32)]
3838
#[derive(FromPrimitive, ToPrimitive, Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -84,6 +84,8 @@ pub enum BoardIds {
8484
Muse2016Board = 41,
8585
Muse2016BledBoard = 42,
8686
PieegBoard = 43,
87+
Explore4ChanBoard = 44,
88+
Explore8ChanBoard = 45,
8789
}
8890
#[repr(i32)]
8991
#[derive(FromPrimitive, ToPrimitive, Debug, Copy, Clone, Hash, PartialEq, Eq)]

src/board_controller/board_controller.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "cyton_daisy_wifi.h"
3333
#include "cyton_wifi.h"
3434
#include "enophone.h"
35+
#include "explore.h"
3536
#include "freeeeg32.h"
3637
#include "galea.h"
3738
#include "galea_serial.h"
@@ -241,6 +242,12 @@ int prepare_session (int board_id, const char *json_brainflow_input_params)
241242
case BoardIds::PIEEG_BOARD:
242243
board = std::shared_ptr<Board> (new PiEEG (params));
243244
break;
245+
case BoardIds::EXPLORE_4_CHAN_BOARD:
246+
board = std::shared_ptr<Board> (new Explore (board_id, params));
247+
break;
248+
case BoardIds::EXPLORE_8_CHAN_BOARD:
249+
board = std::shared_ptr<Board> (new Explore (board_id, params));
250+
break;
244251
default:
245252
return (int)BrainFlowExitCodes::UNSUPPORTED_BOARD_ERROR;
246253
}

0 commit comments

Comments
 (0)