In the previous part
In Part 3 I used that alpha signal to move the car, but it changed too slowly for predictable real-time control. Steering required a signal that separated left-hand from right-hand imagery, so I had to replace the single forehead electrode with a recorder that could measure over the motor cortex.
Choosing the recorder
First decision was whether I should buy a new EEG recorder. After my experience with the software of the MindWave headset, I was afraid of being limited again by another proprietary software, this time Emotiv, and paying 10k PLN for that. I considered ordering an open-source OpenBCI Cyton board - a usual go-to solution for research-grade EEG recordings - but the cost was difficult to justify, and the purchase restrictions in place at the time meant I could not buy it as a private individual.
I looked then into the technical specification of said OpenBCI board and found that it was powered by an ADS1299 chip, an analog front-end chip that is used in most professional EEG systems that cost more than I could afford. The difference was that the Cyton board had a pre-built technological stack needed for data acquisition: power circuitry, wireless interface, electrode connectors, protection, and firmware. So, I decided to buy the ADS1299 and build all the peripherals by myself. This would effectively get me the functionality of an expensive EEG set at the fraction of the cost at the expense of some additional electrical noise that would be introduced by my homemade hardware.
This solved the purchasing problem and created several new problems of the more traditional kind: figuring how to power the chip on, initialize it, and start a data stream. Even if I would succeed at that, most importantly, I had to validate that my homemade device would even be able to collect me the data that I was going after - motor imagery activity.
The ADS1299 has 8 input channels. Most research-grade motor imagery datasets use 22 channels, so I already knew I would not be able to replicate that setup from the start and had to keep that limitation in mind. Also, I would have to apply the electrodes to my own head, check their contact quality, keep them mechanically stable, and work out which one was responsible whenever noise appeared. Every additional electrode meant another cable, another contact point, and another possible reason for the recording not to work.
All that meant I had to simplify the system as much as possible. The problem was then to find the smallest electrode montage that still had the spatial information required for reliable motor imagery classification.
Testing before building
I could not answer that question using recordings from the ADS1299 because the recorder did not exist yet. Even after building it, a failed classification would mix several possible problems together: the homemade hardware could be noisy, I might not produce a clearly detectable motor imagery response, the selected electrodes might be insufficient, or the analysis method might be unable to extract the signal. A result near 50% would tell me that something had failed, but not which part.
Why 50% accuracy is useless here
The task has 2 balanced classes: left-hand and right-hand imagery. A classifier guessing between them at random will be correct about half of the time, so an accuracy near 50% means that its predictions contain no usable information about the imagined hand. It does not explain why. A clean recorder used on a person with no separable response, a noisy recorder used on a strong performer, and a valid recording processed with the wrong electrodes or method can all produce the same score. The number says that the complete setup performs like guessing, but it cannot identify which part of that setup caused the failure.
For this reason, I first tested the electrode configurations on BCI Competition IV 2a, a public motor imagery dataset recorded with a full 22-electrode research setup. I used only its left-hand and right-hand trials, because this was the distinction I needed for steering. The advantage was that I could take the same recorded trials, keep all 22 electrodes as a reference, and then remove electrodes in software until only the proposed homemade montage remained. The subject, the task, and the recorded movement imagery stayed the same. Only the electrodes and the method used to analyze them changed.
The dataset contained recordings from 9 subjects, which mattered because motor imagery does not work equally well for everyone. I did not know whether I would be a strong or weak motor imagery performer, so selecting the setup from one convenient subject would not tell me much. I evaluated every subject separately and then averaged their results. This gave me a group-level comparison under research-recording conditions instead of a prediction based on whichever brain happened to look best.
Benchmark procedure
For each subject, I used repeated stratified cross-validation with 5 folds and 10 repeats. In every split, the model was trained on one part of the labelled trials and tested on trials it had not seen during training. Linear Discriminant Analysis (LDA) was kept as the classifier throughout, so the comparison changed the electrodes and features rather than the final decision rule. The reported values are the averages across all 9 subjects.
Cross-validation limitation
The current split does not preserve recording-run boundaries. Trials affected by the same artifact can therefore appear in both training and test folds, which may inflate the absolute accuracies. The analysis should be repeated with run-aware groups before publication. I use the present numbers only to compare configurations under the same procedure, not as an estimate of how well the homemade recorder will perform.
Reproducing the standard analysis
Before deciding what could be removed, I first needed to reproduce what I treated as the gold-standard motor imagery analysis in its complete form. I looked through existing approaches and found that Common Spatial Patterns (CSP) was the usual method for distinguishing left- and right-hand imagery from multi-channel EEG. This gave me a reference implementation instead of forcing me to judge a reduced setup without knowing what the same analysis could do under research conditions.
An EEG electrode does not record activity from one isolated point directly underneath it. Each channel contains local activity mixed with signals spreading from other parts of the brain, electrical interference, and changes in contact or baseline that can appear at several recording sites at the same time. The useful motor imagery information is partly spatial: left- and right-hand imagery change the balance of activity across different locations rather than producing one value at one electrode.
CSP uses that spatial relationship. Instead of calculating the power of every electrode independently, it learns weighted combinations of the channels whose variance differs as much as possible between the 2 classes, and then uses the log-variance of those combined signals as features. A filter can, for example, reduce activity shared by several electrodes while preserving a difference that is stronger on one side during left- or right-hand imagery.
Common Spatial Patterns
CSP creates virtual channels by adding and subtracting the recorded channels with different weights. If the same noise, drift, or broadly distributed brain activity appears at several electrodes, a difference-like filter can reduce that shared component. Activity that changes differently between locations can remain. Because CSP learns the weights from labelled left- and right-hand trials, it selects the combinations whose variance best separates those classes. It is therefore not a general noise-removal algorithm and will not automatically remove every artifact, but it can suppress common components that do not help the classification. More electrodes give it more spatial directions from which to separate shared and local activity.
I first ran CSP with all 22 EEG channels in the dataset. Across the 9 subjects, the model reached an average accuracy of 77.6%. This was not a universal threshold for a proper motor imagery classifier, because the expected accuracy depends on the dataset, task, subjects, and evaluation method. For this experiment, however, 77.6% was the research-grade reference: the result produced by the established method using the complete montage under the same evaluation procedure that I would later apply to the reduced versions.
At that point the analysis itself worked. The problem was then to remove as much hardware as possible without moving too far away from 77.6%.
Reducing the montage to C3 and C4
My initial assumption was that 2 electrodes would be enough. Left-hand and right-hand imagery produce their strongest difference around C3 and C4, which sit over the left and right motor areas. If the task was to distinguish those 2 sides, measuring one point on each side seemed like the smallest reasonable setup.
I kept the same CSP method and removed the other 20 channels in software. With only C3 and C4, the average accuracy fell from 77.6% to 62.7%. The reduction had saved almost the entire electrode cap, but it also cost almost 15 percentage points. Two electrodes retained some left-right information, but they had left CSP with very little spatial structure to work with.
For comparison, I also repeated the simpler analysis I had used in the previous parts. I filtered C3 and C4 to the mu band, calculated band power separately at each electrode, and passed those 2 values to LDA. This setup reached 60.7%, only 2 points below CSP. With 2 channels, the spatial method had mostly collapsed toward the result of reading the 2 electrodes independently.
The initial hypothesis did not hold. C3 and C4 were the correct region, but reducing the full montage directly to those 2 points was too drastic. I needed another electrode that added useful spatial information without bringing back the practical problems of a full cap.
Adding Cz
The next option was Cz, which sits between C3 and C4. My hypothesis was that it could measure activity and noise shared by both sides, giving CSP an additional input against which the C3/C4 difference could be separated. In practical terms, it would cost me one more cable and contact point instead of another 20.
This mechanism was only a hypothesis, so I repeated both analyses with C3, C4, and Cz. If Cz merely contributed another independent band-power measurement, both methods could improve in a similar way. If it gave CSP useful spatial structure, the CSP result should improve much more than band power.
That is what happened. Band power moved from 60.7% with 2 channels to 62.1% with 3, an increase of 1.4 points. CSP moved from 62.7% to 70.4%, an increase of 7.7 points. Adding Cz did not help much when each electrode was analyzed independently, but it restored most of the advantage of spatial filtering.
| Configuration | Average accuracy |
|---|---|
| CSP, 22 channels | 77.6% |
| CSP, C3/C4/Cz | 70.4% |
| CSP, C3/C4 | 62.7% |
| Band power, C3/C4/Cz | 62.1% |
| Band power, C3/C4 | 60.7% |
The comparison produced a fairly asymmetric trade. Going from 22 electrodes to C3/C4/Cz removed 19 electrodes and cost 7.2 points. Going from C3/C4/Cz to only C3/C4 removed 1 electrode and cost another 7.7 points. Since the ADS1299 already had 8 inputs, limiting myself to 2 channels would save almost nothing in the electronics and make the classifier considerably worse.
Interpretation of Cz
The accuracy recovery after adding Cz is measured. The explanation that CSP uses Cz to estimate and suppress activity common to C3 and C4 is still only my hypothesis. It should be checked against the learned CSP patterns before treating it as the confirmed mechanism.
Differences between subjects
The average concealed large differences between people. Subjects 2 and 5 stayed close to chance under almost every configuration, while subjects 1, 3, 8, and 9 produced much clearer left-right separation. The extra electrodes also helped different people by different amounts.
CSP accuracy by subject
| Subject | 22 channels | C3/C4/Cz | C3/C4 |
|---|---|---|---|
| 1 | 85.8% | 81.6% | 64.6% |
| 2 | 57.3% | 48.9% | 50.0% |
| 3 | 94.8% | 89.6% | 84.7% |
| 4 | 70.5% | 66.6% | 60.8% |
| 5 | 55.9% | 51.7% | 53.8% |
| 6 | 74.3% | 64.9% | 59.7% |
| 7 | 83.0% | 66.3% | 61.1% |
| 8 | 94.4% | 84.4% | 59.7% |
| 9 | 82.6% | 79.9% | 69.9% |
For several of the stronger subjects, reducing the montage from 22 channels to 3 cost less than the group average. Subject 9 dropped only 2.7 points, subject 1 dropped 4.2, and subject 3 dropped 5.2. Other subjects lost much more. Since I had no way to know in advance where I would sit in that distribution, the 9-subject average was the more useful value for choosing the hardware. It represented the configuration across different motor imagery responses rather than assuming that I would be one of the convenient cases.
The chance-level results also set a limit on what the benchmark could tell me. They showed that the same equipment and method did not produce a useful classifier for every person. They did not prove that those subjects had no physiological motor imagery response, because that would require analyzing the underlying Event-Related Desynchronization directly, but they did show that no electrode configuration could guarantee success on my head.
Final configuration
I selected 3 recording channels at C3, C4, and Cz, with CSP features followed by LDA. This was the smallest tested setup that kept most of the performance of the 22-channel reference. Band power remained useful as a simple baseline, but adding Cz made a practical difference only when the method could combine the channels spatially.
The public dataset settled what I should build, but it could not verify the homemade recorder or tell me whether my own motor imagery response would be easy to classify. The next step was therefore more physical: assemble the ADS1299 recorder, attach the first 3 electrodes, and find out whether the new EEG set would record anything useful from my head.