Project B: Reverse-engineer a bought board
If you buy an OpenBCI Ganglion or Cyton instead of building, read its schematic, trace the signal chain, read its firmware, and characterize it as if it were yours. Faster to decoding, nearly as educational, and no longer the cheaper path.
On this pageTwo weeks of evenings
There is no shame in buying the amplifier. OpenBCIOpenBCI The open-source EEG hardware company whose Cyton (ADS1299) and Ganglion boards are the default hobby and research-lite amplifiers. Related: ADS1299ADS1299 Texas Instruments' 8-channel, 24-bit biopotential front-end chip used in OpenBCI and many research amplifiers. , BrainFlowBrainFlow A library that talks to OpenBCI and most consumer EEG headsets with one API, in Python and other languages. . Glossary entry publishes every schematic, every board layout, and every line of firmwareFirmware The program running on the microcontroller, which configures the chip, reads samples on time, and ships them to the computer. Related: SPISPI A simple four-wire bus for talking to chips like the ADS1299 from a microcontroller. . Glossary entry, so a bought board can be read like a textbook that happens to work. The deal you make with yourself is this: you will read the whole schematic and be able to explain every part on it, you will find the sample-conversion code in the firmwareFirmware The program running on the microcontroller, which configures the chip, reads samples on time, and ships them to the computer. Related: SPISPI A simple four-wire bus for talking to chips like the ADS1299 from a microcontroller. . Glossary entry, and you will measure the board’s noise floorNoise floor What your instrument records when the input is shorted or connected to a perfectly quiet source; everything smaller than this is invisible to you. Related: Thermal (Johnson) noiseThermal (Johnson) noise The random voltage every resistor produces just by being warm; about 13 nanovolts per root hertz for 10 kilohms, which matters at microvolt levels. , CharacterizationCharacterization Measuring what your instrument actually does, such as its noise floor, bandwidth, and rejection, instead of assuming the datasheet. . Glossary entry and rejection on the phantomPhantom A physical stand-in for tissue, such as saline gelatin with embedded wires, used to test an instrument against known signals. Related: CharacterizationCharacterization Measuring what your instrument actually does, such as its noise floor, bandwidth, and rejection, instead of assuming the datasheet. . Glossary entry head exactly as if you had designed it. Then you will get to Phase 3 a month sooner than the builders.
Which board
The Ganglion has four channels, uses a Microchip MCP3912 converter rather than the ADS1299ADS1299 Texas Instruments' 8-channel, 24-bit biopotential front-end chip used in OpenBCI and many research amplifiers. Related: Delta-sigma ADCDelta-sigma ADC A converter that samples very fast with a crude 1-bit decision and averages, achieving 24-bit resolution at modest rates; what the ADS1299 uses. , OpenBCIOpenBCI The open-source EEG hardware company whose Cyton (ADS1299) and Ganglion boards are the default hobby and research-lite amplifiers. . Glossary entry, and talks Bluetooth. Its four channels are enough for SSVEPSteady-state visual evoked potential (SSVEP) When you stare at something flickering at a fixed rate, visual cortex oscillates at that rate, and the frequency can be read straight out of the EEG spectrum. Related: Canonical correlation analysis (CCA)Canonical correlation analysis (CCA) Finding the combination of channels that correlates best with reference sinusoids at each candidate frequency; the standard SSVEP decoder. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry, P300P300 A positive bump about 300 milliseconds after a rare or meaningful stimulus, the basis of the classic BCI speller. Related: Event-related potential (ERP)Event-related potential (ERP) The small, stereotyped voltage waveform the brain produces in response to an event, invisible in a single trial and revealed by averaging many. , Oddball paradigmOddball paradigm An experiment in which a rare target is mixed in among frequent standards; the rare one produces a P300. . Glossary entry, and a two-channel sleep band. The Cyton has eight channels around the ADS1299ADS1299 Texas Instruments' 8-channel, 24-bit biopotential front-end chip used in OpenBCI and many research amplifiers. Related: Delta-sigma ADCDelta-sigma ADC A converter that samples very fast with a crude 1-bit decision and averages, achieving 24-bit resolution at modest rates; what the ADS1299 uses. , OpenBCIOpenBCI The open-source EEG hardware company whose Cyton (ADS1299) and Ganglion boards are the default hobby and research-lite amplifiers. . Glossary entry, an optional eight-channel daisy board, and a radio link; it is the research-lite standard.
Neither is cheap any more. The Ganglion is 1,249, and both were sold out when this page was last checked, which is nearly three times and six times what building the eight-channel board costs. Buy one only if a lab, a grant, or a club is paying, or if a used one turns up on eBay, which happens often enough to be worth watching for. If what you want is a commercial board to read rather than a finished instrument, the BioAmp EXG Pill is $34.49 assembled, its schematic is published, and it is a real single-channel front end you can trace end to end; what it does not give you is the converter, the radio, or the firmwareFirmware The program running on the microcontroller, which configures the chip, reads samples on time, and ships them to the computer. Related: SPISPI A simple four-wire bus for talking to chips like the ADS1299 from a microcontroller. . Glossary entry, which is most of what the Cyton teaches.
Read the schematic like this
Print it. With a highlighter, trace one channel from the electrodeElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry connector to the converter input, and mark every component you pass. For each one write, in the margin, what it is for. A series resistor: input protection and RF filtering. A capacitor to ground: the other half of that filterFilter An operation that passes some frequencies and attenuates others; every filter also delays or distorts the timing of what it passes. Related: High-pass filterHigh-pass filter Removes slow drifts and DC offsets, passing everything above a cutoff; set it too high and you erase slow brain activity. , Low-pass filterLow-pass filter Removes fast content above a cutoff; the anti-alias filter is one, and so is the smoothing you apply to a noisy trace. , Notch filterNotch filter A very narrow filter that removes one frequency, usually 60 Hz mains hum; it also rings and distorts nearby content, so fix the hum at the source first. , Phase distortionPhase distortion Different frequencies being delayed by different amounts, which smears and shifts waveforms such as an ERP peak. . Glossary entry. A ferrite: keeping radio out of the analog section. When you reach a component you cannot explain, that is your reading for the evening.
Then do the same for the bias (DRLDriven-right-leg circuit A third electrode fed with an inverted copy of the common-mode signal, so the body's hum is actively cancelled instead of merely rejected. Related: Common-mode signalCommon-mode signal A voltage that appears equally on both inputs of a differential amplifier, such as 60 Hz hum picked up by the whole body. , Ground electrodeGround electrode The electrode that ties the body to the amplifier's zero and, in a good design, is driven to cancel common-mode hum. . Glossary entry) path, the reference path, the power path from battery to analog rail, and the SPISPI A simple four-wire bus for talking to chips like the ADS1299 from a microcontroller. Related: FirmwareFirmware The program running on the microcontroller, which configures the chip, reads samples on time, and ships them to the computer. . Glossary entry lines. Four highlighter colours. Photograph the annotated schematic into your notebook.
Read the firmware like this
Find three things. The register initialization: which registers are written at startup and to what values; compare each to the datasheetDatasheet The manufacturer's document for a chip: pinout, limits, typical performance, and the reference circuit you should start from. Glossary entry’s register map. The data-ready handler: how the frame is read and how the 24-bit two’s-complement values are unpacked. The scaling: the line that turns counts into volts, and the constant in it. Compute the constant yourself from the reference voltage, gainGain How many times an amplifier multiplies its input; 1000× turns 50 microvolts into 50 millivolts, enough for an ADC to see. Related: Instrumentation amplifierInstrumentation amplifier A precision differential amplifier with very high input impedance and high CMRR, built from three op-amps and sold as a single chip such as the INA128 or AD8232. . Glossary entry, and bit depth, and check it matches.
If you find a discrepancy, you have found either a bug or a subtlety, and either one is worth a note in the OpenBCIOpenBCI The open-source EEG hardware company whose Cyton (ADS1299) and Ganglion boards are the default hobby and research-lite amplifiers. Related: ADS1299ADS1299 Texas Instruments' 8-channel, 24-bit biopotential front-end chip used in OpenBCI and many research amplifiers. , BrainFlowBrainFlow A library that talks to OpenBCI and most consumer EEG headsets with one API, in Python and other languages. . Glossary entry forum.
Measure it like it is yours
The phantom head and the characterization report apply to a bought board unchanged. Noise floorNoise floor What your instrument records when the input is shorted or connected to a perfectly quiet source; everything smaller than this is invisible to you. Related: Thermal (Johnson) noiseThermal (Johnson) noise The random voltage every resistor produces just by being warm; about 13 nanovolts per root hertz for 10 kilohms, which matters at microvolt levels. , CharacterizationCharacterization Measuring what your instrument actually does, such as its noise floor, bandwidth, and rejection, instead of assuming the datasheet. . Glossary entry with inputs shorted. Common-mode rejection with a known hum injected. GainGain How many times an amplifier multiplies its input; 1000× turns 50 microvolts into 50 millivolts, enough for an ADC to see. Related: Instrumentation amplifierInstrumentation amplifier A precision differential amplifier with very high input impedance and high CMRR, built from three op-amps and sold as a single chip such as the INA128 or AD8232. . Glossary entry accuracy and bandwidth with a swept sine. Crosstalk between channels. Compare each to the manufacturer’s stated numbers. Boards usually meet them; the exercise is in knowing how to check.
Modify one thing
Once you can read it, change it. Ideas: replace the stock electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry with ones you made in the electrodes project and compare impedance and noise. Write your own receiver in Python that speaks the board’s serial protocol and publishes to LSLLab Streaming Layer (LSL) A protocol that timestamps and synchronizes streams from many devices and stimulus programs on a network; every BCI lab uses it. Related: PsychoPyPsychoPy Free Python software for presenting stimuli with precise timing and logging responses., BrainFlowBrainFlow A library that talks to OpenBCI and most consumer EEG headsets with one API, in Python and other languages.. Glossary entry. Add a hardware trigger input for experiment timing. Design a 3D-printed headset that positions the electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry at O1, O2, C3, and C4 repeatably.