loading

Making a gamepad with the HC05 bluetooth module.

Hi guys!
this is my first post here at Instructables :D I really hope someone will be able to help me!
Basically the problem is described in the attached image.

To be short, we have:
- 1x smartphone (Android)
- 1x bluetooth module (HC05 with breakout board GW-040 4 pin SPI)
- some buttons and arrows...

I've already managed to get the HC05 recognized by Windows as a gamepad (modifying the tag using AT commands). The real problem is that i'm stuck with that. I would like to understand how i can connect some buttons (let's say four) that will actually behave like arrows while playing.
As far as i understood i need to use the PIO pins but unfortunately my knowledge stops here.

Theoretically the code behind this is simple:
when the button is pressed the circuit is close and a signal is received by the HC05 who sends the corresponding command via bluetooth.
So if the up arrow is pressed, that pin will receive 1 (closed circuit) and the HC05 will send "UP_Arrow" as an instruction to the smartphone. The problem is how do i write down this code and put it into the HC05? since the gamepad tag is "universal" i guess there is some default code for things like this.
I think it's the same thing they did with the MOGA...

I also read that i could need a SPI-USB Download (something like this ) to use the BlueSuite, that seems like the software needed for this operation.

Thanks for any advice!!

P.S.: Some useful links i found while searching..
http://dextersstory.tistory.com/3
http://dextersstory.tistory.com/10
http://dextersstory.tistory.com/11
http://dextersstory.tistory.com/16
http://www.martyncurrey.com/arduino-with-hc-05-bluetooth-module-at-mode/
https://developer.mbed.org/users/edodm85/notebook/HC-05-bluetooth/
https://www.sparkfun.com/datasheets/Wireless/Bluetooth/rn-42-ds.pdf
http://cdn.sparkfun.com/datasheets/Wireless/Bluetooth/RN-HID-User-Guide-v1.0r.pdf
http://ww1.microchip.com/downloads/en/DeviceDoc/bluetooth_cr_UG-v1.0r.pdf

Picture of Making a gamepad with the HC05 bluetooth module.
sort by: active | newest | oldest

Is that bluetooth module capable of doing anything else besides handling the communication? I think you need a microcontroller in there like an arduino or attiny to do the input sensing and generating the output commands to send.

HarryValenti (author)  caitlinsdad1 year ago

I know that the HC05 can be set either master or slave so i guess it can do what i'm asking for. Unfortunately i don't have space enough to fit an arduino, but the ATtiny looks ok. It would work like a bridge between the HC05 and the buttons?

I'm not sure what you mean when you say that you "don't have space enough to fit an arduino". An Arduino is just an ATmega328 with a bunch of other stuff that you probably don't need anyway. Go ahead and develop the product with an Arduino and just use the chip with minimal supporting hardware when you are ready to make it smaller.

HarryValenti (author)  phillip.toone1 year ago

Wait. Are you saying that is possible to develop something on Arduino and then just simply detach the main chip and locate it in your product? I tought that Arduino was a one single module.

I guess what he is saying is this:
The arduino is nothing more that a fancy way of using the chip itself.
Making programming, adding hardware and so on simple.
If you check the layout you will see it is not much more than a USB driver chip for the data and the required hardware to get the chip going (plus some extras).
There are prototyping boards available that do basically the same but offer a socket so you exchange the actual chip on them.
So, yes, if your stuff works fine on a normal arduino then all you need is to get a bare chip, add the support electronics or use one of the many minimalistic variations.
Downside is that you need to flash the firmware using a programmer (or another arduino setup as one) if the mini version does not offer USB connectivity.
Thinking of power supply it might be worth thinking of using something with USB so you use that to charge the battery as well.

Do a check what is available on Arduino mini, Uno and so on and if not small enough use a bare chip and design your own circuit board to cater for what else you might need.