EEG Open Source hardware and software search

A couple of months in the laboratory can frequently save a couple of hours in the library.

Frank Westheimer

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).

£540? You have to be kidding, right?

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 // …
9: Chn3low
10: Chn3high
11: Chn4low
12: Chn4high
13: Chn5low
14: Chn5high
15: Chn6low
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.

15 thoughts on “EEG Open Source hardware and software search”

  1. Hi Richard!

    Since I don’t want to jeopardize your blog, I follow this post now.

    You’re a hard worker! Thank you, that’s a lot of information!

    I know about EEGMIR since at least 2010. I didn’t pay too much attention because I was looking for the hardware solution. Besides he does not follow exactly the frequencies of the MM, and I also had doubts if the filters he uses, model those of the MM. Finally I had not enough time to try it.
    From what I red in several sites, IIR seems to give trouble sometimes. Don’t know if its the case here.

    I think that the use of simple ugly interfaces is a consequence of the real time processing and also slow serial communication, but honestly I did not study this deep enough.

    Anyway, I just create a fresh SD card for the RPi 3, and tried to compile the program. First I’ve got a few problems to install the prerequisites, namely the SDL now version 2. Then I’ve got an error compiling the “device.c”, which implement the serial port. Tomorrow I’ll try to solve the issue if I can, and will tell you the result.

    About your Note 1, “thumbs up”! I thought I was the only one to hate the Cloud. :-)))



    1. Hi Mike,

      Interesting that you’ve known EEGmir for a while, I’ve only just come across it. I wonder why it fizzled out? There seemed to be a small number of leading lights, perhaps life got in the way and the group was too small.

      I managed to beat the program into submission to open up on a Raspberry Pi B+ last night. In Googling about I got the feeling that on the Pi 3 the serial port was allocated to the Bluetooth interface. You’re probably on the right track in that I may be short of processing power which the Pi3 is much better on. Bluetooth connection isn’t such a terrible idea to galvanically isolate the Pi and downstream gear from your head so you have a win on that front. BT serial boards are to be had on ebay from China for a couple of dollars. You may have a second serial port on the GPIO – I had to change mine in eegmir.cfg and it came up OK

      Re the filters the obvious differences are the frequency discrepancy, which you could fix in eegmir.cfg, and the use of Butterworth profiles. I will ask Jim Peters if it’s OK to get this on Github (he has GPL2-ed the code) in which case I can chase down the IIR filter code and shift the poles to get a Bessel resonse. Williams has the analogue coefficients for that. I am happy with the bilinear transformation of the s plane to the z plane, I recall that from my MSc and it should give the same response in a sampled-data system subject to the limitations of sampling and truncation errors.

  2. Hi Richard!

    I’m afraid I’ve got bad news for you.

    As a start, let me tell you that my expertise was in mainframes and old languages like COBOL, PL/I, Assembler 360/370… that being said, I found a very hard task if not impossible to compile both EEGMIR and OpenViBE.
    It takes ages on the RPi, have enormous amount of dependencies, and many errors.
    I choose SDL 2.0 for EEGMIR and there are several differences between versions beeing the worst, the way this one deals with the keyboard, with a large portion of code to be rewriten; I don’t know if it would work with the previous version, perhaps I will try that, one of this days.
    As for the OpenViBE, besides the immense number of dependencies that I solve, I’ve got unexpected code errors wich I’m not sure if I can correct.

    Assuming that the compilation is successful, we still have to see if it works as expected.

    A C++ expert is needed here to redesign this into an up to date object oriented program. Anyone?

    That’s all for now.



  3. Sorry, I didn’t refresh the page and did not see your last answer.

    You mean the program worked in your Pi? Waoooo! The executable gives me an error and does not start, as I said previously, building did not work… I use the RPi 3 with last version of software. Bad luck or shame on me!

    I also thougth the same about BT. I knew there are two pins available, but did not expect the clock problem anyway, if not using the BT it is possible to swap.

    I wish you keep on the good work, thanks!



    1. The program did worked OK, as far as I can see. I am now looking at getting a PIC 16F88 to give me six channels of ADC in OpenEEG2 format so I can inject signals into it. It ran on a Pi B+ and on a Pi 2. You will have less aggravation on the serial port

      NOTE FOR RASPBERRY PI 3: The Raspberry pi 3 has changed things around a bit: ttyAMA0 now refers to the serial port that is connected to the bluetooth. The old serial port is now called ttyS0. So if you have an RPI3, everywhere you see “ttyAMA0” below, you should read “ttyS0”.

      and ttyS0 is what is already coded into eegmir.cfg

      I’m impressed by your chutzpah in taking on openvibe too! I’m with Sun Tzu on that, fight on as few fronts as possible.

      Jim Peters has some interesting filter programs which do the bilinear transformation

      and generates the filters at runtime with fidlib

      which implies the filtering can be got at, at a later stage

      He references Tony Fisher, who has interesting stuff on

      but mindful of Sun Tzu, that’s for another day 😉

  4. Well I’m quite impressed about your “About” I just red, and feel that we share many viewpoints.

    You may also user serial0:

    I’m very grateful to you for sharing so much, and if I tried to build both programs it was just to give back something. Unfortunately my math skills are quite modest, so I do what I can in my area, and expected better results this time. The problem with these programs is that people does not want to “reivent the wheel”, use a lot of libraries developed by others, and also go multi-platform. There’s nothing wrong about it, unless you need to optimize the performance. Take the RPi for instance, it has a quad core processor, it is possible to execute parallel floating point operations, but to take advantage of the capabilities and go fully multithreading you need specialized programs.
    We could get more power for the Pi with the RISC OS, but we have the programming problem again.

    Did you build the program or just run the executable? What is your SDL version?

    Since a boy, I’m fascinated about many things mainly in areas like electronics, psicology, yoga, hypnosis, works of Robert Pavlita, ESP, PK , OOB experiences, etc… Although I got a few positive evidences, I miss scientific ways to allow for repeatedness and proof. That’s the reason I found Cade and the Mind Mirror. On my path there’s also an initiation on MT and readings about scientific studies they did thru COSPARS, a tool to show the coherence between both brain hemispheres during the meditative state. I glimpse here a parallel with the works of Cade, Anna Wise, and others. I’ve got the Anna’s books, but I miss the physical evidence of the MM, and I start to dig for an alternative because of the unjustifiable price.
    I believe they did a great work, but to follow their steps we need the exact equipment and filters.

    May Sun Tzu be with you… and specially with me! :-)))



    1. Wow, you’re one heck of a lot faster than I am with the software 😉 I first installed SDL 2 and when it gave no dice I figured perhaps 14 years ago it was SDL1.2 so I installed that too. That was the magic win for me.

      I got into a lot that strange stuff way back, heard about the Mind Mirror in the early 1980s and always fancied one. I always thought it a tragedy that the Dragon Project seemed to come out with a null result. When I started work at the telco research labs I was doing filters in a big way, though most of it was using Williams and Anatol Zverev’s Handbook of filter synthesis.

      I also see the parallels with Cade’s work and some of the wider consciousness stuff. from a psychology angle also a fan of Jung’s approach, I find it a better map for my experience of the world that others, though of course we may all experience it differently so all need different maps. I certainly find it tough to stomach the thesis that consciousness is an emergent function of physical complexity which seems all the rage. But what the heck, each to their own, I’m sure materialist rationalists would say it’s all terror management theory at work. But playing with this is fun, and you have to turn the old grey matter over every so often 😉

      I’ve mainly read Cade and Coxhead’s The Awakened Mind, although I managed to bag a copy of Blundell’s The Meaning of EEG which has more tech specs of the Mind Mirror. I’d love to get hold of some of the MM recordings from those sessions if they exist, but parsing the lost data format would be tough.

      It’s a terrible shame OpenEEG died a death. OpenBCI looks good but it’s dear, certainly for just messing about with, and it is tied to that proprietary chip AFAICS, whereas OpenEEG seems more general purpose hardware.

  5. Hi again Richard!

    I just built the program with SDL 1.2 and it’s working! I only had to add a semi-colon on one of the files, because the compiler complained. I found the display of “downey.dat” quite odd, with strong low freq spots and several changes in intensity from the left to the right hemisphere, but since I never saw other real displays… perhaps its a normal behavior. :-\

    I also built BWView which uses the same library SDL 1.2, is interesting, works smoothly, but (there is allways a but), works with FFT…

    I don’t know when this SDL 1.2 library will go backlevel, but till then… we are happy.

    I still think the OpenViBE is very complicated, with too many dependencies. I always support the KISS statement whenever possible: Simple is beautiful!

    Just in case it is helpful, I recently made a few tests with the MCP3426 for a friend, connecting the Pi 3 thru I2c, and it works like a charm using the PIGPIO.

    UR QSA IS 5-9 ;-))

    TNX QSO 73

    Mike QRT

  6. Sorry, since you dig so deep in the files I thought you have it. :-))
    I googled based on the information from the config file. It´s only a start, but I believe it is useful.
    Here it is:
    The other one I couldn’t find.
    I’m not trying to be fun, but you already know that you have to press the functions keys to see other things than the log file, don’t you?! Took me 10 minutes to find it. “If everything else fails… read the manual”!

    Reading the example I also get sporadic data errors, but it could be just a result of cuts in the input.



    1. Hehe – I cover ground, but not deeply. Hey, I needed Google and John to show me where to stick the semicolon.

      However, I have good news for you. My PIC 16F88 has got a real live signal into this program and it works fine. No data errors, it’s responsive to the signal, and I am quite impressed with Jim Peters’ error trapping because I stuffed all sorts of wrong signal formats into the serial port and while it groused it never crashed. That’s all on a Pi 2 so you should be well away on a Pi 3. It’s a shame I have to look at it via an old-skool baseband composite video monitor, but it works.

      I never saw the log file. Perhaps it auto starts that if present? I was warmed up to the F2 keys from the config, you can set these up for the different responses and filter banks there. What had me going was how to get out of the program – that’s the escape key, not q or x or even Ctrl-C, Ctrl-Y and so forth 😉

  7. Hi Richard!

    What about this program?
    The “but”? It only runs in Windows, but happily even in the good old XP.

    Olimex has also the EEG-SMT. It’s a cheaper solution and accept their electrodes directly. I know that it’s not so easily repaired in case of a failure, but I believe it’s an alternative to be considered…



    1. The Olimex device is the right price, and should be compatible with eegmir (and brainbay, even if they did list the openEEG protocol wrong). The OpenEEG ADC had a pretty slack antialiasing filter which is why I’m looking at re-engineering that, and I’m still hoping to use active electrodes. But it’s not a bad choice to get something going if you’re in a hurry, the price is hardly a deal-breaker!

    1. That does look interesting on the hardware front. Looking at the software manual, however, I couldn’t see how to put the filter bank in there.

      It’ll be a few months before I can recommission my lab after the redecorating, but so far I still favour the OpenEEG ADC with improved filter for the simple reason that it’ll work straight off the bat with the old software that will do the Mind Mirror filtering. The old MM with it’s less than 32 level display was a 5 bit system at best (OK that’s in the display domain rather than the signal domain) so I figure OpenEEG’s 10 bit signal domain limitation isn’t really a problem, and the fact FIview works on the Pi is a definite plus!

      However, someone with more talent at software than me would be able to get at the plugin end of the opensignals interface and run the filtering and display. At my current level of knowledge I’d have to do it with a hardware or software data protocol converter to OpenEEG and run FIview 😉

Leave a Reply to richard Cancel reply

Your email address will not be published. Required fields are marked *