[EEG] Boards interfaced, data displayed (err, noise displayed)

Josh Myer josh at joshisanerd.com
Sun Apr 19 14:47:43 PDT 2009

(Sorry to have to phone it in, but, at least this meeing, I've got
something to phone in!)

My other project took a day off yesterday, so I spent the day on
Fourier transforms and interfacing to OpenEEG boards.  Mitch was kind
enough to leave some working OpenEEG kit in my care while he's gone,
which has been incredibly helpful.  Based on Jonathon's email (thank
you!) I wrote some ruby to capture from a serial dongle yesterday

Last night and this morning I built a quick combinaton scope and
spectrum analyzer using OpenGL (and FFTW for FFTs).

Admittedly, I don't have any electrodes, so I'm left only looking at
noise, but, it's working!  Now we have our own minimalist stack to
interface with the board and examine output in real-time, totally open
all the way down.  (I'd like to go GPLv2 if nobody has objections, but
that's a discussion for another day.)

I've got some more work to do here, but will be leaving the boards and
other equipment on my shelf at noisebridge sometime this week or early
next, so others can use them.  (I feel responsible for this equipment,
and it's not mine, so please be really careful!)

I also took the liberty of registering a "mindbridge" project at
google code.  If you want to check it out:

  The nigh-useless homepage: http://code.google.com/p/mindbridge/

  SVN checkout instructions:
svn checkout http://mindbridge.googlecode.com/svn/trunk/ mindbridge-read-only

I'd love to add other people to run the group, so ping me if you want
write access.  You'll need a google account, which is slightly
unpleasant, but, honestly, sourceforge has been too painful the last
few times I tried to use it*.

To reproduce my results: in that checkout, there's a noodling/
directory.  It contains, not surprisingly, noodlings.  The important
ones are:

  * serial.rb : a ruby decoder for the format, which outputs channel
                1's reading on stdout.  You'll need Ruby/SerialPort:
                ('apt-get install libserialport-ruby' on ubuntu)

                You may also need to edit the serial port it's
                pointing at.

  * glscope.cpp : an OpenGL/GLUT-based oscilloscope and spectrum
                  analyzer.  It's really, really rough around the
                  edges, but works.  You'll need libfftw3 and 
                  libglut to build this one:
                    FFTW: http://www.fftw.org/download.html
                    GLUT: I really dunno, sorry.  It's usually there.

                  ('apt-get install freeglut3-dev libfftw3-dev')

                  You can then just 'make glscope' hopefully.

In grand unix fashion, glscope is designed to take either serial
output from serial.rb or test output, to make sure it's working okay.
To use test output:

  ./gen_data.rb | ./glscope

To use the real serial port:

  ./serial.rb | ./glscope

And, if you want to use your own test generation stuff, go for it!
glscope expects inputs in the range -1000,1000, floating point.  It
should be possible to export some datasets that are publicly available
and feed them into the program in this fashion.

http://sccn.ucsd.edu/~arno/fam2data/publicly_available_EEG_data.html )

Things to do:

 * glscope needs cleaned up.  Right now, it's all bailing wire and
   chewing gum.  Tasty.

 * I like the two-piece architecture, with an interface program and a
   boring analysis program, but it's one-channel ATM.  Need to expand
   to allow multiple channels of input.  I'm thinking of making it
   networked and broadcast, which allows multiple people to run their
   own analyses on the same live data stream, as well as capturing it
   for offline analysis.

 * The fftw3_run.c program has the ability to reconstruct waveforms
   from the FFT coefficients.  We can then zero out coefficients not
   in each band, and break down to just alpha/beta/etc waves and
   display those on the scope as well.  What else would we need for
   neurofeedback work with this device?

 * Trodes and an enclosure!

Happy hacking!
Josh Myer   650.248.3796
  josh at joshisanerd.com

More information about the EEG mailing list