OT: biofeed back Re: Minddrive as input device?
Doug Sutherland
wearable at earthlink.net
Wed Jun 27 15:41:21 EDT 2001
Adrian David Cheok wrote:
> Our lab has a Bio-semi EEG machine 24 channel. I am recognising a
> person's thoughts about color from the EEG waveforms (we can
> recognise red-green-blue so far)
That is really cool! I took some time off last year to explore this
same concept, but didn't get very far. I was able to acquire the raw
EEG data in my own software (on wearable!), and I started some work
on using FFT algorithms for spectral analysis. But response time is
slow with FFT, to get fast response digital filtering is required. I
started looking into how to implement a simple quadrature filter
(butterworth low-pass filter) in software, but then I realized that
this EEG project was just too much work for me to tackle alone.
Adrian, you mentioned that you were able to recognize a person's
thoughts about colors, a few questions on that:
1) Was that automated recognition (ie computer program recognizes
the waveforms) or was it visually observed in recorded data?
2) Are you capturing the EEG data in your own software or are you
using existing software for that?
3) What kind of 'pattern signature' do you see that represents a
person's thought of a specific color? (ie what EEG pattern is
evident?)
4) What kind of data filtering are you doing to recognize these
color thoughts?
5) Can the color recognitions be repeated with different people?
> of course the work is very early, but hoping to be able to control
> a virtual environment in some future work.
Here are a couple of good resources on digital filtering:
- Understanding Digital Signal Processing by Richard Lyons
http://www.amazon.com/exec/obidos/ASIN/0201634678/
- Tony Fisher's Digital Filter Design Page
http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html
I was trying to do just one simple control task like say launching
x-windows or switching on my TV, but I didn't get anywhere close
to what you did with color recognition. But then I was only using
a simple 2-channel EEG with few electrodes, and was a one-man team
just doing this for fun. I'm interested in building another simple
EEG as small as possible, probably just an atmel microcontroller
and operational and instrumentation amps. Using a mult-layer PCB
it could be made very small. Perhaps this wouldn't yield enough
data for control purposes, but it would be interesting for remote
monitoring (ie patient tracking etc). I have included Tom Collura's
brainmaster EEG schematics below, I want them to reach the archives
because I keep mispacing them. Also, on a related note, here is is
an shematic for a simple ECG:
http://www.sciam.com/2000/0600issue/0600amsci.html
-- Doug
Tom Collura's Brainmaster EEG schematics ...
------------------------------------------------------------------------
6/27/99
This note will give you enough information to build a BrainMaster
from commercially available parts. We do not sell parts for this
project, though we will help you in any way we can. We can sell
you a completed, tested unit if you wish. See the details below.
Please note that the latest BrainMaster code and instructions are available
on the ftp site: ftp://brainmaster.com/pub/brainm/rel17. This includes
software and documentation. It also includes the code to write your
own programs using the DLL interface, and there are examples in C, C++,
Pascal, and Visual Basic.
There are also units available from BrainMaster Technologies,
(440) 350-9822 or fax (216) 423-0090. See http://www.brainm.com.
We no longer provide kits, because it is too hard to support the
dubugging, etc. In addition, we now have FDA approval to provide
this as a prescription biofeedback trainer, and therefore we
can only sell the systems complete. If you are a biofeedback
practitioner, we can provide you with an approved system for
clinical neurofeedback training. If you are not a qualified
practitioner, we can sell you a system suitable for EEG monitoring,
education, research, and software development. It provides all
the functions of the clinical system, except the ability to train
EEG for clinical purposes. Both systems are $950 complete.
Now if you want to build it yourself from scratch, see the following:
--------------------------------------------------------------------------
This message contains revised design notes for the EEG amplifier, and
for the 68HC11 software. It effectively replaces the previous notes.
I now have a component layout and wiring diagram for this circuit.
BRAINMASTER
INPUT AMPLIFIER
CIRCUIT DESCRIPTION
Thomas F. Collura, Ph.D., P.E.
tomc at brainmaster.com
draft date: 4/15/98
The amplifier requires a clean, regulated 5V supply.
This can be provided as follows:
___________
__________| |_________________________\ "VSS"
| | 7805 | | | /
____|____ |_________| | |
B1 _____ | __|__ __|__
_________ | C1 _____ C2 _____
_____ | | |
| | | |
|______________|______________|_________|_____\ "GND" "real ground"
/
Component values:
B1: 9V battery, or 6 "AA", "C", or "D" cells
C1: 10uF tantalum
C2: 0.1uF mylar
The Motorola 68HC11 EVBU evaluation board also uses a regulated
5V supply, and it contains a place for a user-supplied 7805 regulator.
Anticipated battery life would be "hours" with the 9V battery,
"a day or so" with the "AA" cells, and "several days" with the "C"
or "D" cells. An line-powered supply of 8 to 12 volts would also work,
but would introduce safety issues. One could alternatively power the system
from e.g. two 9-volt batteries, and eliminate the "AGND" circuit below.
This would also provide more "headroom." But for the design integrated
with the HC11 microprocessor, I have chosen a single 5V supply.
Another alternative is just to run it from a single, unregulated battery.
You would still need the "AGND" circuit below, but no regulator.
This circuit can work from 5V, all the way up to 36V.
The AD620 is an integrated instrumentation amplifier made by Analog
Devices. It is an extremely high quality device, and it beats any
implementation that makes an instrumentation amplifier out of separate
op-amps. No contest. They cost from $6 to $20 apiece, depending
on grade (noise, leakage, etc). The cheapest (AD620A) are just fine,
and are available from distributers, and also Newark, Arrow, maybe
Schweber, etc. I was able to get 4 of them by putting about $30 on
my credit card. I use OP-90's as general-purpose operational
amplifiers, but you could use anything reasonable. I think the OP-07
would also work well.
Overall, this amplifier is several orders of magnitude better than the
HAL, which was a reasonable low-cost design for 1988. But this has
lower noise, lower power consumption, better CMRR, better accuracy,
and a much lower parts count. Even with an 8-bit A/D, this device,
when carefully used, will provide excellent EEG recordings, more than
adequate for experimental, biofeedback, and control applications.
We will need a clean source of 2.0 VDC, to serve as a midpoint between
the supplies, and called "AGND." We also require 4 volts to serve
as the high reference for the A/D converter. The signal range
will be 0-4V, which is a good working range.
VSS
|
\
R0 /
\
/
\
|
|_________________________________\ VRH
| / (4.0V)
| _______________________ to pin P4/52
| | |
\ | ----U---- VSS |
R1 / | __| OP-90 |__ | |
\ | 1| |\ |8 | |
/ |____|_|-\ |____| |
\ 2| | \_ | |
________|________|_|+ / |__|________|____\ "AGND"
| | 3| | / |6 / (2.0V)
| \ __| |/ |____
__|__ R2 / | 4| IC-2 |5
C3 _____ \ | ---------
| / |
| \ |
|________|_____|
|
GND
Component values:
R0: 50K 1% metal film
R1: 100K 1% metal film
R2: 100K 1% metal film
C3: 0.1 uF mylar
To connect this circuit, you must cut a wire trace on the HC11 board.
It is a trace connecting two points, one of them directly above pin 47
on the MCU, and the other one just below and to the right of a "VDD"
label. This wire connects EVBU:R3 to EVBU:C9, creating the built-in
VRH reference. Cut it with a razor blade or Xacto knife. EVBU:R3 is
thus removed from the circuit, but EVBU:C9 remains in for decoupling,
and it connects from the point of VRH, to "real" GND.
Here is Stage 1, the user-connected end.
STAGE 1:
R6
___/\/\/\/\__
C4 | |
INPUT___| |________ | ----U---- | VSS
1 | | | | |_| AD620 |_| |
/ | 1| |\ |8 |
R4\ |_________|_|-\ |____|
/ 2| | \_ |7
| _________|_|+ / |__|_______________\ OUTPUT
C5 GND | 3| | / |6 | / STAGE 1
INPUT___| |________| ___| |/ ref|____/|\_
2 | | | | 4| IC-1 |5 | |
/ | --------- | |
R5\ GND | |
/ R7 | |
\ ___/\/\/\/\_________| |
| | |
USER _________| | C6 |
GND | |_______________| |_____|
GND | | | |
| ----U---- VSS |
| __| OP-90 |__ | |
| 1| |\ |8 | |
|____|_|-\ |____| |
R8 2| | \_ |7 |
AGND _____/\/\/\_____|_|+ / |__|________|
3| | / |6
__| |/ |____
| 4| IC-2 |5
| ---------
|
GND
Component values:
R4: 10M 1% metal film
R5: 10M 1% metal film
R6: 1000 1% metal film
R7 200K 1% metal film
R8 200K 1% metal film
C4: 0.01 uF 2% polypropylene
C5: 0.01 uF 2% polypropylene
C6: 0.1 uF 2% polypropylene
The EEG amplifier provides a total gain of 20,000, thus amplifying
a 200 uV p-p range to 4 volts, with a bandwidth of from 1.7 to 34 Hz.
The input amplifier IC-1 is an Analog Devices AD620 instrumentation
amplifier, set up with a gain of 50. This gets the signal "out of
the noise," and provides high input impedance and high common-mode
rejection. The "AC" coupling due to R4 and C4, or R5 and C5, occurs
with a long time-constant, and does not limit the low-frequency response.
It also does not affect the CMRR, since it is not in the passband.
It does, however, allow the inputs to IC-1 to be biased into the middle
of their common-mode range.
The amplifier IC-2 is used to provide an integrator, used as a
low-pass filter developing the reference for IC-1. This results in a
baseline-correction that produces a low-frequency cutoff at 1.6 Hz.
It also allows the output of IC-1 to operate near its center, providing
good linearity. Some of these concepts are in Collura et. al.,
"Automated offset compensation for DC biopotential measurements,"
Behavioral Research Methods, Inst., and Computers, 1990, 22(1), 13-20.
STAGE 2:
R9 R10
___/\/\/\/\____________/\/\/\/\________
| | |
| | |
AGND | |
| ----U---- |
| __| OP-90 |__ VSS |
| 1| |\ |8 | |
|_____|_|-\ |____| |
2| | \_ |7 | R11
from _______|_|+ / |__|________|__/\/\/\/\______ To HC11
Stage 1 3| | / |6 | A/D input
___| |/ |__ _|_ pin PE2/47 (ch1)
| 4| IC-3 |5 ___ C7 pin PE3/49 (ch2)
| --------- |
| |
GND AGND
Component values:
R9: 1K 1% metal film
R10: 390K 1% metal film
R11: 10K 1% metal film
C7: 0.47 uF 2% polypropylene or mylar
For improved noise performance, place a 0.015 uF capacitor in
parallel with R10.
The second stage provides a gain of 390 and a frequency response to
34 Hz. The first stage is fed to the noninverting input of an Analog
Devices OP-90 operational amplifier. The gain of the amplifier
is set to 390, in the noninverting mode. R10 is where to select
the gain you want, or to put a potentiometer for adjustable gain.
The amplified output can be fed directly to the input port of the A/D
converter of a Motorola 68HC11 single-chip microcomputer/controller.
When sampled with 8 bits, the range of 0.0-4.0 volts is divided into
256 "bins," with a resolution of 0.4 uV per "quantum" or "bin," and
a full-scale range of 103 microvolts. You may prefer e.g. 1/2 the
gain, for 0.8 uV per quantum, and 206 uV range. Clinical diagnostic specs
are typically <0.5 uV/bin, and >1000 uV fullscale. Hey, it's a toy.
Now you can see why 12 bits are required clinically. But a typical
clinical biofeedback system might have a full-scale range of about 250
microvolts, so we're not really out of the ballpark here.
To apply this circuit, you need three (3) body connections, to get one
channel. Two of the electrodes are the inputs: one is "active", or
Grid 1, and the is "indifferent," or Grid 2. These would be somewhere
on the head, where you want to record from. They would tend to be on one
side of the head, and be considered a pair. The amplifier is creating
a differential reading between them, with a gain of 10,000. Any signal
that is common to them, is "bucked out" by the common-mode rejection
ratio, which will be near 100dB. (This is 1000 times better than the HAL!)
The third lead is the "ground return," and can be on the forehead, an
earlobe, or even another part of the body. You could also test the
amplifier by trying to get your heartbeat (EKG) recorded from one hand
to another, for example, too. However, if this lead touches "real"
ground, e.g. a waterpipe, the circuit will fail to operate, since
the AGND level will be "shorted" to ground.
NOTE THAT this does NOT yet isolate the RS-232 from the computer. If
your computer is faulty, and puts 110VAC on the ground line, for example,
this device would NOT protect you. If you do not understand the possible
hazards, or are uncertain, please do not attempt to construct this device.
There are several ways to isolate the device, including simple
optocouplers, or an infrared remote chip set. The Circuit Cellar HAL
has an optocoupled output stage, with its own battery and regulator.
It is reported in Byte, June 1988, 273-285. If you want to optoisolate
your device for safety, use this design. I would be happy to assist
anyone who wants to do this. However, I'd rather design an infrared
remote interface, and I'd welcome input or help on that aspect!
You may purchase a suitable optoisolator from Patton Electronics
voice: (301) 975-1000 fax: (301) 869-9293. e-mail: sales at patton.com
and ask about the Model 590 RS-232 to RS-232 Optical Isolator.
It comes with an external wallmounted power adapter, or it can
be powered by 12VDC @45mA on pin 9 of the DTE.
If you get a board from Flexisupply, the optical isolation is built in,
so that is really the best way to go these days.
The amplifier specifications are as follows:
Type: differential
Inputs: (+), (-), and "ground" return
Gain: 20,000
Bandwidth: 1.7 - 34 Hz
Input Impedance: 10 Mohms
Input Range: 200 uV full-scale
Output Range: 4 volts: from 0.0 to 4.0 volts
Resolution: 0.80 uV/quantum
Input Noise: < 1.0 uV p-p
CMRR: > 100dB
To program the unit, refer to the information in the file "program".
If you have any questions, you may e-mail me at tomc at brainmaster.com
------------------------------------------------------------------------
(C) 1995, 1996, 1997, 1998, 1999 Thomas F. Collura All rights reserved.
You may distribute this document, but you may not alter it,
or charge money for it. Always give credit where credit is due.
------------------------------------------------------------------------
More information about the Wear-Hard
mailing list