Building bedroom BCIs: Five things I wish I knew.

No one told me, so I am telling you.

NeuroTechX Content Lab
NeuroTechX Content Lab
11 min readJul 7, 2021

--

My first attempt to build a BCI failed completely. I became interested in BCIs while completing my masters in artificial intelligence, and I needed some credits to complete the semester — so there I went, building a BCI in my bedroom. I bought a Muse 2016 headset and, leveraging my background in human movement sciences, attempted to make a movement BCI. My goal was to control a cursor with hand movements, and the best result I achieved was… exactly random. That was disappointing, and I had to put in some extra work in the final report to explain why it did not work. Eventually, I pivoted to a simpler project in which a BCI produced a beep when I focussed on my breath, which it produced about 70% of the time that it should.

Now, as a PhD candidate working with movement-based BCIs using surgically implanted depth electrodes, I can only enjoy the naivety with which I started this journey. There were many things on which I wasted a lot of time that could have been prevented. I strongly believe that making these mistakes was an essential part of my learning process, so I do not regret making them. However, my first attempts were undirected, unstructured, and, I suspect, filled with common problems that many starting BCI enthusiasts encounter.

To provide a helping hand, here are five things I wish I knew before starting.

A quick note: I discuss many BCI related concepts, but go past some basic technicalities, such as oscillatory waves, filtering and artifact removal. This piece does not aim to explain those specific techniques, but if you want to read more about them, NeurotechX Edu would be a good place to start.

Location is everything.

A well-known adage in real-estate goes as follows: “there are three things that matter in property: location, location, location.” I learned the hard way that the same is true for brain-computer interfaces. I tried for hours on end to get a model to work with an electrode contact only mildly close to the source of interest, as I attempted to use TP9 and TP10 (next to your ears) to detect a hand movement signal, which is generally measured most strongly from C3 and C4, a little higher up the on head. Eventually, I gave up (which was a sensible idea) and moved on to something that I was better able to measure: focus.

Focus-related activity can be measured in the prefrontal cortex. So, a sensor on your forehead should be suitable. The Muse headset I was using had two sensors at that exact location, because the product is aimed at meditation, which itself is related to focus. Lo and behold, my system started working within a single day. When I closed my eyes and focussed on my breath, my alpha wave activity would increase. When the alpha activity reached a certain threshold, it would play a beep.

This taught me that having the right location is essential to achieve some performance. If not, in the best case you might catch some correlated process by chance. However, later I learned that when you have the right location, you still have many uncertainties, one of which is the definition of the ‘thing’ you are trying to measure.

Most brain functions are made-up concepts.

Okay, I admit it is a strong statement, but it is true, especially in cognitive psychology. Let me explain. You might recognize the terms: ‘attention’, ‘cognition’, ‘perception’ and ‘sensation’. These are universal terms in cognitive psychology, which date back more than a century, to around 1890. In that year the philosopher, psychologist, physiologist and professor William James wrote the book The Principles of Psychology, in which he described these terms. In these early days, psychologists and philosophers started to move from reasoning to experimenting, by exploring how the brain processed information from its sensors, like eyes and ears. By doing this, they simultaneously thought up properties of the ‘thing to sense’ and a process in the brain, and then experimentally tried to see if the two would match. When the field of neuroscience later arose, the psychological concepts were used as the ‘thing to model’, i.e. to find patterns in neuroscientific data that fit the psychological concept.

While this way of researching the brain was — and still is — absolutely invaluable and resulted in a century full of important neuroscientific achievements, we still use a version of the same made-up concepts today. In a BCI context, this raises some problems, because we try to reconstruct a vague image of something that is ill-defined to start with. First, we choose a made-up concept that we want our BCI to output — like attention — then we find a correlated pattern of activity in the literature that supposedly matches our chosen concept. And finally we try to reverse-engineer the chosen concept to generate output of our BCI using the measured signal.

We come up with what we consider a function of the brain and then look for patterns or observations that fit this definition, while instead we might be better off building definitions based on observations. It is easy to think of many possible brain functions, and this is illustrated by an explosion of different brain functions being ‘discovered’ during the last century that a single area of the brain supposedly handles. For example, the following is a list of cognitive terms attributed to the prefrontal cortex: intention, focus, personality, imagination, control, consciousness, decisions, planning (and many more!). In my own field of expertise — the more defined and better understood motor cortex — the same phenomenon occurs when I attempt to design an experiment where the participant should move as naturally as possible: voluntary movement, naturalistic movement, goal-directed-movement, volitional movement, etc. All of these terms are very similar, but are they really all different processes? And how would you define involuntary movement — aside from reflexes?

This seems like an obscure theoretical sidestep — so why do I wish I knew this before building my bedroom BCI? Because if so, I would not have lost myself in the many different terms and research areas that cover all these cognitive constructs. Knowing this has helped me think critically about my own work and the related work I read. It has helped me to ask more fundamental questions, regarding what it is we are actually talking about when we discuss neuroscience. From my experience, we may think we understand each other more often than we actually do.

With this statement, I hope to show that concepts and their related processes are only estimates of correlated brain processes, and to nudge you to develop your hypothesis more from the basis of observations you make, such as which way brain waves change, than starting from concepts, attention must induce an increase in alpha. In a BCI context, you might even argue to move away from concepts to decipher, and just use any task related activity.

Structured data gives structured results.

Having discussed the measurement setup and some theoretical considerations, let us progress into the most practical section of this list: how to structure your data. Many guides discuss processing steps from data acquisition to decoding algorithms, but how to structure your data is rarely explained. This is an essential and potentially time-consuming part of your BCI-project. When I was building my beep-playing BCI, I spent a lot of time on trial-and-error to gather all the data I required. Consequently, I had to re-run my setup again and again, because each time I was missing important data. So, to save you some time, here is my go-to structure.

For data acquisition, there are at least two streams of data: the data from your measurement device (brain activity) and your experiment data (what your BCI should predict, for example your hand moving to the left or right). Additional streams of data could, for example, be an audio stream or similar. You will need to synchronize the time across all data streams. This is very important, because a minor shift in time can have a significant effect on the BCI’s ability to decode the data.

Given the importance of this step, you should use available software to do this (unless you know what you are doing, but then you probably would not be reading this…). I recommend using the free software LabStreamingLayer, which allows you to record via LabRecorder. However, alternative options are available. Once you acquire some data, your dataset it will look something like this:

First, apply your desired preprocessing and feature engineering on the brain data. If you add features, be sure to add them to the same 2D matrix with brain data. For example: if you filter for beta and alpha activity, you can add these features as a new column per contact like: contact_1_beta, contact_1_alpha, contact_2_beta, etc.

Once you have done your preprocessing and feature extraction, you need to combine the brain data and experiment data. A versatile way to do this is to expand the experiment data to the timescale of the brain data. In a 3 second trial based setup, you have only one label for 3 seconds of brain data. By expanding the experiment data, you label all samples in the brain data from 0s to 3s with the corresponding experiment label. If you do so, you will end up with a matrix that looks something like this:

The ‘Label’ column indicates some instruction given during the experiment. For example: 1 is left hand movement, 2 is right hand movement and 0 is no movement. By structuring your data this way, you can decode it in both a continuous way (every few milliseconds) and on a trial-to-trial basis.

This resulting dataset can now be used directly for a decoding algorithm, which is often considered the fun part! However, before you start, there is another thing you should know.

The machine learning model rarely matters.

There are many different models you can use and explore when developing a brain-computer interface. The possibilities are endless and recent state-of-the-art results of deep-learning networks shown in the media make it tempting to try similar methods as well.

However, the simpler models tend to produce comparable predictions and often set a baseline that is hard to beat. Additionally, you most likely do not have enough data to properly train deep-learning models, and, if you do, the extra invested time often does not outweigh any increase in performance.

Personally, I often start with the out-of-the-box LDA from Sci-kit Learn and I have yet to find different methods that significantly perform better and are worth additional time investment. Of course, a minor improvement of performance can be essential when translating your BCI into practice, but I assume you are not at this stage (yet!). Especially in the earlier stages of your project, the biggest improvements can be made by improving your preprocessing, artifact removal and feature engineering to increasing the signal-to-noise ratio as much as possible. Aside from saving you a lot of time, you might also accidentally learn a lot about brain activity and signal processing!

Brain-computer interfaces just do not work very well, yet.

The final thing I wish I knew before starting to build my bedroom BCIs is that brain-computer interfaces, on the whole, simply do not work very well. My enthusiasm for BCIs was partly translated into overambition, thinking I would create the same things that I saw on the news — only to find out that it wasn’t that easy.

Recently, more and more amazing BCI results are being published in scientific journals and shown in the media (like this one — check out movie S2). But it is important to remember that these achievements are made with state-of-the-art equipment, often using invasive sensors, and developed by a multidisciplinary team of experts. The potential of BCIs may have game changing implications for many people worldwide, but the reality is far behind the expectations at this moment.

Even if you are a skilled engineer, your results are highly dependent on the hardware you use. Consumer-grade EEG devices (while improving!) simply do not have sufficient signal quality to reach high performance. So, this section is for some expectations management. In general, if your bedroom BCI project reaches about 70% accuracy, it is a job well done.

Even if your project doesn’t reach this level of accuracy there can be a million reasons why — even if you did everything correctly. Person-to-person and day-to-day variation in your data can easily change the model output from good to borderline random. All you can do is try to find the reason that it does not work well, so you can improve on that next time around. A well-considered analysis on why something does not work can be even more valuable to you and others than getting it right the first time.

So, what is next?

Maybe you have picked up something from my first steps into the world of BCI, maybe you even gained some enthusiasm and want to get working on your own bedroom BCI. That is awesome, but before you continue, ask yourself the following question: Why do I want this? What triggers my enthusiasm in my project and future goals?

I ask this because the answer can help you determine what you should focus on. Do you want to tinker around and build a nice party trick? Then focus on a simple example, already demonstrated or published in literature (don’t forget to hook up some cool gadgets too). Or do you want to continue in the field and aim to make BCIs that people might benefit from one day? Then, focussing on the science behind your work is essential.

My best advice would then be to use your hobby project as a springboard to get a first job at a company or a position at a research institute, and learn more under guidance there. Do not worry about the outcome, but focus on the process. What did you try and why? What is your estimation on why it did (or did not) work? Remember that a clear explanation of what caused the project to fail is much more valuable than zero explanation of why it worked.

I hope this article has inspired you with new ideas or directions. If it has for at least one of you, I consider this piece a success. Of course, this article is all based on my own experience, and you will likely struggle with new and different topics too.

The main take-away I’d like to offer is to get going, start building, document your steps and make strides towards your end goal. And do not forget to enjoy the road in between!

Written by Maarten Ottenhoff, edited by Simon Guekes and Garrett Flynn, with artwork by Vishal Pandey.

Maarten Ottenhoff is a PhD candidate at Maastricht university, working on BCIs using invasive depth electrodes. His focus is on continuous decoding of movement related activity.

Simon Geukes recently graduated from the University of Amsterdam with a MSc in Cognitive Neurobiology and Clinical Neurophysiology.

Garrett Flynn is a creative technologist working at the intersection of neurotechnology, ethics, and interactive media.

Vishal Pandey is a neurotech enthusiast, learner and researcher.

--

--

NeuroTechX Content Lab
NeuroTechX Content Lab

NeuroTechX is a non-profit whose mission is to build a strong global neurotechnology community by providing key resources and learning opportunities.