This post is the first post in a series aimed at documenting the process behind making a functional BCI at low-cost and with minimal experience. If you haven’t done so, I’d recommend first reading my introductory post about this series that features some background information + necessary parts and associated costs (and some tips for the purchases inspired by my own costly mistakes)
The Agenda
- Hack your Mindflex with an Arduino
- What you need:
- Mindflex headset
- Wires
- Soldering iron + solder
- Arduino
- What you need:
- Read Data on the Arduino IDE
- What you need:
- Arduino IDE
- What you need:
Step 1: The Prep
Alrighty, so first things first, we need to prep. This means installations, set-up, and mental preparation.
Installations
- Download the free Arduino IDE
Just go to https://www.arduino.cc/en/software and follow the installation steps. The Arduino IDE (Integrated development environment) is simply a piece of software that you can use to write code and upload said codes into the Arduino board for it to execute.
- Install the Brain library
Once you have the IDE installed, you can download several libraries (itself a collection of code) which can facilitate making the Arduino do certain things. For our purposes, we will need the Brain library from kitschpatrol to be able to read the Electrical signals picked up by the headband. Here’s is the github repo with all the source code and some examples and documentation on how to use the library https://github.com/kitschpatrol/Brain.
Now, there are a few ways to download the library: Using Library manager, Importing a zip file, and Manual installation. Below, I outline the way I downloaded the library on my Mac (manual installation). A windows tutorial of all options is available at https://www.arduino.cc/en/guide/libraries.
Download the Brain Library:
- Navigate to https://github.com/kitschpatrol/Brain
- Click the green download code button on the right. This will start a zip-file download.
- Find where your Arduino folder is on your mac and open it. You can do this by typing Arduino into your finder search bar and opening the folder that looks like this:
4. Open the “libraries” folder
5. Drag the downloaded zip file into the “libraries” folder and unzip the zip file (by double-clicking on it). This will open a folder with the same name into the “libraries” folder.
6. Check to make sure the opened folder has the file “Brain.h”.
7. Delete the Zip File
Here’s a video demonstration of me downloading the library:
- Find a python IDE
I use Visual Studio Code in order to script and run my python codes. It is a free IDE (Integrated development environment) that can be downloaded by follwoing the steps here: https://code.visualstudio.com/
If you don’t have python downloaded, you might also want to download that by following the steps here: https://www.python.org/downloads/
Prep for Soldering
Here’s a heads up: the hardest (the most frustrating, rather) part of this phase is likely the soldering. It is so so easy to charr the whole circuit board of the Mindflex headset. In my previous post, I recommended getting two headsets as part of the Mindflex duo. If you did, practice soldering the first one. I completely butchered my first headset and ended up taking it completely apart to understand the circuit board and nailed the soldering on my second headset. Another very very very important tip that I mentioned in my introductory post is the tip (no pun intended) of the soldering iron: you want to purchase a thin-tipped one. My unfortunate purchase of a thick tipped iron was the primary reason my first board ended up marred.
Go back to my introductory post to see recommended soldering irons as well as my unfortunate first purchase.
If you are a first-time solderer, here is a quick resource to get you acquainted with the whole process:
This project requires relatively easy soldering, so you’ll be fine.
Step 2: The hack
Now, for the hack. The whole process is very nicely documented in this tutorial from http://www.frontiernerds.com/brain-hack.
Here’s a quick summary regardless. When you unscrew the left side of teh headset, you are met with a circuit bqard. This circuit board has two points we are interested in. One point is the “T pin” where the electrical signals are transmitted. Another is the “ground” that closes the whole electrical circuit. We need two wires: one to ‘glue’ onto the T pin and one to ‘glue’ onto the ground terminal. We do this ‘gluing’ by soldering: i.e. we place the wire in position, we melt some metal onto it, the metal cools down and voila! your wire stays in place and is electrically connected to the headband.
Here’s a neat video walkthrough of the whole process which is what I followed:
As the video highlights, after all the soldering, it’s time to test if the hack actually worked! Here’s how you do that and some other helpful pointers that the video doesn’t mention:
- Take the wire that you soldered onto the ground terminal and insert it into the ground terminal of the Arduino:
2. Open your Arduino IDE and navigate to File>Examples>Brain-Master>BrainSerialTest.
3. Click the right arrow on the top left (this is the upload button).
4. Once successfully uploaded message is seen, and only after this, connect your T-pin wire to the Rx terminal of the Arduino (this is terminal 0 on the Arduino).
5. Now open the Serial Monitor (click the search button on the top-right corner) and you should see data flowing in as such:
If you don’t see any data:
- Check that the soldering is good: i.e. the wire is properly secured and that you haven’t dropped a big blob of solder that touched neighboring points.
- Make sure that you’re Headset is turned on.
- Make sure you did not insert the T-pin wire into the Rx terminal at the time of uploading. (This is the case if you see a the following error while uploading).
Here are some other common issues you may run into and solutions: https://www.arduino.cc/en/Main/Troubleshooting
What Next?
Next up is building the Data Collection Module <add link>! We will be using this to collect and store the EEG signals under a simple experimentation set-up which we can then use to train the Neural Network that will classify the EEG signals as being reflective of mind-wandering or not.
See you there!
Comments are closed