Silicon ChipBrainwave Monitor – see what’s happening in your brain - August 2018 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: New base-load power stations are crucial
  4. Feature: Introduction to Electroencephelographs (EEG) by Jim Rowe
  5. Project: Brainwave Monitor – see what’s happening in your brain by Jim Rowe
  6. Feature: Taking an Epic Voyage through your Alimentary Canal! by Dr David Maddison
  7. Review: Altium Designer 18 by Nicholas Vinen
  8. Project: Miniature, high performance sound effects module by Tim Blythman & Nicholas Vinen
  9. Serviceman's Log: Roped into fixing a friend's dishwasher by Dave Thompson
  10. Project: Turn any PC into a media centre – with remote control! by Tim Blythman
  11. Product Showcase
  12. Project: Bedroom (or any room!) no-connection door alarm by John Clarke
  13. PartShop
  14. Vintage Radio: The AWA model B13 Stereogram from 1963 by Associate Professor Graham Parslow
  15. Subscriptions
  16. Market Centre
  17. Notes & Errata: Philips Compact Cassette, July 2018; Super-7 AM Radio, November & December 2017; New SC200 Audio Amplifier, January-March 2017
  18. Advertising Index
  19. Outer Back Cover

This is only a preview of the August 2018 issue of Silicon Chip.

You can view 41 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Brainwave Monitor – see what’s happening in your brain":
  • Brainwave Monitor (EEG) PCB [25107181] (AUD $10.00)
  • Brainwave Monitor (EEG) software (Free)
  • Brainwave Monitor (EEG) PCB pattern (PDF download) [25107181] (Free)
  • Brainwave Monitor (EEG) lid panel artwork (Free)
Items relevant to "Miniature, high performance sound effects module":
  • Super Digital Sound Effects PCB [01107181] (AUD $2.50)
  • PIC32MM0256GPM028-I/SS programmed for the Super Digital Sound Effects Module [0110718A.hex] (Programmed Microcontroller, AUD $15.00)
  • Firmware (C and HEX) files for the Super Digital Sound Effects Module [0110718A.HEX] (Software, Free)
  • Super Digital Sound Effects PCB pattern (PDF download) [01107181] (Free)
Articles in this series:
  • Miniature, high performance sound effects module (August 2018)
  • Miniature, high performance sound effects module (August 2018)
  • Super sound effects module – Part 2 (September 2018)
  • Super sound effects module – Part 2 (September 2018)
Items relevant to "Turn any PC into a media centre – with remote control!":
  • Arduino IR Keyboard software (Free)
Items relevant to "Bedroom (or any room!) no-connection door alarm":
  • Watchdog Door Alarm PCB [03107181] (AUD $5.00)
  • PIC12F617-I/P programmed for the Watchdog Door Alarm [0310718A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware (ASM and HEX) files for the Watchdog Door Alarm [0310718A.HEX] (Software, Free)
  • Watchdog Door Alarm PCB pattern (PDF download) [03107181] (Free)

Purchase a printed copy of this issue for $10.00.

by Jim Rowe We’ve seen how the brain produces tiny signals which can be detected by an EEG monitor. Well, with this project you can do just that: not only monitor and display your own brainwaves (or someone else’s), on a computer screen but save and print them if you wish. It’s based on an Arduino Nano and connects to the computer using a standard USB cable. T here are many reasons why brainwave monitoring can be useful. As we discussed, it can help in assessing your own well-being but few people have the ability or means to do it. They can only get information on their own brainwaves if they are referred to a specialist clinic – and the most common of these would be for investigation of sleep apnea. But you don’t have to be suffering from this serious complaint to have a reason to have your brainwaves monitored and investigated (see the previous article). With this inexpensive project, you can do it yourself. Brain waves are monitored using a 18 Silicon Chip number of electrodes placed on the scalp. These are readily available and not expensive. The electrodes are connected via shielded leads to the Brainwave Monitor unit, which then connects to a portable computer to display the results. The design for this Brainwave Monitor is partly based on the circuitry of Electrocardiogram (ECG) project in the October 2015 issue of SILICON CHIP (www.siliconchip.com.au/Article/9135). That project only needed a single channel and two electrodes to monitor electrical activity in a human heart. This Brainwave monitor has three Australia’s electronics magazine channels to monitor multiple electrodes. The very minute (as in tiny, not time!) signals are fed to very high gain amplifiers which are filtered and fed to a low-cost Arduino Nano microcomputer module to convert the signal readings to digital values and then sent to a PC for display and analysis. In a little more detail, since the voltages picked up by the brain electrodes are so small, the main board has three high-gain differential input amplifiers, each of which includes a three-pole low-pass filter to reduce the devices’ susceptibility to 50Hz hum radiated by mains power cables and other equipment. siliconchip.com.au The Brainwave Monitor is powered from the PC via the USB cable, so there’s no need for a separate power supply. The total current drawn is less than 45mA (at 5V). All of the Brain Wave Monitor’s functions are controlled using a Windows-based GUI application written in Visual C++. How it works The Arduino Nano microcomputer module provides both a multi-channel analog-to-digital converter (ADC) and a USB interface. The software loaded onto this module uses these features to continually sample the analog voltages from the front-end and sends the digitised values to your PC via the USB interface. Fig.1 shows the block diagram which depicts the three highgain differential amplifiers with low-pass filters which process the EEG signals to prepare them for sampling. Capturing EEG waveforms is challenging because the voltages found on the surface of the scalp are tiny: between 10µV and 100µV peak-to-peak, depending on the positions of the electrodes on the scalp and the contact resistance. Hence the need for amplifiers with very high gain. To make the job harder, these voltages are completely swamped by 50Hz hum (60Hz in the USA and some other parts of the world), picked up by our bodies from the fields surrounding the AC wiring in our homes and offices Luckily, while we are interested in the voltage differences between each pair of electrodes, the 50Hz hum picked up is virtually the same throughout the body. In other words, the 50Hz hum is a common mode signal while the EEG voltages are differential mode signals. So by using an accurately balanced differential amplifier as the input stage of each EEG amplifier channel, we can cancel out most of the common-mode 50Hz hum while amplifying the differential EEG voltages. The connections between the electrodes and the subject’s scalp need to be good because if one connection is poor, this can upset the balance of that input amplifier and reduce the common-mode cancellation. Another method to reduce the hum pickup is to connect a ground elecsiliconchip.com.au Fig.1: A simplified block diagram of our Brainwave Monitor, showing the three input amplifiers processing the tiny EEG signals and boosting them to feed the ADC inputs of the Arduino Nano. trode to the top centre of the subject’s scalp, in the “Cz” position (see previous article – page 14). Most of the remaining 50Hz signals are removed by low-pass filtering in the later stages of each amplifier. As a result, the output of the amplifiers provide clean amplified EEG signals, with insignificant residual 50Hz (or 60Hz) hum. Circuit description The full circuit of the Brainwave Monitor is shown in Fig.2. The shielded electrode leads are wired up to CON1, a DB9F connector. The six differential signals for the three channels are then fed through 1µF capacitors and series 4.7kΩ resistors to the inputs of IC1, IC3 and IC5. These are Analog Devices AD623ARZ chips, which are instrumentation amplifiers with very high common-mode signal rejection and high gain. The overall differential-mode gain of each AD623ARZ device is set by a resistor connected between pins 1 and 8. A value of 100Ω gives a gain of 1000 times (60dB). To ensure that IC1, IC3 and IC5 can deliver maximum undistorted output level and so that the analog signals fed to the Arduino span its entire 0-5V ADC range, we feed 2.5V DC (ie, half the 5V supply voltage) to each ampli- fier’s reference signal input (pin 5) from a low impedance source. This sets the DC level of the amplifier output signals to 2.5V. The half-supply reference is provided by voltage reference REF1 (an LMV431BIMF), which sets the zerosignal output level of IC1, IC3 and IC5. The two 2.2MΩ input bias resistors for each input amplifier are returned to the same +2.5V point, providing identical biasing for the amplifier inputs. As the input amplifiers are being operated with such a high gain, we also need to prevent them from amplifying any stray RF signals which may be picked up by the electrode leads (or the subject’s head and scalp). These signals are filtered out by the 1nF bypass capacitors between each amplifier input and ground, and also the 47nF capacitors between each pair of inputs. These capacitors form a balanced low-pass filter, in conjunction with the two 4.7kΩ input series resistors, with a -3dB point of 350Hz. Thus, the filters will be very effective at attenuating RF signals at hundreds of kilohertz and above, while having no effect on the low-frequency EEG signals. The rest of the Brainwave Monitor’s amplifier and filter circuitry is based around IC2, IC4 and IC6, all of which are LMC6482 CMOS-input dual lowpower op amps. These have rail-to-rail This project has not been designed for medical diagnosis. Correct interpretation of EEG waveforms is a complex and skilled procedure and requires proper medical training. The Brainwave Monitor is presented here as an instructive and educational device only. If you have any concerns about the health of your brain, consult a health care professional with specialist knowledge in this area. Australia’s electronics magazine August 2018  19 Fig.2: the circuit is essentially two halves: on this page are the three identical high gain differential amplifiers which take their tiny inputs from the electrodes . . . capable inputs and outputs. The following text describes the operation of the first channel; the other two are identical. The output from IC1 is fed to the input of IC2a via a simple RC low-pass filter formed by a series 3.9kΩ resistor and the 1µF capacitor, which gives a corner frequency of about 40Hz and an attenuation of about -4dB at 50Hz. IC2a provides an additional fixed amplification of either 20 times or 10 times, depending on whether LK1 is present or not. 20 Silicon Chip When LK1 is inserted, it shorts out the 220Ω resistor in the feedback path, altering the feedback ratio and thus increasing the stage gain to 20 times. Either way, a parallel combination of two 220µF ceramic capacitors between the bottom of the feedback divider and ground ensure a good low-frequency response while eliminating any DC offset at the op amp output, which could otherwise lead to premature or asymmetric signal clipping. IC2b provides additional low-pass filtering, to further reduce the 50Hz Australia’s electronics magazine hum level. It forms a second-order Sallen-Key low-pass filter with a corner frequency of about 30Hz, giving an attenuation figure of about 15dB at 50Hz but with unity gain for the lowfrequency EEG signals. So at the output of IC2b (pin 7), we end up with relatively clean and humfree EEG signals, amplified by either 10,000 or 20,000 times, depending on the setting of LK1. This signal, along with the identically processed signals from the other two channels, are then fed to the A0, siliconchip.com.au Parts list – Brainwave Monitor 1 PCB, code 25108181, 109.5 x 83.5mm 1 Diecast aluminium box, 119 x 93.5 x 34mm 1 Arduino Nano or equivalent module 1 USB cable, type A to mini-B 1 DB9F/DE9 socket, right-angle PCB-mounting (CON1) [Jaycar PS0806, Altronics P3030] 1 100µH 1.6A SMD inductor (L1) [Murata 48101SC; element14 Cat 2112367] 3 2-way SIL pin headers with jumper shunts (LK1-LK3) 7 PCB terminal pins (optional) 4 M3 x 10mm metal tapped spacers 8 M3 x 6mm panhead machine screws 4 small adhesive rubber/plastic mounting feet Electrode components 7 EEG electrodes (see previous article) 7 26mm insulated alligator clips (three red, four black) [4 x Jaycar HM3020] 1 DB9M plug with backshell cover [Jaycar PP0800+PM0812, Altronics P3000+P3093] 1 3.6m length of figure-8 shielded stereo audio cable 1 1.2mm length of green light-duty stranded, insulated wire 1 150mm length of 4mm diameter heatshrink tubing Semiconductors 3 AD623ARZ instrumentation amplifiers, SOIC-8 (IC1, IC3, IC5) 3 LMC6482IMX dual op amps, SOIC-8 (IC2, IC4, IC6) 1 LMV431BIMF adj. precision shunt regulator, SOT-23 (REF1) 1 3mm green LED (LED1) 1 3mm red LED (LED2) Capacitors (all SMD ceramic except where noted) 6 220µF 6.3V X5R dielectric, 1210 size 6 100µF 6.3V X5R dielectric, 1206 size 1 10µF 25V X5R dielectric, 1210 size 3 2.2µF 25V X5R dielectric, 1206 size 6 1µF 100V MKT (leaded) 6 1µF 16V X7R dielectric, 1206 size 9 100nF 16V X7R dielectric, 1206 size 3 47nF 50V X7R dielectric, 1206 size 6 1nF 50V C0G dielectric, 1206 size . . . while on this page is the Arduino Nano which processes the signals from the amplifiers. A1 and A2 analog input pins of the Arduino Nano. LED1, the power indicator, lights when the 5V supply is present, while LED2 lights when output pin D3 of the Arduino Nano goes high, which indicates that sampling is taking place. Each IC has a 100nF bypass capacitor to ensure it has a stable supply while the supply to each instrumentation amplifier is independently filtered using an RC low-pass filter comprising an 82Ω series resistor and 100µF ceramic capacitor to ground, to minimise siliconchip.com.au Resistors (all 0.125W 1% 1206 size SMD) 6 2.2MΩ 2 20kΩ 1 11kΩ 1 10kΩ 9 10kΩ 6 3.9kΩ 3 3.6kΩ 1 2.7kΩ 3 2.0kΩ 1 1.6kΩ 1 1.5kΩ 2 470Ω 3 220Ω 3 200Ω 3 100Ω 3 82Ω 6 4.70kΩ 0.1% cross-talk between amplifiers. These also prevent noise being coupled into the sensitive front-end amplifiers from the 5V USB supply. The 5V USB supply for the whole circuit is also filtered by an LC lowpass filter comprising a large, high-frequency 100µH series choke (L1) and three paralleled 100µF ceramic capacitors to ground. This LC filter is in series with the individual RC filters to each instrumentation amplifier, so they combine to provide excellent noise rejection. Australia’s electronics magazine 1 11kΩ 3 2.2kΩ 1 330Ω Construction All of the Brainwave Monitor circuitry, including the Arduino Nano, is mounted on a PCB measuring 109.5 x 83.5mm and coded 25108181. Use the PCB overlay diagram shown in Fig.3 as a guide for fitting the components to the board. Many of the components on the PCB are SMDs (surface-mount devices) but there are some through-hole parts too. Fortunately, the SMDs are quite straightforward to solder as they have fairly large and widely spaced pins. August 2018  21 The Arduino Nano As explained in the circuit description, the Arduino Nano is the heart (or should that be brain?) of the Brainwave Monitor. It is effectively a miniaturised version of the familiar (and original) Arduino Uno. It’s about a quarter of the size, with a PCB measuring 43 x 17.5mm. Most connections to the board made via two 15-pin SIL headers, fitted 15mm apart. Like the Uno, this module is based on an Atmel ATmega328P microcontroller but in this case, in a 32-pin SMD package. Instead of using a second ATmega16U2 microcontroller to handle USB communication with the PC, the Nano uses either an FT232RL or a CH340G USB transceiver chip. There isn’t much else on the board, apart from an AMS1117 5V low-dropout regulator, 16MHz resonator and a tiny reset pushbutton. Power comes from the PC via the USB mini type-B connector. Like the Uno and other Arduinos, the Nano also has a 6-pin DIL pin header for in-circuit serial programming (ICSP) of the microFit the SMD resistors first, followed by the SMD capacitors and then the six ICs. The main thing to watch with the ICs is to orientate them correctly, as shown on the overlay diagram. For all these components, it’s easiest to tack-solder one pin first, doublecheck the component orientation and/ or value, then solder the other pin(s) and refresh the first solder joint. If you accidentally bridge adjacent IC pins with solder, simply remove the excess using a small dob of flux paste and the application of some braided solder wick. Using the same technique, you can now mount REF1 (in a small SOT-23 package) and the largest SMD component, L1. Then all of the leaded/ through-hole parts can be added, starting with the three 2-pin headers for LK1-LK3, then the six 1µF input coupling capacitors. Next fit CON1, making sure that all of its nine pins pass down through their mounting holes along with the two mounting lugs. Make sure that the connector’s body is resting on the top of the PCB before you solder all the pins under the PCB. Now install the LEDs with their leads straight, with the underside of each lens 12mm above the top of the PCB. Make sure they are orientated correctly, ie, with the longer (anode) lead soldered to the pad marked “A” on the PCB. Then bend the leads forward by 90°, 7mm above the top of the PCB. Then, if you want them, add the seven optional PCB terminal pins, (used for test points). If you’ve purchased a clone instead of a genuine Nano, it may be supplied 22 Silicon Chip controller. But normally you do not need to use this as you can program it using the USB port. Inside the 328P chip is a reasonably fast 8-bit RISC processor with 32 registers, 32Kbytes of flash memory, 1Kbyte of EEPROM and 2Kbytes of static RAM. There are also two 8-bit timer/counters, one 16-bit timer/counter, a real-time clock and calendar with its own oscillator, six PWM channels, a 10-bit ADC with eight input channels, a programmable serial USART, a master/slave SPI serial interface, an I2C 2-wire serial interface and an on-chip analog comparator. When the Brainwave Monitor is working, the sequence of events is quite straightforward. Each time the software wants a set of EEG samples taken, it sends a command to the Arduino, which then uses its internal ADC to take 10-bit samples of the amplified EEG signals at its A0, A1 and A2 inputs. The sample values are then sent back to the PC, in an overall sampling cycle that takes less than 15 milliseconds. with separate headers. In this case, you will first need to solder the headers to the Nano board, ensuring that the solder joints are made on the top side of the module, with the plastic strips and long pins underneath (see photos). Now mount the Arduino Nano on the PCB, with its USB mini-B connector facing towards the top and its two 15-pin headers passing down through the matching holes in the PCB. Make sure the plastic strips which hold each row of pins together are resting on the top of the main PCB before you solder the pins underneath. That concludes the assembly work on the Brainwave Monitor PCB. Installing the software Before mounting the PCB in its case, you should verify that it’s working properly. First, you will need to establish communications between the Arduino Nano module and your PC. Then you will need to load the Arduino firmware and PC software. You can then verify it’s all working before going any further. Fig.6 gives an overview of how the Brainwave Monitor works with the software installed on your computer. If you don’t already have the Arduino IDE (integrated development environment) installed on your computer, download and install it now. The download is free and it’s avail- Fig.3: use this same-size PCB component overlay, and the matching photo opposite, when assembling the PCB. Australia’s electronics magazine siliconchip.com.au able for Windows, macOS and Linux systems (but note that the main software program written for this project is for Windows only). You can download the Arduino IDE from https://www.arduino.cc/en/ Main/Software The latest version at the time of writing is 1.8.5 so we suggest you use this or a later version if possible, to ensure compatibility. Having installed the IDE, plug the Nano board into one of your computer’s USB ports (LED1 on the PCB should light up) and then start the IDE. Open the Tools → Ports menu and check the list to see if the Arduino Nano is present. If so, select it. If it is not, that suggests that your computer may not have the appropriate USB/serial driver. Most systems will have this driver pre-installed but in some cases, it may not. In that case, refer to the two following links for instructions on installing the FT232RL or CH341 driver, depending on which chip your Nano has been supplied with: siliconchip.com.au/link/aakf or siliconchip.com.au/link/aakg Once the driver is installed, re-plug the Nano, re-launch the IDE and check that the device is now showing up in the Ports list. Select it, and ensure that the Nano is also selected in the Tools → Boards menu. You will now need the Arduino sketch, which you can download in a package from the SILICON CHIP website SAFETY WARNING To ensure complete safety, this Brainwave Monitor must only be used with a batterypowered laptop or notebook PC, ie, one that is NOT connected to the mains in any way. Do NOT use it with a desktop or laptop PC that is powered from 230VAC. This precaution is necessary to eliminate the remote possibility that a fault in the power supply of a mains-powered PC could result in a high AC voltage being applied to the EEG electrodes attached to the scalp, which could have fatal consequences. (free for subscribers). The sketch file is called “sketch_for_EEG_Sampler.ino” and when the download is complete, unzip the files and open this sketch file using the Arduino IDE. If you have set the Port and Board correctly as per the above instructions, you will just need to use the Tools → Upload menu option and the sketch should be compiled and uploaded onto the Arduino Nano. Your Brainwave Monitor is then ready to go. You just need the matching Windows software loaded on your PC. Testing Now close the Arduino IDE. You will need to install the Windows program on your PC to test out the Brainwave Monitor. It’s also available as a download from the SILICON CHIP website and is called “SiliconChipEEGSamplerSetup.exe”. Run this setup program and follow the prompts to install it on your system. When that’s complete, launch the software. Select the correct COM port (the same one that was used to upload the While there are quite a few SMD components to fit, they’re all wide-spaced-pin types so they shouldn’t cause you any grief when soldering! siliconchip.com.au Australia’s electronics magazine sketch earlier) and set the baud rate to 115,200. Start sampling and check that the software is able to connect to the Brainwave monitor and displays some traces. Of course, at this point the traces will probably just show noise. But at least you will have a pretty good indication that everything is working. You can run your fingers along the 9-pin connector pins to check that each channel is being correctly sampled; this should induce some voltage on the inputs and cause a signal to appear, although it’s likely to overload the channels, resulting in something that looks like a square wave. Final assembly The complete PCB assembly fits inside a standard diecast aluminium box measuring 119 x 93 x 34mm. The PCB assembly mounted on the inside of the box lid with the box itself lowered down over the assembly to form a shielding enclosure; the lid then becomes the base. Note that some of the diecast boxes we purchased recently had somehow missed out on the tapping of their mounting holes and we had to tap them by hand. So it would be a good idea to check the holes in your box before you begin final assembly. The DB9F connector (CON1) used for the EEG electrode leads is accessed through a 31 x 17mm crossshaped hole in the front of the box, with the two indicator LEDs protruding through a pair of 3.5mm holes to the right. The Arduino Nano’s MiniB USB socket is accessed via a 10 x 12mm rectangular hole in the rear of the box. These holes in the case should be located and cut as accurately as possible so that the PCB assembly will fit properly. Refer to the drilling diagram, which can be downloaded as a PDF file from the SILICON CHIP website (free for subscribers). Once the box has been prepared, you’re ready for the final assembly stage. The completed PCB is attached to the inside of the box lid using four August 2018  23 Fig.4: the completed PCB is mounted on the lid of the diecast case via screws, nuts and spacers, as shown here. The lid is then turned upside-down to become the base, as shown in the photo at right. 10mm-long M3 tapped metal spacers and eight 6mm-long M3 screws. Refer to Fig.4 for details. Having mounted the PCB to the inside of the lid, fit the jumper shunts to LK1-LK3. This will set the gain of all three input channels to 20,000, which is the best setting to start with. Now lower the main part of the case down over the PCB, tilting it at an angle of 20° or so at first so that CON1 and the two LEDs fit through the holes in the front of the case. You can then lower the back side down onto the lid, while at the same time moving the case slightly towards the rear. Once it’s together, use the four supplied countersunk-head M4 screws to attach the lid to the case. The final step is to apply a label to the top of the box. Like the box drilling diagram, the artwork for the dress front panel can downloaded as a PDF file from the SILICON CHIP website. Either way, we suggest that you hotlaminate the artwork for protection against scratching and/or finger grease, and then attach it to the top of the box using double-sided adhesive tape or a thin smear of silicone sealant. We suggest that you also fit four small adhesive rubber or plastic feet to the box lid/base, so the heads of the PCB mounting screws won’t scratch any surface it’s placed on. The electrode leads Although it’s fairly easy to get hold of commercial EEG electrodes at relatively low cost, this isn’t the case with electrode leads. They are available online but are generally very expensive. And most of them are not shielded and they are typically fitted with special line socket connectors for compatibility with commercial EEG machines. So regardless of which type of electrodes you use, the best approach is to make the leads yourself. You can do this using a 3.6m length of good quality figure-8 shielded audio cable, which you can get from Jaycar or Altronics. Don’t try to use cheap, ready-made stereo audio leads because they usually don’t provide adequate shielding. They’re made to a price, not a recipe! Cut the cable into three 1.2m lengths. Remove 25mm of the plastic sheathing from one end of each cable and then unwind the exposed screening braid, twisting them together to Here’s some commercial leads and attachments which we bought on the ’net – but unlike the electrodes, which are pretty cheap, commercial leads are rather pricey! 24 Silicon Chip form the earth connection wire. Then remove about 6mm of the insulation around the inner conductors, after which you can tin the ends of both pairs of wires, ready for soldering to the pins of the DB9M plug which connects all three leads to CON1. At the other end of each lead, remove 10mm of the outer sleeve, then cut away the screening braid wires as close as possible to the cut end of the sleeve. Then remove about 6mm of the inner insulation and tin the exposed conductors. Separate the two halves of the figure-8 cable by about 30cm, then slip a 15-20mm length of heatshrink tubing over the two halves and solder 26mm insulated alligator clips to the exposed wires. These small insulated alligator clips are the easiest way to make contact with typical commercial EEG electrodes, which are fitted with a small contact stud on the top. Commercial electrode leads have a special matching clip for these studs but small alligator clips make a good substitute. Slide the pieces of heatshrink up and over the bases of the alligator clips and shrink them down. But home-made leads, like the ones we made using good ol’ crocodile clips and good quality shielded figure-8 work just as well at a fraction of the price. Note the electrode labels. Australia’s electronics magazine siliconchip.com.au And here’s how it looks on completion, with the front panel glued to the “bottom” of the case – which is now the top! Ideally, the label should have a clear covering (eg, clear adhesive vinyl or even a laminate) to protect it from grubby fingers! This will give you the six shielded leads (in three pairs) needed to connect the main electrodes to the Brainwave Monitor. But a seventh lead is needed as well – the one for the ground reference or “Cz” electrode. This doesn’t need to be shielded so you can make it using a 1.2m length of light-duty insulated hookup wire. Just strip the insulation from about 6mm at each end and tin the ends of the wire. Solder the seventh alligator clip to one end of this wire. The final step is to solder the tinned ends of all of these leads to the appropriate pins of the DB9M plug, as shown in Fig.5. Note that the inner conductors of each shielded lead go to pins 5, 9, 4, 8, 1 and 6, while their shield braid wires all connect to pins 2, 3 or 7, along with the wire of the ground reference lead. Obtaining EEG electrodes There are numerous EEG electrodes available via a number of suppliers on eBay at reasonable prices. Many of these are cup-shaped devices about 10mm in diameter with a connection stud at the top, made from either gold-plated metal or conductive plastic. Some of them have a flat base for contact with the scalp, while others have a double-hexagon array of tiny feet. Some typical samples are shown in the photo opposite. Some of these electrodes are intended for wet use, with a smear of conductive gel under the cup to ensure good electrical contact with the scalp. Others are intended for dry use, relying purely on physical pressure to make contact. Another type of EEG electrode you’ll find is a smaller version of the self-adhesive electrodes intended for ECG use (ie, monitoring the electrical activity of the heart). These have a dob of conductive gel inside a sticky ring, with a peel-off film over them both. All you need to do with these electrodes is peel off the protective film and then apply the electrode to the right position on the subject’s scalp. All of these electrodes have the same problem, in that they have a tenden- Fig.5: here’s how the crocodile clips of our suggested ‘DIY’ leads are connected to the studs of low-cost selfadhesive electrodes. The electrode at lower right has been inverted to show its ‘sticky ring’ and the centre dob of conductive gel. cy to move or fall off if simply placed on the scalp; especially the dry types. If you search the internet, you’ll find various kinds of skull caps which are designed to hold the electrodes in position. One of the most common types is an open grid made from elastic tubing, with small plastic ties at each intersection and a larger coupling piece down each side to allow attachment of an adjustable length strap passing under the lower jaw. It looks quite weird, but should stop the electrodes from moving. You would first fit it over the subject’s head, then slip the various electrodes under the grid in the desired positions These caps are available at fairly low cost (around $10-20 each) but Fig.5: How to wire the seven electrode leads to the DB9M plug which connects to the Brainwave Monitor’s input socket CON1. Note that apart from the Ground Reference (Cz) lead, all of the other leads should be shielded. The shields of all leads at the crocodile clip ends are left open circuit (only the internal wire is connected to the crocodile clips). siliconchip.com.au Australia’s electronics magazine August 2018  25 Fig.6: A block diagram showing how the ‘software’ side of the Brainwave Monitor works. On the left are the modules inside the Brainwave Monitor while on the right are the functions inside your laptop/notebook PC. you also have the option of using an old-fashioned elastic rubber or plastic shower cap, which would be much cheaper. You could mark the outside of the shower cap with the 10/20 electrode reference grid and punch holes in the appropriate positions to hold the various electrodes in place, with their connection studs protruding to allow the clips to be connected. Taking an EEG Apart from the gain of the input amplifiers, all other functions of the Brainwave Monitor are controlled using the software. This is very easy to use because when you fire it up, it provides a GUI window (see screen grabs; Figs.7 and 8) which provides combo-box buttons along the top so you can set the sampling configuration: the COM port to which the sampler is connected, the Baud rate to be used (normally 115,200) for communication and the sampling time you want (5, 15, 30 or 60 seconds). Then you start taking an EEG recording simply by clicking on the Start Sampling button. During the sampling time, progress is shown by a progress bar along the top, plus the sample plot displays growing in the graph graticules. As you can see there are two dropdown menus at the top, with the familiar labels “File” and “About”. The first menu gives you options for saving, reloading or printing your EEG recordings and also for closing the application when you’re finished. The second menu is merely to display a small dialog box showing the SC version number of the software. 26 Silicon Chip Fig.7: a screen grab taken during early testing, with an 8Hz 75uV sinewave signal from a function generator applied to all three channels. Fig.8: another grab showing an ‘ECG Waveform’ from the function generator applied to all three channels, again during early testing. Australia’s electronics magazine siliconchip.com.au