Introduction: RASPBERRY PI AND ACCELEROMTER MXC6226XU AS GAMING CONSOLE
The tutorial below shows how to use accelerometer sensor and raspberry pi as gaming console.
The M6226XU Digital Thermal Orientation Sensor (DTOS) is the world's first fully-integrated orientation sensor. Its operation is based on a patented MEMS-thermal technology and is built using a standard 0.18um CMOS process.
MXC6226XU is specified for use in LCD TVs, toys, MP3/MP4 players, fan heaters, halogen lamps, and irons.
This projects demonstrates a version of space invaders where the flying shot is controlled by tilting the accelerometer sensor. The code for the same can be found here.
Hardware Required : Raspberry pi , I2C adapter , MXC6226XU board and an I2C cable
( You can find the I2C adapter , MXC6226XU board and I2C cable at www.controleverything.com)
Step 1: Make Connections
Connect I2C adapter over GPIO pins on Raspberry pi and press it.
As it gets fixed connect a I2C cable with I2C adapter and MXC6226XU bo
Step 2: Power Up Pi and Run Code
Power up the pi once the connections are done. Type command " startx " to switch on the pi in graphical mode.
Download the code from github and copy to pi.
Create a class for the sensor code. The java code used pi4j library. Its a java library for I2C and GPIO created for pi. Instructions to install library are in the comments of the code.
Run the code as :
Instructions to run the code are in comments of the code.
Step 3: " Start Playing "
You can now see the game space invaders running. Press any key to start.
Hold the accelerometer in a horizontal plane. The shot fired from spaceship will move to left or right as you tilt the sensor to left or right.
You can also refer to youtube video here.
Participated in the
Arduino All The Things! Contest