Electroencephalography (EEG) is a technology that allows us to read brainwaves in a non-invasive way. They are currently the most affordable and portable way to access brainwave data. Their excellent temporal resolution means that we can record data in real-time. For this project, I leveraged the high temporal resolution of EEGs to recreate the classic game snake to be controlled with your mind. The game uses the Muse headband to measure EEG data.
· · ·
How the Game Works
Unlike the original snake, which would take 4 inputs, (moving in the direction of the arrow keys) this version takes 2 inputs, either right or left.
EEG Retrieval
The first step to the game is retrieving the brainwave data from the player. The Muse headband uses Bluetooth to transmit the data to the computer. The computer receives the computer through a program called Muse Direct. This program then sends the data using UDP over a port on the computer.
The Game Recieves the Data
The game acts as a client as listens to the port to access the raw EEG data from the headband.
Data Analysis
The EEG data is then processes using classification algorithms to determine which way the player wants to turn. It figures out if the player has blinked or clenched their jaw.
As you can see, blinking and clenching your jaw create landmarks in your brainwave data that are easy to recognize. When you close your eyes, there is a negative spike in activity, while opening your eyes creates a positive spike in activity.
This is because when you close your eyes, your brain is fires neurons to activate the muscles in your eye lids. These signals cause interferences which are coming up as these spikes.
When you clench your Jaw, it causes even more aggressive interference in the recorded waves, which the game can easily pick up on.
These interferences are called artifacts, and while they are normally a bane of EEGs, they’re actually pretty useful as reliable BCI controls.
Snake Movement
The game turns the snake based on the brainwaves and the user can now play the game without lifting a finger!