Control Dino Game Using Eye Blinks (EOG)

by Upside Down Labs in Circuits > Sensors

1940 Views, 8 Favorites, 0 Comments

Control Dino Game Using Eye Blinks (EOG)

EOG Dino Game.gif

In this tutorial, you are going to make a game controller that will allow you to play the dino game (dinosuar game that appears in offline mode on Google Chrome) at your home jsut by blinking your eyes. To do so we will be detecting the EOG signals from eyes and take the eye blink as a trigger to emulate the space bar on the keyboard.

But before moving forward, let's understand a brief about Electrooculography (EOG):

What is Electrooculography (EOG)?

Electrooculography (EOG) is a technique for measuring the corneo-retinal standing potential that exists between the front and the back of the human eye.The resulting signal is called the electrooculogram.

Supplies

DIY Neuroscience Kit - Pro (Front).jpg
DIY Neuroscience Kit - Pro (Contents).jpg

HARDWARE:

DIY Neuroscience Kit Pro (Upside Down Labs Store | Amazon India | Tindie | DigiKey )

The kit includes:

  • BioAmp EXG Pill (Assembled)
  • Arduino Uno with USB Cable
  • BioAmp Cable (100cm)
  • 3 x Jumper Cables
  • NuPrep Skin Preparation Gel (25g)
  • Wet Wipes x 10
  • Repositionable Gel Electrodes x 3
  • Boxy Gel Electrodes x 100
  • Gel Electrodes (4 variants, 6pcs each)
  • Muscle BioAmp Band (EMG Band)
  • Brain BioAmp Band (EEG Band)
  • Heart BioAmp Band (ECG)
  • Electrode Gel (30ml)
  • Servo Claw
  • Muscle BioAmp Shield Kit
  • Muscle BioAmp Shield v0.3 (Assembled)
  • BioAmp Cable (100cm)
  • Muscle BioAmp Band (EMG Band)
  • BioAmp AUX Cable
  • Gel Electrodes (4 variants, 6pcs each)
  • STEMMA Cables x 6
  • 9V Snap Cable

SOFTWARE:

Arduino IDE

About DIY Neuroscience Kit Pro:

It is like your Neuroscience Lab in a Box which lets you explore the world of neuroscience by recording various biopotential signals of your body (EEG, EMG, ECG, EOG) and making amazing HCI and BCI projects.

Stack Muscle BioAmp Shield on Arduino Uno

Stacking on Arduino Uno.gif

Stack the Muscle BioAmp Shield on top of Arduino Uno properly.

Connecting BioAmp EXG Pill

shield-pill-connection.png
shield-pill-connection-2.png

You can connect the BioAmp EXG Pill at A2 port of Muscle BioAmp Shield using the the 3 pin STEMMA cable as shown above.

Connecting Electrode Cable

EXG pill+ Shield connection 1.gif

Connect the BioAmp Cable to BioAmp EXG Pill as shown in the video above.

Skin Preparation

Skin Preparation.gif

Apply Nuprep Skin Preparation Gel on the skin surface where electrodes would be placed to remove dead skin cells and clean the skin from dirt. After rubbing the skin surface thoroughly, clean it with a wet wipe.

About Nuprep Gel:

Nuprep skin preparation gel is a mildly abrasive, highly conductive gel that should be applied before placing the electrodes on the skin to improve measurements. When applied gently, it strips away the top layer of skin and moistens the underlying skin layer which reduces the skin impedance with minimal skin irritation and discomfort.

Electrode Placements

Electrode Placements.jpg
  1. Connect the BioAmp Cable to gel electrodes,
  2. Peel the plastic backing from electrodes
  3. Place the IN+ and IN- cables on the forehead and below the eye & REF (reference) at the bony part, on the back side of your earlobe as shown above.

Download Arduino IDE

Download the Arduino IDE from the link given below:

https://www.arduino.cc/en/software

(We have used Arduino IDE version 1.8.19 for this project)

After downloading, connect the Arduino to your laptop using the USB Cable

Note: Make sure your laptop is not connected to a charger and sit 5m away from any AC appliances for best signal acquisition.

Coding Time!

Download the zip file from the link given below and unzip it in your laptop.

https://github.com/upsidedownlabs/Eye-BioAmp-Arduino-Firmware/tree/main/6_EOGDinoGame

Copy paste the Arduino Sketch in Arduino IDE and flash it on the Arduino Uno board.

Running Python Script

Python script ss_EOG Game.png

To run the python script with the python command, you need to open the command line/terminal and type in the word python or python3 (depending on the version you have) followed by the path to your script. In our case the name of the script is control.py which you can find in the unzipped folder.

After running the script you will see Blink Now prompt.

Now press the SW1 button on the Muscle BioAmp Shield to start the game (The green LED will glow which indicates that the game controller is working).

So whenever you blink, it should give the feedback as jump as shown in the image above which means everything is working properly and you can now start playing the dino game.

Note: We have used Visual Studio Code to run the script which is a powerful and easy to use code editor but you can use any code editor you like.

Play the Game

Playing DINO GAME by blinking eyes using EOG signals | @Arduino | Upside Down Labs

Open the Dino Game by clicking the link below:

Dino Game: https://chromedino.com/

Now you just have to blink your eyes instead of using the space bar to play the game. HAVE FUN and comment down your best scores here :)

Feel free to ask any questions in the comment box below. You can also mail us at support@upsidedownlabs.tech for any kind of support while making this project.