OpenEEG
Sound Card EEG

(very rough draft)

From the Soundcard EEG document
http://openeeg.sourceforge.net/doc/hw/sceeg.html
, it seems like the major difficulty now is getting analog hardware to
FM modulate the signal with enough precision.

Have you ever considered AM modulating the signal instead ?

Here’s the simplest thing that I think could possibly work
(please tell me if I’m missing something obvious).

0,+1 Unbalanced square wave AM modulation:

The voltage at the electrode is multiplied by one op-amp by (say) +1000.

A clock running at 1 KHz or so (10 KHz ?) controls a switch
(perhaps one of
$ 0.55 CD74HCT4066E IC SWITCH QUAD BI-LAT 14-DIP
$ 0.50 SN74HC4066N IC QUAD BI-LAT ANALOG SW 14-DIP
Digi Key prices as of 2005-05-13
).
For the first half of each 1 ms cycle ( 100 us cycle ?) , the switch
connects the input of the sound card to ground.
For the remaing half of each cycle, the switch connects the sound card
to the output of the op-amp.

For example, if the input is a constant -1.6 mV, the output is a
square wave -1.6 V, 0 V, -1.6 V, 0 V, etc., which goes into the sound
card.
The 20 Hz to 20 KHz bandpass filter in the sound card converts that to
a -0.8 V, +0.8 V, -0.8 V, +0.8 V square wave.

Software decoding of unbalanced square wave modulation:
The software looks for regularly-spaced (more-or-less) flat spots (in
theory, it could automatically determine the clock frequency)—those
are the times when the sound card was connected to ground, and the
sharp edges of transitions.
The software chops the signal up into a bunch of 1 ms pieces, each one
starting with the 0.5 ms when the sound card was connected to ground,
followed by the 0.5 ms when the sound card was connected to the op-amp.

The software averages the first 0.5 ms to get the “average DC offset”
(These would each be +0.8 V in the example).
Then it averages the rest of each piece (the last 0.5 ms) to get the
“raw input value”, then subtracts the “average DC offset” of that
piece from the “raw input value” of that piece to get the absolute
(relative to DC ground) input value of the whole piece. We get a
single “absolute input value” for each 1 ms piece, at 1 KHz sampling
rate. (Those values would all be -1.6 V in the example).

You could downsample that 1 KHz signal even further—reducing clumps
of 4 consecutive values to a single average value, to get a 250 Hz
signal.

Does that make any sense ? I think it’s really simpler than I’m making
it sound. I wish it were simpler for me to give you a sketch a picture
of the schematic and the expected waveforms.


David Cary
http://wiki.asiaquake

The problem with AM is that we need to get the signal through an isolation port of some type. FM doesn’t care about harmonic distortion in the optocoupler, but AM would. The circuit on Alternative Hardware has some interesting circuitry for linearizing an optocouple by using an identical opto in the feedback path, which could be useful for that. The major problem we’re having with the FM version is crosstalk between the modulators, which I think is just the power supply PCB layout. – Jon

Current status

Andreas and I have been working on the Sound Card EEG.

I’ve built the FM modulator section and run test waveforms through it and demodulated the WAV files with Jim Peters’ demodulation program in C. The demodulation program itself gets 0.01% THD+N with computer-generated waveforms, and 0.7% THD+N with the same waveforms squashed to look more like the Sc EEG output (generated by a non-linear optocouple in photovoltaic mode). So the demodulator software is solid. I would like a realtime version, though, as the command-line after-the-fact interface is awkward and takes forever to do a simple test. I don’t know much about the EEG software people are currently using, but I wish I could look at the output in realtime and tweak the demod settings and stuff for the best signal. Can anyone help?

I’m getting numbers like 0.38% THD+N for the actual modulator being used from sound card back into sound card (my soundcard is a nice 24-bit Indigo IO).

There are still problems with crosstalk from channel to channel, though, which I believe is entirely in the power supply’s PCB layout, and the modulators tend to “lock up” to each other. I would like to get all the bugs worked out of the modulator before building the electrodes and such, but I haven’t been on it lately; sorry.

As I pointed out on Alternative Hardware, there are all-in-one audio-to-USB solutions that might be useful to some people, in combination with the modulator circuit.

- Jon