Category Archives: EEG

Improved touch-proof enclosure for OpenBCI

While assembling the touch-proof enclosure for the OpenBCI Cython/Ganglion biosensing amplifier boards, I realized that with the board in the middle of the enclosure, there is little space for the Dupont wires connecting the pins of the OpenBCI to the touch-proof connectors. Trying to squeeze the board in place, some of the solder joints broke off. After repeatedly re-soldering the wires to the connectors, I was able to get it all properly in place. However,  this was definitely a design flaw.

I designed a new version that has the OpenBCI PCB board rotated by 45 degrees and shifted a bit to the corner. This gives more space for the wires and reduces the stress on the joints. Here you can see the new enclosure printed for a 4-channel Ganglion board.

OpenBCI touch-proof enclosure version 3 – with the PCB board in the corner

Compared to the previous one for the Cython, the difference is also in the colour of the connectors: I used 4 pairs of red and blue connectors for each bipolar channel, one black connector for ground, and one blue connector as the common reference. Using the 4 channels (i.e. the red connectors) relative to the common reference requires toggling the micro-switches on the Ganglion PCB board. Using a common reference is handier for EEG measurements, whereas the bipolar configuration is convenient for ECG/EMG, but with some extra electrodes also works fine for EEG. The Cython version has 8 red connectors, one blue connector for the reference, and one black connector for ground.

Another change is aesthetic; thanks to the nice post and configuration files from Rainer I figured out how to 3D print with multiple colours. I updated the Fusion 360 design of the enclosure to include the EEGsynth logo. The logo is embedded in blue and white in the black background of the box.

logo embedded in the 3D-printed enclosure

The 3D design can be downloaded from Thingiverse.
.

Touch-proof enclosure for OpenBCI

The OpenBCI Cyton and Ganglion boards are open hardware and maker-friendly biosensing systems. Although there are alternatives, such as Bitalino and OpenEEG and some companies and/or projects are currently working on new hardware (see e.g. EEG.io), the OpenBCI boards are in my opinion at this moment still the best.

The maker-friendlyness of the OpenBCI boards is somehow also a disadvantage: the OpenBCI systems come as bare PCB boards with a Dupont-style header. OpenBCI (the company) focusses on using it in combination with dry electrodes mounted in a 3D printed headset. I personally don’t value dry electrodes that much; I don’t see the problem with a little bit of gel in the participants hair, and I don’t like the pressure needed on dry electrodes to provide a decent signal. Electrodes with gel or Ten20 paste usually provide better and more robust signal quality. However, it depends on the situation: dry (or saline, like the Emotiv Epoc) electrodes are great if you quickly want to swap the EEG system from one participant to the other.

For the 1+1=3 performances using the EEGsynth setup, we not only use EEG recorded from the scalp, but also EMG recorded from muscle and ECG recordings from the heart. The standard in research and clinical applications is to use touch-proof connectors, technically known as DIN 42802 connectors. These are available in many versions, such as cup electrodes for EEG and snap electrodes for EGC and EMG.

The Dupont-style headers are ubiquitous in the Arduino scene, therefore I previously designed an 8-channel head-mounted system based on a sweat band with the amplifier mounted at the back. It is comfortable and works quite well during performances, but it is still a bit fragile, especially when replacing the battery (see below). Furthermore, after prolonged use the gold-plating of the electrodes wears off, and replacing the electrodes is a hassle. The advantage of touch-proof connector is that it is much easier to switch between different types (cup versus stick-on) and to replace worn-out electrodes. I guess this is also one of the motivations for OpenBCI also selling a Touch Proof Electrode Adapter. Connecting the adapter to the correct pins of the 11×2 header is not trivial, and results in a relatively fragile and bulky setup, i.e. not ideal in demonstrations/performances where I want stuff to be robust.

Another issue that I have with the OpenBCI boards is that they use a two-pin JST connector to connect the LiPo battery to the board. These JST connectors are not designed for frequent connect/disconnect cycles. To disconnect the battery for recharging, you have to pull the cable and I have accidentally pulled off the header from the cable more than once…

Based on these experiences I decided to make an enclosure for the OpenBCI boards that is robust in performance/demonstration settings, that uses touch-proof connectors so that it can be used with EEG/EMG/ECG equally well, that is compatible both with the Cyton and Ganglion, and that includes an easy to charge LiPo battery.

The 8-channel Cyton board exposes a lot of the flexibility of the ADS1299 analog frontend like common reference versus bipolar, and normal ground versus active bias, but I typically use it with a common reference and the normal ground. Consequently it needs 10 connectors (8x active, REF, GND). The Ganglion board has 4 channels and can be configured with jumpers for either unipolar and bipolar reference schemes. It hence needs 6 (4x active + common REF + GND) electrode connectors, or 9 (4x active + 4x bipolar REF + GND) electrode connectors. An enclosure design with 10 connectors (4x active, 4x bipolar REF, 1x common REF and 1x GND) therefore supports both reference schemes for the Ganglion.

The external dimensions of the enclosure are 100x100x30 mm. The height is needed for the 10 connectors, but also has the advantage that it should be possible to mount a WiFi shield on top of the board.

The internals of the enclosure are shown here. At the top you see a 850 mAh LiPo battery, connected to a LiPo charger/protector module with micro-USB connector. The on/off switch is this one and the LED is 5 mm diameter. I used a RGB LED, since that was the only that I had available, but I am only using a single color (green) connected through 470 Ohm resistor to the on/off switch. Both the OpenBCI board inside and the lid are secured with 2.5 mm screws. I purchased the touch-proof connectors from Medcat; these are actually the most expensive component of the enclosure.

Here you can see it with the OpenBCI board mounted, but still without the leads between the OpenBCI header and the touch-proof connectors.

The 3D design for the enclosure can be downloaded in STL format or as Fusion 360 project from ThingiVerse.

First steps with a €20 single-channel EEG system

My friend Vladimir recently demonstrated a single-channel EEG system that he got at a hackathon in London. When he mentioned that it only costs €20 (or actually 20 GBP to be more precisely) I immediately decided to order one myself. The ICI-BCI system is a low cost open source brain computer interface.

The bag clearly and rightfully indicates that it is a totally experimental system, and that it should be used with caution.

The basic idea of the amplifier is that it takes an 1000 Hz analog audio signal from the computer or mobile phone, which is amplitude modulated by the ExG signal and subsequently fed back as microphone signal. So the system is fully analog and requires the DAC to be done by the audio input of the computer or phone.

Continue reading

EEG combined with VR

We recently had a meeting at the Astron radio telescope for the COGITO project with Daniela de Paulis, Stephen Whitmarsh, Guillaume Dumas and others. One of the goals of that meeting was to try out the combination of the EEG system with the Oculus Rift VR system.

For the COGITO project we are using the GTec Nautilus EEG system. Our specific system comprises of a 32-channel wireless amplifier that mounts on the back of the EEG cap, in combination with EEG caps in three different sizes. The caps have 64 holes at a subset of the  locations of the 5% electrode placement standard. We are not using the “Sahara” dry electrode option, but rather the regular wet electrodes.

We started by removing all electrodes and cups from the cap, to get a clear view on which electrode sites are accessible. The central electrode locations (i.e. the z-line), temporal electrode locations and occipital electrode locations are occluded by the VR head mount. But there are still plenty of electrode locations accessible.

Continue reading

Raspberry Pi as Eurorack synthesizer module

Processing realtime EEG data from the OpenBCI system requires software running on a computer. For the EEGSynth project we do the rapid application development using the platforms that we are most familiar with, i.e. standard laptops and the FieldTrip toolbox, which is based on MATLAB. However, in the end we want to implement as much as possible using affordable and open hardware and software. Hence we opted for the Raspberry Pi, a credit card–sized single-board computer. It runs Linux, which makes it easy to use standard programming platforms and interfaces such as Python and Redis to implement the software stack.

In the first EEGSynth studio performance you can see Stephen in the middle, operating the MATLAB-based GUI for the EMG/EEG processing, and Jean-Louis at the back operating the synthesizer. The goal of the technological development is to put Jean-Louis completely in control and to make the interface of the EEG synthesizer as similar as his other modular synthesizer modules. Hence the need for fitting the Raspberry Pi into a Eurorack synthesizer case.

Here you can see some photo’s from the construction of the front panel.

2015-11-14 15.32.52 2015-11-14 16.30.57

The front plate has holes for the various interface ports to interface with the Raspberry Pi. For a sturdy mount I glued a section of L-profile rails to the front plate.

2015-11-14 21.36.36

After mounting the Raspberry Pi, I connected the HDMI and audio port with a short cable to the front panel.

DSC_0061

Here you can see the Raspberry Pi in the Eurorack case, next to the power supply.

DSC_0084

The Nike EEG headband

Together with Stephen Whitmarsh and friends I have embarked on the EEGSynth project, which aims to bridge science, technology and art by making an EEG-based synthesizer. The EEGSynth project relies on the realtime functionality in our FieldTrip toolbox, although it will probably also be linked to other software platforms.

I am lucky to have one of the first Jinga-Hi JAGA16 wireless EEG systems, which I think is the the smallest and most portable EEG system in existence at the moment. Although the primary application of that system is not for human EEG, it actually is perfectly suited for wireless BCI and neurofeedback applications as well. I am combining this system with standard (clinical and research) EEG cup electrodes. Using a glob of Ten20 electrode paste you can stick them to the scalp. Having some of these electrodes on my head and trying to connect this bunch of long wires to the tiny JAGA16 wireless EEG amplifier resulted in the question how to make a comfortable and robust system for electrode attachment.

I came up with the idea to use an elastic sports headband. This allows to attach the wireless amplifier to the head, and consequently the electrode wires would be channeled along the headband. Here you can see the components that I started with (minus the EEG amplifier):

2015-05-19 21.09.54

The headband is one that I picked up in a local sports shop. It consists of a sleeve of flexible fabric that  is relatively thin. At the placed where the fabric needed puncturing, I used some iron-on interfacing to strengthen it and prevent the holes from further tearing.

2015-05-19 21.51.46

This is the end result, which includes 8 electrodes for the EEG and 2 for the ground and reference.

2015-05-19 23.53.52

Soldering the electrode leads to the miniature connector was the hardest task. The 18 pin (arranged as 9×2) connector is only 12 mm wide, which means that for each pin there is only about 1.2 mm space.

Note that the PCB board with the yellow wrapping is actually  the full 16 channel wireless amplifier. It is powered by a (cell-phone type) LiPo battery, which is as large as the EEG system. Data is transmitted over Wifi and can be streamed and analysed in MATLAB or Python using  FieldTrip.

2015-05-19 23.54.20

Here I am, wearing the first prototype electrode headband. Two electrodes (ground and reference) go behind the ears, the other eight electrodes are approximately placed at F3, F4, C3, C4, P3, P4, FCz and CPz. The wifi EEG amplifier and the battery can conveniently be tucked away in the two flaps at the back.

2015-05-20 16.16.22

First steps to realtime EEG and BCI on Raspberry Pi

I just compiled the FieldTrip realtime EEG interface on the Raspberry Pi. The code compiled out of the box, not a single line of code needed to be changed thanks to the existing cross-platform support for the old Apple PPC-G4 and the Neuromag HPUX-RISC MEG system. Streaming data to and from the FieldTrip buffer over TCP/IP works like a charm.

I’ll add my binaries for the Raspberry Pi to the regular FieldTrip release.

The next step will be to compile some of the EEG acquisition drivers, e.g. for OpenEEG and BrainVision.

Eventually it would be nice to also get BCI2000 to work on the Pi. According to Juergen large parts of BCI2000v3 should compile on the ARM… I look forward to gving it a try.

Average reference for dipole fitting

Here is a question that I get asked occasionally. I have slightly edited the question and my answer to it, which both were posted to the EEGLAB email discussion list.

Question: I’m using EEGLAB-DIPFIT to localize independent components using the spherical head model. Apparently the software requires the data to use the average reference. Why is this?

Answer: In principle you could use an arbitrary reference in your source reconstruction. The practical reason to use an average reference over the sampled electrodes in source estimation is that this prevents the solution to be biassed due to forward modelling errors at the reference electrode. Let me give a partially intuitive, partially mathematical explanation.

Assume that you would use left mastoid as reference. That would mean that the measured value “V” at each electrode “x” is V_x, so the list of all measured values in the N channels is
V_C3-V_M1
V_Cz-V_M1
V_C4-V_M1

V_M1-V_M1 (this is zero)
V_M2-V_M1

Those values can be modeled using the source model and the volume condution model. Now, lets assume a spherical volume conduction model. That is especially inaccurate for low electrodes, and the bony structure of the mastoid is definitely not modelled appropriately in a spherical model. So for the model potential “P” we would have the value at each of the N electrode also referenced to the model mastoid
electrode:
P_C3-P_M1
P_Cz-P_M1
P_C4-P_M1

P_M1-P_M1 (this is zero)
P_M2-P_M1

The source estimation algorithm tries to minimize the quadratic error between model potential distribution and the measurement, so the error term to be minimized is
Total_Error
= sum of quadratic error over all channels
= [(V_C3-V_M1)-(P_C3-P_M1)]^2 + ….
= [(V_C3-P_C3)-(V_M1-P_M1)]^2 + …. (here the terms are re-ordered)

So for each channel the error term consists of a part that corresponds to the potential at the electrode of interest, plus a part that corresponds to the reference electrode. The error term corresponding to the reference electrode is identical over all channels (i.e. repeats in each channel), hence for each channel you are adding some error term for the reference electrode. Therefore, the minimum error (“minimum norm”) solution will be one that especially tries to minimize the model error at the reference electrode (since that is included N times). In the case of a mastoid reference we know that there is a large volume conductor model error at M1, hence the source solution would mainly try to minimize that error term. The result would be that the source solution would be biassed, because it tries to reduce the (systematic) error at the reference.

The solution is to use an average reference (average over all measured electrodes). That implicitely assumes that the model error over all electrodes is on average zero, hence the minimum norm solution is not biassed towards a specific reference electrode.

PS the maths in my explanation above are rather sloppy, but the argument still holds for a more elaborate mathematical derivation which would assume the forward model inaccuracies are uncorrelated over electrode sites.

High-density EEG electrode placement

Some time ago we wrote an article on electrode placement for high-resolution EEG measurement (referred to as the 5% article). After its apearance I have noticed that there is a demand for a concise and methodological overview of electrode placement systems. With this page I want to share some of my knowledge on this subject. This page contains non-technical comments on the different standards for electrode placement. Continue reading

EEGLAB workshop

From 17-19 September 2005, the second EEGLAB workshop will be held in Porto, Portugal. I will be giving a lecture on the use of the DIPFIT plugin (i.e. dipole analysis of ICA components). The new version 2 of the DIPFIT plugin will be introduced during he workshop, which means that the link between Fieldtrip and EEGLAB is finally official. For more information about the workshop, you can look here. For more information about the relation between FieldTrip and EEGLAB, you can look here and here.