First, After years of crippling apprehension associated with barrelling 50 miles an hour down tar, I finally started training to get my driver’s license this summer.

Second, I found that I had enough time and accumulated experience to inspire an exploratory dive into Brain-Computer Interfaces (BCI).

Third, I have very few friends in-state.

Consequently, this is how my schedule looked like for the first few weeks of summer break:

MorningsScroll resentfully through linkedIn
Read a few papers on EEG analyses and BCI technologies
Misc. coursera courses
EveningsPractice driving

Now, a few days with this schedule and I’d learnt two things:

  1. I tend to zone out when I’m driving (okay like sometimes, like quite rarely. I swear I’m safe to be on the road.)
  2. I’d gathered some idea on the processes behind developing a BCI device

So, it was only logical then that I should settle on the idea of developing a Neurofeedback device (basically something that reads your brain electrical signals, processes it, tells you something about your state of mind that you can then act upon to modify) that detects distracted driving.

Now that I have my license (yay!) and am almost finished with the device creation, I wanted to document the process and share code and resources (some created, some referenced) behind creating a functional BCI at low-cost and with minimal experience. That is the aim of the next series of post.

How to collect Brain Data – EEG devices ?

Now there are several ways to detect brain signals; most commonly used are

  • EEG: Electroencephalography(EEG) basically records brain activity by detecting electrical activity of the brain through electrodes non-invasively placed on the scalp. (P.S. these electrodes can be implanted in the brain too, leading to a similar method called Electrocorticography or intracranial EEG).
  • fMRI: Functional Magnetic Resonance Imaging (fMRI) records brain activity by detecting changed in blood flow in the brain. Here’s a little tidbit: there are differences in the magnetic properties between oxygen-rich and oxygen-poor blood. MRIs can provide static images of brain matter using the magnetic properties of neuron nuclei, fMRIs build on this existing technology to allow the visualizations of changes in oxygenation in the brain which is associated with changes in neuronal activity.
  • fNIRS: Functional near-infrared spectroscopy(fNIRS) records brain activity by detecting the changes in cerebral hemoglobin concentration using infra-red waves.

The most commonly used method in the context of BCI creation is EEG for its portability and low-cost.

When I was researching ways to get into hobbyist Neurotechnology, the largest barrier to entry – at least personally – was the cost. consumer grade EEG devices are pretty expensive: ranging anywhere from between $200(a Muse2 headset) to >$1000(openBCI and more). Good news struck me when I chanced upon this amazingly well-documented frontierNerds article on hacking a Mindflex toy (a single electrode device) to obtain reasonable EEG data: http://www.frontiernerds.com/brain-hack. It comes with an Arduino library that can be used to display the data collected and Processing code to visualize the data beautifully.

Materials and Cost

Without further ado, here’s my list of items and associated costs in developing the distracted driving Neurofeedback device.

ProductInfoCost
Mindflex toyThe toy comes with an EEG headband and an obstacle course (only the former of which we really need). It retails at about 100 dollars (https://www.amazon.com/Mattel-P2639-Mindflex-Game/dp/B001UEUHCG) but the good news is that there are plenty of parents looking to get rid of their kids’ pre-owned Mindflex toys that they realistically probably used twice or thrice. So hit ebay or Facebook Marketplace for a cheap deal on either just teh headset alone, or the whole game. I ended up purchasing just the headset on ebay for 30 dollars.

Words of advice:
– Now since these are pre-owned, it’s only realistic to expect receiving some what worn products. For one, my first purchase off of Facebook Marketplace came with included batteries that seemed to have been in there for 10 years. It worked fine but I had to do substantial cleaning first.
– I actually ended up completely butchering circuit board of the first headset while soldering leading to my second purchase off of ebay.

My advice is to buy (from ebay and facebok marketplace) headsets for Mindflex Duo which comes with two headsets. I remember seeing a listing for 40 dollars – hence costing you 20 dollars per headset. That way you can work efficiently with your second headset armed with the knowledge gained from completely taking apart the first.  
~$30
Arduino UnoThe main brain of our Neurofeedbcak device is going to be the Arduino Uno microcontroller. It’s going to read, process, and send data from our various appliances (EEG headband included). The original Arduino Uno retails for about 20 dollars (https://www.amazon.com/Arduino-A000066-ARDUINO-UNO-R3/dp/B008GRTSV6) but I use the Elegoo Uno board – which works just the same and can be used with the Arduino IDE and libraries – which retails for 10 dollars each (https://www.amazon.com/ELEGOO-Board-ATmega328P-ATMEGA16U2-Compliant/dp/B01EWOE0UU/ref=pd_lpo_1?pd_rd_i=B01EWOE0UU&psc=1)

P.S. the Arduino circuit design is open-source which other companies (like ELEGOO) can use to manufacture boards at a larger scale leading to cost benefits and hence cheaper selling price. For at-least hobbyist intents and purposes, the Arduino board and Elegoo boards work pretty much the same. However, Arduino is non-profit organization led by a team of engineers with a passion to help students and hobbyists get into electronics. They maintain the open-source Arduino board design and the Arduino IDE and the official boards finance the Arduino project, giving them the resources to continue the development of the Arduino projects and IDE. So, if you have a few bucks to spare, it’s worth the cause to get the official Arduino board.
$10
Soldering Iron + solderFor those unfamiliar, soldering is just connecting electrical wires with a conductive metal melted at a high temperature. Here are a few neat kits you can purchase on amazon:

https://www.amazon.com/Soldering-Interchangeable-Adjustable-Temperature-Enthusiast/dp/B087767KNW/ref=sr_1_7?dchild=1&keywords=soldering+iron&qid=1624633399&sr=8-7

https://www.amazon.com/ANBES-Soldering-Iron-Kit-Electronics/dp/B06XZ31W3M/ref=sr_1_3?dchild=1&keywords=soldering+kit&qid=1624633202&sr=8-3

The only word of advice, for the purposes of this project, is making sure you purchase an iron with a thin enough tip. My first purchase from home depot (amazon link for reference: https://www.amazon.com/dp/B000AS28UC/ref=redir_mobile_desktop?encoding=UTF8&aaxitk=affb4fdea8a0580208fffa11ab4f021e&hsa_cr_id=6323637260801&pd_rd_plhdr=t&pd_rd_r=e42aa178-0f8e-46e5-8185-3296f6f32d4f&pd_rd_w=TGIPu&pd_rd_wg=xVsHN&ref=sbx_be_s_sparkle_mcd_asin_0_img) had way too think of a tip, making soldering the tiny board on the MindFlex a night mare and resulted in burning several neighbour wires.
~ $15
Wires,
Resistor, Breadboards, Passive Buzzer, Button,
Battery power cable
These basically allow you to build the circuits we will need for data collection and the actual device. You can purchase each of the items separately on amazon but a GREAT value kit is the Elegoo starter kit which is what I had purchased (especially if you’re looking to get into hobbyist electronics) : P.S THE KIT COMES WITH AN ELEGOO BOARD: https://www.amazon.com/ELEGOO-Project-Tutorial-Controller-Projects/dp/B01D8KOZF4

Here are some individual links:
1. Button ($5) : https://www.amazon.com/Gikfun-6x6x5mm-Switch-Button-Arduino/dp/B00R17XUFC/ref=sr_1_6?dchild=1&keywords=arduino+buttons&qid=1624633955&sr=8-6
2. Breadboard ($5) : https://www.amazon.com/MCIGICM-6PCS-tie-Points-Breadboard-Arduino/dp/B07PZXD69L/ref=sr_1_5?dchild=1&keywords=arduino+breadboard+tiny&qid=1624633994&sr=8-5
3. Passive Buzzer ($5): https://www.amazon.com/Cylewet-Terminals-Electronic-Electromagnetic-Impedance/dp/B01NCOXB2Q/ref=sr_1_4?dchild=1&keywords=arduino+passive+buzzer&qid=1624634108&sr=8-4
4. Wires($6): https://www.amazon.com/Dorhea-Solderless-Flexible-Breadboard-Arduino/dp/B07HRMD6S2/ref=sr_1_52?dchild=1&keywords=Arduino+Wire&qid=1624640353&sr=8-52
5. Crocodile wires($6): https://www.amazon.com/Double-ended-Crocodile-Alligator-Testing-Multimeter/dp/B014QIB9KQ/ref=sr_1_32?dchild=1&keywords=Arduino+crocodile&qid=1624653360&sr=8-32
6. Battery kit($5) : https://www.amazon.com/Battery-Power-Barrel-Connector-Arduino/dp/B07NT79ZVB/ref=sr_1_5?dchild=1&keywords=battery+arduino&qid=1624639510&s=industrial&sr=1-5
7. Resistor (we are using 100 ohms) ($5): https://www.amazon.com/HONGYETAJA-Resistor-Tolerance-Compliant-Complete/dp/B08NYDB4L1/ref=pd_di_sccai_4/131-5218985-5583204?pd_rd_w=aC5Cg&pf_rd_p=c9443270-b914-4430-a90b-72e3e7e784e0&pf_rd_r=535BFFPYB3FWJFC0DCKV&pd_rd_r=4d6e3acf-d5be-4c65-964c-a54d1b8ee9f2&pd_rd_wg=2vhxa&pd_rd_i=B08NYDB4L1&psc=1

Advisory notes:
1. Make sure the buzzer is a passive buzzer (just because the code I will be sharing later depends on that – no other reason).
2. Crocodile wires are just to make data collection easier (any super long connector wire would do).
3. Again, purchasing the Elegoo starter kit (which comes with everything that you need for this project except for the crocodile wires, Mindflex, and soldering set) is the most bang-for-buck way to fuel this project.
~$40 ind.

Resources

Before diving into the creation of your own BCI, here is a good introductory article to get you acquainted with the concepts and methods behind it should you require them:

https://www.bitbrain.com/blog/brain-computer-interface-using-eeg-signal

I will, along the way, be linking more resources specific to the phase of creation we are in. So, stay tuned.

What next?

Here’s how the series of posts will be structured:

  1. Hack
  2. Data Collection
  3. Data Processing
  4. Make the Device: Software
  5. Make the Device: Hardware
  6. Real-Time Testing + Conclusion

Next up is learning how to Hack the Mindflex using the Arduino. Check that post out here:

Comments are closed