GamePad Using Android Mobile Sensors and Arduino

Today, I will introduce to you how to use your Android mobile or tablet to play computer games using the sensors of the mobile and buttons.

Actually, I always dreamed to play some mobile games as Asphalt, using a much bigger screen than the mobile or tablet screen.

The idea of playing games using the motion of the body based on sensors of the mobile phone is awesome!!!. The project is so easy and doesn't require any experience android programming, it's only a 2 steps project.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Components

1- Arduino Leonardo (25$)
(or any Arduino support the keyboard library on Arduino IDE).

2- 1Sheeld (60$)

3- Android Smart Phone/ Tablet.

(Note: These images taken from 1Sheeld website)

Step 2: Android Application

Basically, All you have to do here is to download 1Sheeld application from play store. This Application gets rid of a hell of a headache for developing the Android Application.


Step 3: Arduino Sketch

Back to our project, all we need from the mobile phone is its rotation to change direction and pressing one of 2 buttons to check whether forward or backward. To get the orientation of the mobile you can use either the gyro sensor or the gravity sensor. Yet, I used the gravity since I found it more stable in the readings or you can use as well the Orientation shield in the application which is based on gyro. We will use the Keyboard Library of Arduino to take the action as if it is the real keyboard, so that's the reason we need Arduino Leonardo or any one support this library.

From the Keyboard Library, you have got that:





Here you can find the code.

#include <OneSheeld.h>

void setup() 

void loop() 
  if (GamePad.isUpPressed())

 if (GravitySensor.getY() < -1)
 if (GravitySensor.getY() > 1)

Step 4: Attachments

After Uploading the sketch to the Arduino. Attach the 1Sheeld over the Arduino and connect both to the computer.

Step 5: Have Fun

Now, open your Mobile Application, you have to pair the 1Sheeld with the mobile using Bluetooth. Then choose the Gravity shield and the Game pad shield from the application and then click next.

Now you can move the car using the upper and lower bottoms and by rotating the mobile you can change direction of the car left or right.

Be the First to Share


    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    4 Discussions