A first look at the Olimex EEG-SMT

Last week I ordered and received a small EEG device manufactured by a Bulgarian company called Olimex. Called the EEG-SMT, it is part of the OpenEEG project, and is a small USB device that looks like this:

The Olimex EEG device.

The Olimex EEG device.

It has five audio jacks for connecting custom electrodes. The ground electrode is passive, and the other four electrodes are active and comprise two bipolar channels. The system is very basic, and at around €150 (including the electrodes) is obviously not going to compete with high end multi-channel EEG rigs.  But, I’m interested in running some steady state VEP experiments that can be run with a single channel, and in principle are quite robust to lower signal to noise ratios from lower quality equipment. Given the price, I thought it was worth a shot.

Although there are several PC packages capable of reading data from the device, I ideally want to integrate EEG recording into the Matlab code I use for running experiments. So, I decided to try and directly poll the USB interface.

The first stage was to install a driver for the device. I’m using a Mac running OSX 10.8, so I went with the FDTI virtual COM port driver. I also found it useful to check the device was working with this serial port tool. The driver creates a virtual serial port, the location of which can be discovered by opening a Terminal window and entering:

    ls -l /dev/tty.*

On my machine this lists a couple of bluetooth devices, as well as the serial address of the Olimex device:

    /dev/tty.usbserial-A9014SQP

Matlab has its own tool for polling serial ports (Serial). I was able to read from the device this way, but I found it less flexible than the IOPort function that comes with Psychtoolbox 3. The rest of this post uses that function.

First we open the serial port and give it a handle:

    [h,e] = IOPort(‘OpenSerialPort’,’/dev/tty.usbserial-A9014SQP’);

Then we can set a few parameters, including the baud rate for data transmission, buffer size etc:

    IOPort(‘ConfigureSerialPort’,h,’BaudRate=57600′);
    IOPort(‘ConfigureSerialPort’,h,’BlockingBackgroundRead=0′);
    IOPort(‘ConfigureSerialPort’,h,’InputBufferSize=65536′);
    IOPort(‘ConfigureSerialPort’,h,’PollLatency=0.0039′);

To start recording, we purge the buffer and then send this command.

    IOPort(‘Purge’,h);
    IOPort(‘ConfigureSerialPort’,h,’StartBackgroundRead=1′);

We wait for a while, then we check how much data is waiting for us in the buffer and read it out into a vector:

    WaitSecs(3);
    bytestoget = IOPort(‘BytesAvailable’,h)
    [longdata,when,e] = IOPort(‘Read’,h,1,bytestoget);

Finally, we stop recording, purge the buffer and close the port:

    IOPort(‘ConfigureSerialPort’,h,’StopBackgroundRead’);
    IOPort(‘Purge’,h);
    IOPort(‘Close’,h);

I had some trouble initially streaming data from the device. If you forget to purge the buffer it can cause your entire system (not just Matlab) to hang and restart. This is very annoying, and slows development progress.

Now that we have some data, we need to process it. The vector is a stream of bytes in packets of 17. We can separate it out like this:

    for n = 1:17
        parseddata(n,:) = longdata(n:17:end);
    end

And plot each signal separately:

Outputs from the Olimex serial interface

Outputs from the Olimex serial interface

According to the device’s firmware, the first two plots are control lines that always output values of 165 and 90. This provides an anchor that lets us know the order of the signals. The next plot tells us the firmware version (version 2), and the fourth plot is a sample counter that increases by 1 each time the device samples the electrodes. The sampling happens at a fixed frequency of 256Hz, so 256 samples represent one second of activity. Plots 5-16 are the outputs of the electrodes (this is what we’re interested in), and I don’t really understand plot 17 yet.

Each channel gets 2 bytes (e.g. 16 bits), but only uses 10 of those bits. This means that to get the actual output, we need to combine the data from two adjacent bytes (paired by colour in the above plots). The data are in big-endian format, which means that the first byte contains the most significant bits, and the second byte the least significant. We can combine them by converting each byte to binary notation, sticking them together, and then converting back:

   for l = 1:6
    for m = 1:length(parseddata)
      trace(l,m)  = bin2dec(strcat(dec2bin(parseddata(lineID(l,1),m)),dec2bin(parseddata(lineID(l,2),m))))./1023;
    end
    end

We now have six ten bit signals, which we can plot as follows:

Channel outputs

Channel outputs

Although the waveforms look exciting, they aren’t very informative because most of what we’re seeing is an artefact from the ‘hum’ of AC mains electricity. We can see this if we examine the Fourier spectrum of one of our waveforms:

Example EEG fourier spectrum

Example EEG fourier spectrum

It is clear that much of the energy is concentrated at 0, and at 50Hz. We can remove these using a bandpass filter, that includes only frequencies between (approximately) 1 and 49Hz. Taking the inverse Fourier transform then gives us a more sensible waveform:

Bandpass filtered waveform

Bandpass filtered waveform

Actually though, I’m more interested in what is happening in the frequency domain. This is because I want to run experiments to measure the response of visual cortex to gratings flickering at a particular frequency. However, there are some problems to overcome first. Critically, I don’t understand how the four active electrodes on the device map onto the six channel outputs that I read over the serial connection. They all seem to produce a signal, and my initial thought was that the first four must be the outputs of individual electrodes, and the final two the differences between positive and negative electrodes for channels 1 & 2. As far as I can tell, that isn’t what’s actually happening though. I have posted on the OpenEEG mailing list, so hopefully someone with experience of using these devices will get back to me.

If anyone is interested, I have put a version of the code outlined above here (with a few extra bells and whistles). Note that it may require some modifications on your system, particularly the serial address of the device. You will also need to have Matlab (or maybe Octave), Psychtoolbox and the driver software installed. Finally, your system may hang if there are problems, and I hereby absolve myself of responsibility for any damage, loss, electrocution etc. that results in you using my code. However, I’d be very interested to hear from anyone else using one of these devices!

Advertisements

16 Responses to A first look at the Olimex EEG-SMT

  1. Marcin says:

    have you received an answer from the mailing list?

  2. Hey!
    So we’re a bunch of researchers working with the EEG SMT here in India and we’re basically trying to understand if a human can try to make sense of another’s EEG data(somewhat on the lines of neuro-feedback). Now with respect to how many channels there are, since you have only 4 electrodes I’d venture to say you only have 2 channels as we do. We’re not sure why the design is like this where every 2 electrodes provide 1 channel, especially considering that the DRL is already there to remove noise. Your Matlab code will prove very useful to us since we wanted to actually get the data into Matlab, till now we were looking at it through Brain Bay. So thanks for that! 🙂
    Also I’ve read on many forums that the electrodes that Olimex provide are bad quality(I’m not sure in what sense though) and they recommend a user make their own electrodes.

  3. bakerdh says:

    Hi folks. First, sorry for the delay in replying – I’ve been moving house so have been offline for a bit.

    Yes, I did get some replies from the mailing list. The consensus was that the firmware supports 6 channels, but the device has only two. So, the output of channels 3-6 is probably nonsense and should be ignored. The output of channels 1 & 2 are the potential difference (i.e. voltage) across the + and – electrodes.

    Anyway, I haven’t got much further with the device, as I’ve been using a big 64 channel EEG system for the past few months. But I do intend to revisit it in the summer now that I know a bit more about EEG in general. I’ll post and update if I get useable data from the device.

  4. J.A says:

    is it possible to use this device(eeg-smt) for 16 channels?

  5. Robert says:

    J.A If you search for EEg on ebay or email to this address:
    wholesale8866@gmail.com Their unit does not seem to have an interface to any entrainment software but it will give 16 channel eeg with a QEEG map/display I don’t know how support is so check it out thoroughly before plopping down $1300 (with shipping), but then again it is only $1300 for full 16 channels. If you have some experience in this area it could be a diamond in the rough. The manual is available but the lack of details in that (at least in the English version) is part of what I found to be off putting. Plus I was looking for real time entrainment.

  6. zuhan says:

    Hi.
    I have a problem with the connection device on Win 7 x64. Using this tutorial I https://www.olimex.com/Products/EEG/OpenEEG/EEG-SMT/resources/EEG-SMT.pdf , but have an error in connecting the device. I use BrainBay and Openvive soft for removal of the signal, but soft doesn’t see the device. Go to Device Manager, the device shows as inactive driver update… Help me please to resolve this issue.

  7. tizhbulatov says:

    How is your timing? I’ve tried the device on OS X 10.6 and Linux and in the former case there are really long delays (~0.9 s) that appear periodically. The following plot shows the time intervals between subsequent packets on both OSes http://postimg.org/image/saz2dhtjn/

    I think the problem is in the USB serial driver.

    • tizhbulatov says:

      One more thing. My code waits for the two-bytes sync sequence to detect an incoming packet instead of blindly reading everything from the device. This is what shown on the plot. And on OS X read() from device keeps getting raw data at a more stable rate, it just doesn’t seem to contain the sync sequence.

      • bakerdh says:

        Hi. I’m not actively using this device. I couldn’t get reliable signals out of it so I gave up and started using higher quality hardware. I agree that your problem sounds like it’s probably a serial driver issue, but I’m afraid I don’t have any suggestions of how you could fix it.

      • tizhbulatov says:

        Thanks for reply. I sort of fixed it — just use Linux for now 🙂

  8. […] packages which can be used to capture and analyze the EEG signals. There are experiments with MATLAB but one of most popular software remain BrianBay and OpebVIBE. There are lot of blog posts how […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: