EEG Schematic

•August 15, 2008 • 8 Comments

Alright, so here it is! Finally, after all that experimentation, it all boils down to this. As of now, this schematic incorporates only ONE EEG channel measured by an INA118, which is then fed to an inverting amplifier followed by a Fliege Filter (cut off frequency is set at 33.86 Hz). I previously used a dual supply to power the circuit, but with the help of TLE2426, I’ve been able to use just a single +5V supply (which comes from a 7805 connected to a 9V battery). If you have any questions at all, feel free to post here or email me at:

teknomage's EEG schematic

EEG schematic

For the electrodes, I got good results by replacing the gel layers in medical electrodes (already used) with sponges soaked in warm saline water.

Future plans:

  • Precision analog multiplexer to expand this circuit into 8 or more EEG channels
  • Using this circuit for neuro feedback – specifically Alpha & Theta training

In case you’d like to read more about creating your own EEG circuit, check out Solson’s EEG page. He’s got some neat info on his EEG hardware as well as on Neuro-feedback.

By the way, I’ve also been working on a circuit that kinda replicates the results that you can get from Dr. Robert Becker’s Brain Tuner. You can read more about the Brain Tuner here. basically incorporates Cranial Electro Stimulation at very low currents. In my version of this device, I’ve programmed a PIC 16F628A to generate specific sinewave frequencies (very low Hz) followed by a low DC current that suddenly switches polarity at the required moment to place the user in a light alpha state. More on this later…

Why doncha PIC on someone yer own size!

•April 27, 2008 • Leave a Comment

April 27, 2008

Well, there’s been a whole lotta heavy experimenting goin on, but i just haven’t found the time to post what I’ve been up to. First things first… the LTC clocked filter was a total flop, so I had to incorporate a 4 stage Sallen Key filter (wonder if you love & hate analog like i do)… Later, I switched to a Fliege filter. Results are pretty clean (for now)… And there’s more to come in the Bio-signal front…

…In the meanwhile, I was also working on setting up a decent Serial Data Logger (opto-isolated, no less). Can’t mess around with your life when it comes to recording bio-signals… so the best way to go is definitely optoisolation. Anyways, I played around with the 8 bit, 8 channel ADC 0809 coupled with the USART 6402 and MAX232 plus 6N139 (for the optoisolation of course). It was all a miserably failed attempt. And I’m glad it failed… coz I found an easier way to get the signals logged.

Enter PIC 16F73 (or 76 or 876… you take your PIC ;-) ) . I had already created a custom-made Serial Data Logger software in Visual Basic and it was designed for 8 bit sampling ranging from 1200 bps to 57600 bps. I didn’t want to rewrite the code for 10 bit sampling, so I just stuck with the 16F7X series instead of the 87X series. Well, once you decide on your PIC, you obviously need to have a programmer. Prior to this, I made a cute l’il programmer for 16F628A, but it wasn’t a generic programmer… so I had to build another one from scratch.

The programmer I chose was a modified version of the famous JDM programmer. The good thing about this progger is that you can use it for most PICs ranging from 8 to 28 pins. Please check out the links below if you wanna build yourself a highly affordable generic PIC programmer:

Link1: http://www.stmental.net/~dfoster/dmf_picprog/

Link2 (for the original JDM progger): http://users.tpg.com.au/btkelly/jdm_b.htm

Note: There is a small correction to be made in the schematic at Link1. The Drain and Source of the MOSFET as shown in the diagram need to be reversed. I learnt this the hard way. Everything else in the schematic is A-OK.

Here’s a pic of the modified JDM Progger I made myself (couldn’t find a 28-pin ZIF, so had to use a 40 pin socket instead)

After plenty of coding an recoding and tweaking and twisting, I finally managed to get a decent output from the PIC. Since it has an inbuilt ADC as well as a UART, it made my job MUCH easier. The only thing I had to get was a 20 Mhz crystal to run the PIC, but after that, everything just worked perfectly (almost… still get a couple of glitches in the output… will have to iron them out soon).

Here’s a snapshot of data sampled by the PIC and fed to the computer via the Serial port. Say Hi! to my very own Serial Data Logger software:

Serial data logger

The beauty about this software i wrote is the flexibility. My favorite part is choosing the number of channels… a corresponding number of data display frames are automatically created and I can view each multiplexed channel separately in its own frame.

Here’s a picture of the Opto-isolation section of the Data Logger circuit. You can’t see the chips clearly, but those are MAX232 and 6N139 along with 7805 for power supply regulation.

Max 232 with 6N139

On the output side of the 6N139, the MAX232 and 6N139 are powered by a cable that runs directly from my PC’s own power supply. I used the 9V terminal from the PC supply and regulated it with 7805. If you dont wanna use the regulator, you could always use the 5V terminal from your PC’s power supply connectors instead.

On the input side of the 6N139, everything is powered by a 9V battery (regulated to 5V by another 7805). This ensures that your bio-signal end is galvanically separated from your PC.

And for the finale, here’s a pic of the PIC 16F73. The serial output from the PIC goes to the input of 6N139. I segmented the two parts, so that I could experiment and fine tune each one separately first…

PIC 16f73 - ADC with UART

Stay tuned for more updates. The next time I blog here, it’ll be all about putting this entire mess together and just hoping that it all works like a charm :-) )

Filter, o Filter… where art thou?

•April 27, 2008 • Leave a Comment

December 02, 2007

Filters… I’ve always had an aversion for analog filters especially the multiple stage Butterworth types… So, i thought i’d try to use an alternative. Enter LTC1063… a 5 stage Butterworth filter all included in a single chip that only requires an external RC to set its cutoff frequency. I was so excited at first, coz I thought this chip would solve all my problems. Well, it would have, only if my operating frequency wasn’t so low. Imagine using this chip to drastically reduce every frequency from 50 Hz and above. The clock frequency has to be ten times that… and unfortunately, that falls within the audible range. What that means is that the clock frequency is bound leak into the circuit and guess what? It did!! I would’ve had to have added another butterworth filter just to remove the clock frequency itself. So, i shoved LTC1063 aside and decided to revert to the old-fashioned method…

Back to the 5 stage butterworth Sallen-Key stuff… Played around with different variations to see if I could get a decent result. My aim, as stated before, is to simply reduce all the frequencies above 50 Hz. Not really interested in experimenting with High Gamma brainwave frequencies as of now. I managed to arrive at a good Sallen-Key setup… will post the component values and the calibration scope results in a while. Until then, Ciao!

EDIT: I found a better filter topology called the FLIEGE FILTER. It’s amazing to find free info like this from Texas Instruments. I’m now using this filter in my circuit (check out the schematic in one of the posts above )

Can ya hear my hearbeat?

•November 11, 2007 • 1 Comment

Ok, I decided to setup the basic single channel circuit and test it out to see if i could atleast register my own heartbeat. Easier said than done. A little bit of theory…

INA118 gain is determined by a single resistor Rg. And the Gain formula is : Gain = 1 + (50kilo-ohm/Rg)

Now, I thought i could manage to record my heartbeat with a nominal gain of 100 or so, but I actually had to crank up the gain to get a decent recording by using a 100 ohm resistor for Rg. Anyways, got that all setup and now, for the electrodes. I haven’t got down to creating the active electrodes yet, so I decided to simply use a pair of home-made ones. Each passive electrode simply consisted of a plastic cap with an office clip (yes! the all-useful office clip) and a sponge soaked in saline water. Here’s what it looks like:

Passive electrodes

A word of advice: Watch out for all that chest hair when you tape the electrodes to your chest. It can get excruciatingly painful when you try to pull the electrodes off! Don’t ask me how i know! :-D

Electrode positioning: Main electrode (V+) on the left chest close to the heart, other electrode (V-) on the right chest and the Right leg electrode on the right ankle (duh! obviously!!). The electrode cables were simple single cores with shielding.

OK, time for Testing! As I suspected, the circuit worked better with a dual power supply rather than a single 5v supply. (just hook up a couple of 9V batteries to 7805 & 7905 with supporting components and you’ve got your dual supply). Also, the right leg driver didn’t really improve the quality of the readings. In fact, I got better readings by simply connecting the Right Leg electrode to Vref which, in the case of a dual power supply, would be the Ground. The reading I got was pretty noisy but not bad, considering my electrodes were home-made. Recorded my heartbeats through the soundcard using Adobe Audition. Here’s a screenshot for y’all:

testing INA118 - heartbeats

It’s definitely not the cleanest of recordings… which brings to me to the next stage… Filtering!

See y’all in a while!

EEG for the braindead

•November 11, 2007 • 8 Comments

I was hoping to start this blog yesterday but I couldn’t find the time coz I went for a rock show. This little project is a resurrected version of something similar I worked on a few years ago. A lot of my inspiration comes from the OpenEEG project. So, if you’re ready for the ride, let’s begin!

I hope to be able to provide a few useful guidelines to those who’d like to build a cheap and affordable EEG recording circuit for themselves. My idea is to build a basic EEG circuit based on the venerable INA118 (precision instrumentation amplifier) and then record the data output either through a :

a) RS232 serial port (optoisolation achieved using 6N139)

OR

b) Soundcard (signal is first FM modulated, optoisolated using CP Clare’s LOC 110 which is then fed into the Mic input and finally software demodulated into the original EEG signal )

One thing I definitely want is to have atleast 8 separate channels and I’m planning to employ Active electrodes (16 of them + 1 for the Right Leg Driver). The difference between a Passive and Active electrode is that the latter uses an op-amp combined with the electrode itself. This provides better readings and also better noise reduction. Now, the best part about this entire thing is that i plan on using ONLY ONE INA118 inst. amplifier for all 8 channels. This will be achieved by routing the signals from the active electrodes through an isolation analog multiplexer such as MAX4558.

It’s gonna take a while before i complete the entire thingamagic, but it’ll be worth it. If all works well, I’ll use this for my own neurofeedback training purposes.

Here’s a pic of the basic EEG circuit. What you’re looking at is the basic building block based on INA118 (the chip on the left) with a Right Leg Driver (RLD) running on TLC272 (to the right).

INA118 basic EEG circuit with RLD

Keep checking in every now and then. Once the circuit is completed, I will post the entire schematic. Will definitely keep you posted on any progress made in the meantime…