Skip to content

Latest commit

 

History

45 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hand Sensor Tetris Project

A probably-too-complex way to play Tetris — using just your hand.

The player wears a glove equipped with an accelerometer that transmits motion data to a Raspberry Pi over a wired connection to the Pi's GPIO ports. The Pi runs the full game — rendering, collision detection, block rotation, line clearing — all written in C. Tilt your hand left, the block moves left. Tilt right, it moves right. The accelerometer picks up the directional acceleration and the code maps those values to in-game movement in real time. For example, a rapid leftward hand motion registers as negative acceleration, which shifts the falling block left.

The hardware side involved mounting the accelerometer onto a glove and wiring it into the Pi's input pins, then writing the interface layer to read raw acceleration data and convert it into discrete game commands. The game engine itself handles standard Tetris mechanics — piece spawning, gravity, rotation, row completion — rendered directly on a monitor connected to the Pi.

We also wired up the classic Tetris theme song (as a .wav file) to play during the opening sequence, because what's Tetris without the music. The audio playback is handled through a custom header (tetris_audio.h) that manages the WAV file integration.

How It Works

  • Accelerometer glove reads hand movements and sends data to the Raspberry Pi's GPIO ports
  • Game engine in C handles rendering, collision detection, block rotation, and line-clearing logic on the Pi
  • Motion mapping interprets raw acceleration values as directional input — rapid hand movement in one direction shifts the falling block accordingly
  • Audio module plays the Tetris theme during the opening sequence via WAV file playback

Demo

The video below shows the full setup in action — glove movements controlling the falling blocks in real time.

Sensor_Tetris_inaction.mp4

Credits

About

A glove-mounted accelerometer wired into a Raspberry Pi that lets you play Tetris with hand movements. Game engine, rendering, and audio all written in C.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages