Links and reading
Animated project intro
Simple EEG instructions
Main mailing list
The text and graphics of this site are released under a Creative Commons license unless otherwise stated.
Building the ModularEEG
Credits and copyrights
The following people have contributed to this document
Dan Griffiths, Nelo, Jim Peters, Andreas Robinson, Jack Spaar and Yaniv Vilnai.
This document is copyright (c) 2002, 2003, the authors and is licensed under the Creative Commons Attribution-ShareAlike license, version 2.0
Please report to the mailing list if you find any errors, if something is unclear or if there is anything you would like to add.
1.2 Tools and materials
1.3 The workplace
Semiconductors are easily damaged or destroyed by electrostatic discharge (ESD), so you need to take some precautions.
Avoid rooms with woven wall-to-wall carpeting and/or very dry air.
Do not wear clothing that generates static electricity. Synthetic materials and wool are bad and cotton is good. Shoes with thick rubber soles are also bad because they block electric charge from leaving your body in a safe way. If you are working on this at home you might want to try being barefoot!
Sit in a chair where the seat is made of metal, wood or cotton. Synthetic materials can cause a buildup of electrostatic charge.
The smoke from the solder flux in the solder is not very healthy. Make sure the room is well ventilated, and avoid breathing in the smoke.
For a list of parts to put on the PCBs, look at the bill-of-materials (BOM). It lists several distributors you can buy parts from.
If you order parts from distributors other than those in the BOM, the following is important.
You need to pay special attention to the "Part requirements and notes" in the ordering information section of the BOM. Any specification in that column should be met or exceeded. For example, a 1% tolerance should not be replaced by a 5% part. See the FAQ for common questions on parts selection, and if in doubt, ask on the mailing list.
In addition, you should compare the dimensions of the part to the space available in the board layout to make sure the part will fit.
You can use Eagle CAD for this. The following instruction is for Eagle CAD v4 and may have changed in later versions (?):
By following this procedure, you may take all the measurements you need.
Cables and connectors
You will have to buy or make several cables for this project:
The board-to-board cable is a 34-lead ribbon cable. You can make one from an old floppy-disk cable. It is recommended that you buy a new female connector so that you can make it shorter if you want to. The distributors that sell electronic parts usually have connectors as well.
The parts needed for the programming cable are listed in the section on building it below. From v0.07, the header pin configuration is the same as Atmel uses with its evaluation boards, which should make it possible to use other AVR programmers and tools without modification. Caveat emptor: compare with your programmer first!
The serial cable is a plain, 9-pin serial extension cable, sold by computer stores. On the ModularEEG, it should be connected to a 9-pin female D-sub connector, with solder-cups.
TODO: electrode cables
Recommendation: Use a battery, for safety.
TODO (But don't hold your breath)
TODO (here either)
1.5 Assembling the Boards
It can be instructive to know what the ModularEEG circuit boards look like, and below you will find two photos of the two boards with most parts, except the integrated circuits mounted. The pictures show version 0.07, which is a prototype. Your boards will look slightly different if you are building a different version.
The cyan-colored numbers in the photos above mark the locations of the various connectors.
On the digital board (upper image) you find these connectors
On the analog amplifier board (lower image) you find these connectors
Some EEG cabling notes
Each EEG channel inputs consists of two leads, and shielding.
The shielding can be connected to VGND, and the layout is designed for this setup in mind.
However, a device which connects the cable shields to the DRL output has been built. It has some advantages, such as possibly more stable DRL operation.
Note that in that device, the amplifier board itself is placed in a metal box which is attached to VGND, while the cable-shields are attached to the DRL. There is no direct electrical connection between VGND and the DRL output in this setup (or any other for that matter). Keep this in mind when you choose connectors.
Fixing board defects
Before soldering any parts to the boards, check them for production defects by shining a light from below. You should see glowing circles around each via (hole). These are clearances. Some circles will be connected to the ground plane by thin "+" shaped traces. Some will be connected by thicker traces to other vias.
Look carefully for any clearances where the circle itself is deformed. In rare cases the ground plane may be making contact with a via. You may need to scrape a clearance around that via, being careful not to sever legitimate traces. Flip each board over and check the other side the same way.
Make a cut where you want the edge of the clearance to be, first, or you may end up removing more of the ground plane than intended. You will have an easier time peeling or scraping off the copper as well.
Of course, defects can occur along straight copper traces as well, so you should check the entire board.
After fixing any defects, solder all parts and sockets, but do not insert any of the ICs in their sockets right away. Instead, follow the procedures in the testing chapter, to get your ModularEEG up and running.
Do the parts with the lowest profile first. That way they will not fall out of the holes when you turn the board over to solder on the back. You can make the parts stay put by bending the legs/pins slightly after inserting them or by taping them down with a piece of paper tape over the component body.
Again, solder the lowest profile parts first. Here is a suggested order. The parts you get may require a different order
You might find these images useful.
The image to the left shows the outline of an 8-pin IC. Notice the location of the indentation and how the pins of an integrated circuit are numbered counter-clockwise. The image to the right shows the outline of the programming connector, with pin numbers.
Finally, when you have soldered everything, you need to flip over the amplifier board and put some solder on two of the six small solder bridges found near the large 34-pin connector.
Place blobs of solder over the gaps marked 1 and 2. If you are building a second or third amplifier board, place the blobs over 3,4 and 5,6 respectively.
1.6 Making the Programming Cable
You can either make your own programming cable, or buy a prebuilt programmer.
Olimex, the same company that manufactures the ModularEEG PCBs sells two versions: a serial port version, AVR-PG1B for 6.95 USD and a parallel port version AVR-PG2B for 9.95 USD. Either of these would require use of alternative free programming software. www.avrfreaks.net, has all the information you will ever need on finding programmers and software for the AVR family of microcontrollers. Look in the "tools" section, and then under the "programmer software" and "programmer" sub categories.
Now, to make your own cable, which is the cheapest, but not the easiest option, you will need these parts:
Here is the schematic, also found in the file Cables.Sch in the ModularEEG zip-file. It shows how all parts are supposed to be connected to each other. The name SP12 below, refers to the name of the programming software.
The schematic quite simple, so the assembly details are left to you. Nevertheless, a few building hints are useful, especially if you have not done this kind of thing before.
Before you begin, have the schematics and PCB layouts handy, preferably on your computer screen. You will also need a copy of ElectricGuru (see the OpenEEG website).
There are currently no instructions on what to do if something is wrong, sorry. If you get problems, ask for help on the mailing list.
2.1 Testing the Power Supply
(Updated for v 0.07 or later)
To make sense of the following, you need to look at the schematics and board layout of the digital board.
Setup for people using a 5V power source
Setup for people using a 9 - 12V power source
2.2 Programming the Microcontroller
For the sake of consistency, all programming instructions are found in the firmware distribution.
2.3 Testing the Microcontroller
2.4 Testing and trimming the Amplifiers
Start ElectricGuru by clicking on the green stoplight button. Unless you have mounted the amplifier board inside a metal box, you should see lots and lots of 50/60Hz hum on both channels. If you have mounted the amplifiers inside a metal box, you are more likely to see a noise signal which resembles EEG (but isn't).
Fine trimming preparations
Ideally, the test signal is 5 volts / 20,000 = 250uV peak to peak. This corresponds to a square wave alternating between the sample values 262 and 762. In reality, the amplitude depends on the supply voltage (namned U from now on), which probably is not exactly 5 volts.
The actual amplitude of the square wave then becomes U / 20,000 volts peak to peak. Expressed in sample values, the upper level is M + U * 50 and the lower is M - U * 50.
Important: Notice that the square wave test signal may have little bumps right after its rising and falling edges. You should not look at them when you set the gain. You get best accuracy if you look at the amplitude where the wave is flat.
On to the trimming. From now on, the y-axis limits found in the traces-dialog will be referred to as Ymin, and Ymax.
2.5 Trimming the DRL
The trimming is done as follows
Note: Most people will want to use INA114 instrumentation amplifiers and can therefore skip trimming if they replace P201 with a wire going from the wiper (connected to pin 5 on IC201B) to VGND. P201 is only required for other types of instrumentation amplifiers, e.g AD620.
Of course, if you mount P201, you will have to trim it, regardless of instrumentation amplifier type.
3 Common Problems
What do I do if I can not solder?
Well you can learn. :-) Everyday Practical Electronics (an electronics magazine) has an online guide last seen here: http://www.epemag.wimborne.co.uk/solderfaq.htm
I have trouble with the small gaps between solder pads and ground plane. The solder tends to stick to the ground plane and form bridges to the pads.
If you etched your own boards, you may have problems with this, and will need to use a solder braid a lot to break up bridges. However, if you have factory made PCBs with (usually) green soldermasks, this should not be a problem at all. If you apply solder and heat to the pad, the solder should not flow over to the ground plane because there is no thermal connection that would heat the ground plane.
So, if you are experiencing this problem, try switching to a soldering iron with finer tip, and finer solder. Make sure the solder has channels of non-corrosive flux which helps the solder flow. You may also need to increase the heat. Solder has a natural surface tension which tends to break up bridges unless there is an excessive amount of or the solder iron is too cool.
I soldered in a part in the wrong place, how do I get it out?
I assume you use sockets for the expensive parts (except perhaps for the DCDC converter)?
In that case, whatever you are trying to remove is probably a lot cheaper than the PCB: Cut away the component, and buy a new one.
When you cut the leads, leave enough wire so that you can pull them out easily. Apply heat on one side of the board and pull them out with tweezers from the other side.
I managed to plug a hole on the PCB with solder, how do I get it out?
First remove excess solder with the solder braid. You should be able to see the outline of the hole afterwards.
Then you have two options. One way is to drill a hole through the solder – just be sure not to damage the plating. For this you need a drill that is thinner than the hole. If you do happen to damage the plating, not all is lost, you will simply have to solder on the side(s) where the copper trace leaves the hole, rather than just the bottom side.
Another way, is to melt away the solder, like this:
It is important to keep the heating period as short as possible, so if the solder doesn't melt within a few seconds, the iron is too weak or the tip needs cleaning.
If you are having problems with the above method, try this one, which also attempts to keep the part intact (no wire cutting).
Buy yourself a desoldering pump.
CAUTION: Make sure you press the nozzle against the weld, or the plating and copper traces may be ripped off the board when you push the button.
I tried to unplug a hole like you said, but the solder won’t melt. Now what?
The main cause: not enough heat. Try “wetting” the iron with some solder before putting it to the wire. This will give you better thermal contact. Trying to unplug a via - a hole placed in the ground plane - without any leads going to it - is trickier. The ground plane conducts heat very well so you will need a bigger soldering iron, or a hot-air gun. If you use a hot-air gun as heat source, make sure the nozzle is as small as possible. Heating a larger area than necessary, or longer than necessary, can damage the PCB.
I think these IC's / transistors I bought are broken. Why? They were new!
They may have been defective from the start. It does happen. Electronics manufacturers routinely have to repair their products even before they leave the factory.
Another very common reason for failure is electrostatic discharge (ESD) damage. The instrumentation amplifiers are particularily sensitive and will produce garbled signals if damaged.
You should minimize the physical handling of the semiconductors and keep them in their bags as long as possible. The silver-coloured plastic protects them from ESD.
Before handling the semiconductors, discharge yourself. You can do this by touching ground (earth). Common places connected to ground are the kitchen sink or a nearby (metal) radiator. You can also wear a conductive wrist-band and connect it to earth.
One EEG channel is working correctly, but the other is unstable or sometimes working, sometimes not. What has happened?
There are two known factors that might cause this:
The software is receiving data, but I only see flat lines.
My ModularEEG does not work! Help!
TODO (some day)
This chapter is supposed to be about how to maintain isolation distances when you add connectors and put everything in a box.