Arduino bluetooth HC-05 game controller to control Android games

I got a new project to make a pretty unconventional (fitness) game controller using Arduino to control Android games.

The ideea is the following: using the Android VR technology (Cardboard or Dive) it was pretty simple to create a basic game (3d world to walk around) using Unity3D and Dive SDK. If you put on the Google Cardboard, the VR experience begins. But still so few devices are on the market, which give you back the control over your smartphone, which now is fixed in front of your eyes.

I want to use this and make a fitness app which will be controlled by running on a treadmill (or using a workout bike). Something like the old Nintendo Wii and the running game from Sports. Or a game like Temple Run, in which running the treadmill faster, gets you faster in the game.

For this I would like to create a game controller which records the leg movements, direction, body position, etc. which would then influence the actions in the game. A lot of details I still need to work out.

So the question is, does anybody know of a guide or tutorial on how to create a game controller like this, using an Arduino a bluetooth module like HC-05. The controller should not be bound to a specific game or 3rd party app, should work like a usual game controller for android (connecting to some bluetooth android game profile?). There are many android game controllers out there which dont need a special android driver/3rd app to control any game. So this has to work somehow.

So how can I programm an Arduino to send (once paired) the same events a bluetooth gamecontroller (or bt keyboard or mouse) sends, which doesn't need any 3'rd party Android app to be able to send basic key pressed events to a random game.

Best regards, F

sort by: active | newest | oldest

The moga controller is almost a Playstation controller and can be used for a lot of games, which means you find documentation for it, including the SDK to develop your own gaming code for it as well as certain drivers for added support includ a HID emulator.

If you use what the controller offers you have the push buttons and the 8 directional inputs from the sticks to play with.

The sticks use "potentiometers", so they change their resistance depending on the stick postion.

If anything I would start from there and work my way up, otherwise you have to program a special driver for your controller.

I did a quick count on the inputs:

8 directional, analog inputs

2 analog buttons

10 digital buttons, icl. the directional pad

fcfelix (author)  Downunder35m2 years ago

Thanks, that is definitely a way to
start on the project. Thought about it too, to disassemble a game
controller and use it in the project. And as you said, I could work my
way up, replacing step by step parts of it (buttons with sensors, etc),
adapting it to my future needs.

But since a moga controller costs
30eur and a HC-05 costs about 3eur, and I have it already, I thought I
try to find a solution using the HC-05 first. The moga controller also
doesn't need a driver on Android to work (or does it?). It also just
connects somehow on some android bluetooth profile and sends some
standard signal. That I would like to find out how it is done, and on
the Android SDK documentation there isn't much on this particular
subject. Writing a driver on Arduino, which maps sensor input to android
bluetooth actions, that I can do. I only need to find out how to
connect to android from arduino as a game controller, and send game
controller events. There has to be a way / some guides for it.

Ok, so don't know if this is still relevant, but I also want to send accelerometer data via bluetooth to a mobile device in a google cardboard style setup. This was the closest I could find:


I'm also interested in incorporating different tactile inputs into Cardboard VR. If you need something with a HID profile, have you checked out this device from Adafruit? https://learn.adafruit.com/introducing-bluefruit-e...

I"ve successfully used it in conjunction with a Makey Makey in a DIY DDR dancepad. The Makey Makey was used as a VR input in this instructable- https://www.instructables.com/id/Makey-Makey-to-Android-For-Google-Cardboard-Input/ accept it had to be connected via USB OTG cable. The EZ-Key makes a wireless connection possible.

I've also been thinking of using various elements of the Flora wearable platform incl. the microcontroller, Accel/gyro and BLE module which you could probably use to capture body movement. A smartwatch like the Pebble will also have an accel. sensor and could possibly be used in conjunction with some of the Flora components to capture more complex movements.

fcfelix (author) 2 years ago

SOLUTION: For a project of this kind, the HC-05 is NOT suited since it doesnt support the HID profile. I found references that the firmware can be flashed with a version that supports it, but this is a pretty messy solution. The best alternative is to buy a BlueSmirf or a BlueGiga bluetooth module which both cost around 20-30 EUR. Or to buy a HID bluetooth module from aliexpress.com for around 7 EUR. Then the communication with any device (PC, Android, etc.) is possible as a HID, and no special drivers will be needed on the target platform.

fcfelix (author) 2 years ago

OK, will post my findings here for any of you who will need it.

It looks like the HC-05 can be changed to be a HID (keyboard, mouse, gamepad) using AT commands:


Then any android device recognizes it as such, and delivers the keypressed events directly to the active app. Exactly what I need. And like for any bluetooth keyboard, no special drivers in android are needed for that.

Only question, how do I send that information from Arduino over the HC-05 bluetooth?

fcfelix (author)  fcfelix2 years ago

Sending key&mouse events might work via the arduino SoftwareSerial library.


Will have to test this ...