Playing the No Internet Dino game just by blinking
A couple months ago I published an article about Brain Computer Interfaces. At that time I was pretty new to the technology and was just starting to learn about it. After I published the article, I started to work on a project about Brain Computer Interfaces. For my first time, I didn’t want to start from scratch, so I recreated a project which is playing the No internet Dinosaur game just by blinking!
In this article I will discuss the project so far, what I have learned and my key takeaways from this project. This is my first attempt to code a Brain Computer Interface application.
EEG Brainwave Data
I started out with limited knowledge about this technology because I had only been researching it for about 2 weeks. At first, I wanted to be able to see my raw EEG data stream onto my computer because I thought it would be a good start. EEG data is the data that is collected from a EEG device. The EEG device that I used was a Muse 2 headband. EEG devices are a non invasive way of collecting brainwave data. The EEG device senses the signals that neurons create in your brain. These signals are the brain communicating to preform tasks such as walking and talking, and more complex ones.
The raw EEG data is used to code commands for a Brain Computer Interface application. I was able to stream my brainwave data by using Blue Muse and LSL lab recorder. Blue Muse is an application that connects the Muse headband to the computer and it creates an LSL bridge which can automatically connect to LSL lab recorder. Then, from LSL lab recorder you are able to save your brainwave data into a file which you can open with a text editor. On the text editor, the raw EEG data will start to stream in. I was very proud when I got this to work. It was extremely exciting to see all the numbers and letters constantly streaming onto my device.
How does playing the No Internet Dinosaur game by blinking work?
The project I decided to work on was playing the No internet Dinosaur game just by blinking. This is done through Brain Computer Interfaces. The first thing that is needed is someway of collecting the brainwave data. In my case, I used the Muse 2 headband. Electrodes are the sensors that record the brainwave data. There are electrodes placed all around the Muse headband and the ones on your forehead detect blinks which is what we need for this project.
I downloaded a copy of the game so that I could code the application into it. Next, I downloaded NPM software to install Muse-JS and System-JS. There are different pieces of code that I added to the original game to reach my goal. The first piece of code was added into the index.html page. This code interacts with the System-JS and lets it load. It also allows the computer to know where to find rxjs and muse-js. This piece of code also loads a file called brain.js. The code that goes into the brain.js file is supposed to initialize Muse Client, detect blinks from the left eye, filter the blinks and press the space bar like the user normally would. Lastly, there is a connect button to run the function connectToMuse().
Web Bluetooth API
For the No Internet Dinosaur game part of this project, I needed a different way of connecting my Muse headband to my computer other than Blue Muse so I decided to code a Web Bluetooth API. Web Bluetooth is an application that enables access to Bluetooth devices through a web browser. Before Web Bluetooth was created, users could only interact with Bluetooth devices through native apps, but with Web Bluetooth it is possible to connect with a device by using the web. It is also pretty accessible to create because all you need is a browser and there are many helpful tutorials on how to create a Web Bluetooth API.
After I completed all of these steps, I ran into an issue that I am still fixing, but my project is mostly finished!
I am really happy with this project so far. I am very proud of all the things I have accomplished and learned. I’ve learnt more about an interesting topic, I have improved my JavaScript coding abilities and overall it is a challenging, but helpful experience. This project wasn’t too complex because it was a starter project to prepare myself for more challenging projects in the future. After I finish this project, I am thinking of creating something new that is completely from scratch. I will take what I learned from this experience and apply it to the next one. Brain Computer Interfaces are truly fascinating and I am excited to do more projects like this in the future!