students x students

Providing a platform to uplift student voices and give them greater confidence and fulfillment in their writing.

Follow publication

Playing Geometry Dash with my Brain

--

Geometry Dash is a fantastic rhythmic game I’ve enjoyed playing a lot in the past. In this article, I go through the steps of my process with this project.

Overview

1. Hardware

  • the board and electrodes
  • the headsets
  • putting them together

2. Software

  • OpenBCI GUI
  • Brainflow
  • My Code

Hardware

The Board and Electrodes

To complete this project, I used brain-computer interfaces, here’s a link to a video explaining the basics of BCIs. In short, they’re devices that allow your brain and a machine to communicate. I used the Ganglion board from OpenBCI. OpenBCI boards are basically the Arduino of the BCI world and are built mainly for developers and researchers who want to build things with them.

Ganglion Board and Dry Comb Electrode

The Ganglion Board allows 4 channels of data and I used dry electrodes with them. I used the comb electrodes just because they worked better but I wouldn’t recommend them because they did actually hurt quite a bit.

The Headset

The Headset Didn’t Fit Me

Although I had the Ultracortex Mark III, I couldn’t use it because it didn’t fit so I made 2 different headsets.

One I made out of cardboard:

Materials:

  • cardboard
  • a metal wire
  • tape(LOTS OF TAPE)
  • rubber bands

This headset went more for the look of the Ultracortex Mark IV and it was extremely functional and worked well. I didn’t end up using this because it wasn’t the comfiest and I realized I only needed 2 EEG channels so I decided to make a new headset. This headset is a lot better for when recording data if you have to move around more as it has a place to hold the battery and board. It's a little uncomfortable but it's worth it as its portable and can hold many electrodes.

Materials

  • an old headband
  • elastics
  • superglue(to make the small elastic rings holding the electrodes in place DO NOT SUPERGLUE THE ELECTRODES TO THE HEADBAND)

This headset took inspiration from the OpenBCI EEG Headband Kit and although it hurt from the electrodes(not the headset's fault), my results were a lot better. I’d say this headset is better for when you’re recording data while stationary and it's definitely comfier.

Putting the Two Together

Software

OpenBCI GUI

OpenBCI has free software that helps you visualize, record and stream data from their boards. Here you can see that I only had 2 active channels and the places I circled was when I blinked.

Brainflow

Brainflow is a library that integrates with most BCI boards and it's the library I used. It can obtain, parse and analyze the data from many biosensors and works with up to 7 languages and I used python

Brainflow has 3 main parts it, BoardShim, DataFilter and MLModel. The BoardShim mainly helps you get and read data and the DataFilter helps you work with it. I didn’t use the MLModel but it helps you use AI with your data. I referenced the API and documentation a lot while coding.

My Code

To see my full code, here’s the GitHub(i added comments so if you’re more familiar with it, reading that might be faster for you).

Imported Packages:

Setting up the board and values:

The board has specific parameters specified in this link. Each board has a board-id to tell brainflow how to work with it. The Ganglion ID is 1 and the parameters it needed was the serial port.

The values defined will change later.

Calibration

The calibration sequence makes you blink a few times and collects the maximum value and the average value of the data. To get the threshold, we subtract the average value from the maximum value.

Threshold — if the amplitude goes over this number, the code will press the space bar on my laptop

Main

If the data collected is greater than the threshold value(this will happen when you blink), it will press the spacebar and it uses pydirectinput to do this.

Here is a live demo of how it works:

It does work for more than just geometry dash and you can pretty much do any repetitive action by switching out the pydirectinput command. This was honestly a really fun project to work on, and I made a video on the experience:

--

--

Published in students x students

Providing a platform to uplift student voices and give them greater confidence and fulfillment in their writing.

No responses yet