Using an accelerometer to control a small game


I've seen many arduino based games that use linear potentiometers to control the position of the cursor. For example, the player rotates the pot to control their paddle in pong.... or to control their character in space invaders.

Has anybody tried using an accelerometer as a pot substitute? I'm assuming I'd just have to read the Y values, and map them to replicate the range covered by the pot? Or am I missing something else?

I was thinking of using a spare ADXL 345 triple axis accelerometer for this. Another option would be a gyro + accelerometer like the MPU 6050, but I'm not really sure what added benefit this would bring.

To summarise my questions:

  1. Can mapping the y axis values from an accelerometer adequately simulate the role of using a potentiometer to control a game cursor?

  2. Would using a gyro to get the angular rate provide any benefit over the accelerometer?

Thank you,


This page shows the math to get pitch and roll angles with an accel.

This is great, thank you. I had a quick skim, and can't wait to try it out tomorrow!