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](/proxy/?url=https://content.instructables.com/F3W/HKMZ/LNX7096V/F3WHKMZLNX7096V.gif&filename=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](/proxy/?url=https://content.instructables.com/FX8/6RW8/LNX6ZYD0/FX86RW8LNX6ZYD0.jpg&filename=DIY Neuroscience Kit - Pro (Front).jpg)
![DIY Neuroscience Kit - Pro (Contents).jpg](/proxy/?url=https://content.instructables.com/FXO/YUH3/LNX6ZYD7/FXOYUH3LNX6ZYD7.jpg&filename=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](/proxy/?url=https://content.instructables.com/FSU/E22D/LNRH8FWH/FSUE22DLNRH8FWH.gif&filename=Stacking on Arduino Uno.gif)
Stack the Muscle BioAmp Shield on top of Arduino Uno properly.
Connecting BioAmp EXG Pill
![shield-pill-connection.png](/proxy/?url=https://content.instructables.com/FUW/57PB/LY4F6XOC/FUW57PBLY4F6XOC.png&filename=shield-pill-connection.png)
![shield-pill-connection-2.png](/proxy/?url=https://content.instructables.com/F7P/NORA/LY4F6XO1/F7PNORALY4F6XO1.png&filename=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](/proxy/?url=https://content.instructables.com/FL7/4NIC/LO4C89JR/FL74NICLO4C89JR.gif&filename=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](/proxy/?url=https://content.instructables.com/F5S/FAIK/LNRH8FXD/F5SFAIKLNRH8FXD.gif&filename=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](/proxy/?url=https://content.instructables.com/FM2/O1W6/LNRH8FXV/FM2O1W6LNRH8FXV.jpg&filename=Electrode Placements.jpg)
- Connect the BioAmp Cable to gel electrodes,
- Peel the plastic backing from electrodes
- 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](/proxy/?url=https://content.instructables.com/FSS/XP9C/LNX6ZYN4/FSSXP9CLNX6ZYN4.png&filename=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](/proxy/?url=https://content.instructables.com/F62/VCLJ/LNX6ZYJU/F62VCLJLNX6ZYJU.jpg&filename=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.