A couple of months in the laboratory can frequently save a couple of hours in the library.
And now we have Google 😉 In an attempt to avoid some of that time in the lab lining up a load of analogue filters I was tempted to go DSP, but I lack the DSP smarts to do this in hardware, so I turned to the Big G again. Turns out I didn’t spend enough time in the library.
An EEG has two technical challenges, the hardware of the signal-conditioning amplifiers, and then the display mechanism, which was an analogue filter bank and LEDs in the original Mind mirror, and a computer display afterwards. This is software, and in modern practice this hardware/software division is clear. There has been a lot of open source activity in this field, although as it happens I am still drawn to the retro.
There are two big open source/hardware projects for EEG hardware that I can find. OpenBCI seems to be in the lead with a multichannel board that digitises 16 channels of EEG and sends this via Bluetooth to a computer. There is another one, OpenEEG, which seems to be at least 15 years old. Anybody who still keeps their introductory material in Adobe Flash has clearly not kept up with the times.[ref]The sooner the company Adobe can be stamped into the ground and turned to dust for dreaming up such an evil concept as the Creative Community software rental scam the better IMO. I am glad that the Internet finally picked up the fact Adobe is an insidious protection racket holding your work to ransom and rerouted around it bringing us HTML5 audio and video. Creative Cloud is the epitome of what’s wrong with the damn Cloud. They got you by the goolies,[/ref]
The obvious one to favour is OpenBCI, but there’s one small problem. It’s shockingly expensive. A Cyton + Daisy RF module gives me an impressive 16 channels for about a thousand dollars. In comparison, the Vilistus 4 interface is £650 (£850 with Bluetooth).
Unfortunately in the latter case one has to buy a 1984 DOS looking piece of software for £540, which is apparently the most advanced Mind Mirror program yet. Even if I were a billionaire it would pain me to hand over £540 for something that looks like an old program I wrote for a BBC Micro in the late 1980s tracking galvanic skin resistance. But compared to OpenBCI their hardware is pretty good value.
OpenEEG has the problem of being 10-15 years old. The schematic is from 2003, but pretty much how I would have done it. It doesn’t base it all on a proprietary chip, if I blow the input up the INA114P can be changed out for about £7. It’s available for ~£75 assembled, which is sort of within the groove. I’m kind of up to £200 interested in this, not much more. It’s only two channel. I could get the digital interface for another £50.
So although it’s old, OpenEEG matches my budget and requirements better. There’s not much point in me trying to wrangle the analogue front-end myself, unless I use active electrodes, in which case I can lose the INA114P and I may as well make the analogue back-end LPF of OpenEEG on veroboard
Looks like I am late to the party and EEGMIR from Jim Peters on the openEEG project had largely solved this for me more than 10 years ago. Now I just said a lot of rude things about Vilnius’s most advanced MM software looking fugly, and EEGMIR isn’t a thing of beauty either
but you can’t grouse about the price, if it works 😉 Instant win. Since it runs on Linux it will be Raspberry Pi friendly, in theory, though I have no idea of how much Linux has changed in the intervening 14 years. The nice thing about the Pi is all those GPIO pins – so I can hate on this display all I like, but if I want it to be on LEDs I can do it. And Jim Peters seems to be using IIR filters from the filter description language. I would need to purchase the £50 EEG Digital board or hack a PIC or an Arduino to output the openEEG type 2 serial data format. A 16F88 would probably cope a treat on two channels.
BrainBay’s developer manual describes the openEEG data format thusly:
The P2 Firmware Protocol was the initial transmission protocol of the OpenEEG
project, used by ModularEEG.
P2 uses 17 data bytes to transmit 6 channels of EEG data:
1: sync0; // synchronisation byte 1 = 0xa5
2: sync1; // synchronisation byte 2 = 0x5a
3: version; // version number = 2
4: count; // packet counter. Increases by 1 each packet.
5: Chn1low // channel 1 low byte
6: Chn1high // channel 2 high byte
7: Chn2low // channel 2 low byte
8: Chn2high // …
16: Chn6high // channel 6 high byte
17: switches; // State of PD5 to PD2, in bits 3 to 0.
To actually get timing info you have to get that from the firmware code comment
Packet Format Version 2
17-byte packets are transmitted from the ModularEEG at 256Hz, using 1 start bit, 8 data bits, 1 stop bit, no parity, 57600 bits per second.
Minimal transmission speed is 256Hz * sizeof(modeeg_packet) * 10 = 43520 bps.
Note that data is transmitted in big-endian format.
By this measure together with the unique pattern in sync0 and sync1 it is guaranteed, that re-sync (i.e after disconnecting the data line) is always safe.
and I believe the channels were 10-bit resolution, although the data format allows 16 bits
Big open source display software projects
BrainBay talks the right talk in filter design and is a graphical filter graph sort of application, although mainly using FFT. Bit it runs only on Windows, and I don’t really want to lug a computer around. I could jump over using a Raspberry Pi or suchlike, but not a whole computer. Plus it’s always worrying when the last news item is from over five years ago…
OpenViBE seems more actively developed. And it will run on Linux, so it might run on a Pi. But I get to compile it from source, which is another steep learning curve, so I may stick with the old Open EEG EEGMIR code for starters.