«

»

Jan
20

Accelerometer plotting in MATLAB

The current project I am working on concerns reading data from an accelerometer in order to move a player in an air hockey game being played on the Microsoft Surface. There is a delay in tracking fast movements on the surface which can be an issue when playing a game. The idea is to cut out that delay by determining when the surface has lost track of the user, and when that happens send the surface calculated velocities based off the accelerometers readings.

Air hockey controller

The above image is a picture of the controller that is used to play the air hockey game. It communicates with the computer over a serial bluetooth connection, in which it sends acceleration data to the PC whenever it is requested.  From those readings I am able to determine the acceleration in m/s² from which I derive the velocity and position.  These values are then saved in a database which upon termination of the program are written to a file.  That file is then read in using MATLAB and is plotted as seen below:

X plots from MATLAB
Y Plots from MATLAB

By storing this data and reading it into MATLAB I open up a lot of options in data analysis which will become useful if a problem arises. Soon I hope to post a video of the controller during gameplay scenarios!

~Josh Clairmont

1 comment

  1. Dora says:

    Hello! Can you provide me the entire code for reading and plotting the signals received from the COM port? Thank you!

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>