In this project, we have designed a ping pong game using MATLAB. The unique aspect of this game is that the movement of the first paddle is controlled by the program itself, while the second paddle is controlled by the player's eye movement using the EOG signal. To achieve this, we have utilized the ExG Hexabitz module.
👁️ Explanation:Imagine a world where you can play ping pong without even touching a paddle. Sounds fascinating, right? Well, that's exactly what our project aims to achieve. We wanted to create an interactive and innovative gaming experience that combines technology and fun.
The idea behind this project was to develop a ping pong game where one paddle moves automatically based on programmed algorithms, while the other paddle is controlled by the player's eye movement. This unique concept not only adds excitement but also challenges players to improve their eye-hand coordination skills.
👁️ 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 EOG.
To measure eye movement, pairs of electrodes are typically placed either above and below the eye or to the left and right of the eye. If the eye moves from center position toward one of the two electrodes, this electrode "sees" the positive side of the retina and the opposite electrode "sees" the negative side of the retina. Consequently, a potential difference occurs between the electrodes. Assuming that the resting potential is constant, the recorded potential is a measure of the eye's position.
In 1951 Elwin Marg described and named electrooculogram for a technique of measuring the resting potential of the retina in the human eye.
Common electrode placement for vertical and horizontal EOG recording is shown in the image below 👀
- Right and left eye movement: horizontal electrodes.
- Up and down eye movement: vertical electrodes.
- The common electrode you can place it on the forehead or neck.
🌟 Single-Lead, EXG Monitor (H2BR0x):
Hexabitz Single-Lead, EXG Monitor Module (H2BR0) is one of a kind module that can record publication-grade biopotential signals from your body be it from the heart (ECG), brain (EEG), eyes (EOG), and muscles (EMG).
What makes it different?
- Record publication-quality biopotential signals like ECG, EMG, EOG, or EEG.
- Small size allows easy integration into mobile and space-constrained projects.
- Notch filter (second order) to remove 50 Hz AC mains.
- H2BR0 is based on STM32G0 MCU.
- Program advanced C code with our easy-to-use APIs.
- You can connect to external hardware or combine with other Hexabitz modules!
- The module is equipped with an open source MATLAB interface.
🌟 Sensor Cable – Electrode Pads (3 Connector):
This is a simple three conductor sensor cable with electrode pad leads. The cable is 24˝ long and feature a 3.5mm audio jack connector on one end with snap style receptacles for biomedical sensor pads.
🌟 STLINK-V3MODS Programmer (H40Rx):
H40Rx is a programmer module which contains STLINK-V3MODS stand-alone debugging and programming mini probe for STM32 micro-controllers (Hexabitz modules and other MCUs).
It supports the SWD (Serial Wire Debugging) interface for the communication with any STM32 micro-controller located on an application board.
It also provides bridge interfaces to several communication protocols, allowing for instance the programming of the target through boot-loader.
Step 1 : Writing codes with STM32CubeIDE software 💻
- Check out this article for writing code with STM32CubeIDE.
- In the repeated closed loop, we made sure that MCU periodically checks the
EOG
sample value andEOG
filtered sample value of the sensor using the API.
Get_EOG_Sample(&EXGStruct, &sample, &filteredSample );
This value was first monitored using the STM32CubeIDE debugging function to monitor sample value live expressions.
The module that captures just a quick blink of an eye.
Right blink: move to the right then to the center quickly.
Left blink: move to the left then to the center quickly.
Up blink and Down blink.
We can also examine the (eyeBlinkStatus) variable whose structure is of type enum to see which eye is moving.
typedef enum
{
NO_BLINK = 0,
RIGHT_BLINK = 1,
LEFT_BLINK = 2,
}EYE_BLINK_STATUS_EUNM;
Step 2 : Writing codes with MATLAB💻
- To implement this idea, we used MATLAB as our programming platform. We started by designing the graphical user interface (GUI) for our game, which included a playing area and two paddles.
- The first paddle was programmed to move in response to certain algorithms that made it challenging for players to predict its movements.
- For controlling the second paddle, we integrated an EOG signal into our system. EOG measures eye movement by detecting electrical changes around the eyes. By placing electrodes near the eyes, we were able to capture these signals and convert them into meaningful data.
- To process and interpret these signals, we utilized the ExG Hexabitz module. This module provided us with advanced features for signal processing and communication with MATLAB. It allowed us to extract relevant information from the EOG signals and convert them into commands for moving the second paddle up or down.
With everything set up and ready to go, players can now enjoy an exciting game of ping pong without even lifting a finger (well, except for their eyes). They can challenge themselves or compete against friends in this unique gaming experience that combines technology with traditional sports.
In conclusion, our project demonstrates how technology can be integrated into everyday activities like gaming to enhance user experience and provide new challenges. By utilizing MATLAB and incorporating EOG signals through the ExG Hexabitz module, we have created a ping pong game that pushes boundaries and encourages players to think outside the box.
Please feel free to leave a comment here if you have any questions or concerns regarding this project 😃
Comments
Please log in or sign up to comment.