close-circle
Close
0%
0%

Bluetooth Gamepad Phone Case

A bluetooth gamepad integrated into a phone case.

Similar projects worth following
close
A forward-compatible gamepad using 3d printed cases. This controller is inspired by the many smartphone gamepads and and game-focused phones that have come and gone. New phones come out, more powerful hardware arrives, and the old products are left underspecced or incompatible.

The current version uses an nrf51822 SoC for CPU and bluetooth.

Work in progress. There are several planned versions (if it makes it that far). v1 is for my personal use. v2 is community involvement and support for multiple phones. v3 extends functionality beyond just a gamepad.

WHY:

I want to play action/platformer games on my phone. The straw that broke the camel's back was "Prinny: Can I Really Be the Hero?" - I couldn't beat a boss because my fingers kept missing the intangible touchscreen controls. I want a gamepad that is compact to carry, comfortable to hold, and works with multiple phones.

HOW:

Current plan is an nrf51822 based gamepad in a 3d printed case. Users will be able to 3d print a case for their particular phone and drop in the electronics. When the user gets a new phone, a new case can be made and the electronics transferred.

INSPIRED BY (R.I.P.):

Xperia Play, OpenPandora., HTC Dream (G1), DS Lite, PSP

GAME PLAN:

The very broad stages will be:

  1. make a gamepad
  2. miniaturize it
  3. attach it to my phone

Breaking it down a little more, I'm expecting the stages to be something like:

  • phone case
  • electronics breadboarding
  • BLE firmware
  • electronics rough prototype (perfboard or similar)
  • standalone gamepad housing
  • PCB prototype
  • gamepad miniaturization
  • phone case gamepad prototype

ELECTRONIC DETAILS:

todo

CASE DETAILS:

todo

  • STM32 Black Magic Probe flashing

    Maave5 days ago 0 comments

    I'll be using Black Magic Probe to program/debug my "core51822" nrf51822 modules. Cheap STM32 boards can be flashed with the BMP firmware. (Note: Maple Mini board didn't work, stick to STM32F103C8T6 boards). HaD gave a brief summary about BMPs:

    https://hackaday.com/2016/12/02/black-magic-probe-the-best-arm-jtag-debugger/

    Quick cost comparison of dev options:

    -STM32F103C8T6 ($3) + FTDI serial adapter clone ($2) + core51822 or similar modules ($6) = $11

    -NRF51 DK ($34)

    -Segger J-Link EDU ($60 not incl shipping) + core51822 or similar modules ($6) = $66+

    The STM32 parts were sourced from China. It'll be $15-$20 if shipped from the US. I already had the serial adapter from the Arduino work so this was cheapest route bay far. Also I swear the NRF51 DK was $100 when I first checked and that's why I went the STM32/core51822 route. Now it's only $34. This is a very tempting option since it's officially supported and easier to set up. The DK has SWD pins so it can flash other modules as well.

    On to the Black Magic Probe flashing. All of the guides were for Linux so I used my VM, Thinking about it now I probably could have compiled using the Windows build of gcc. Oops, too late. If other people get into this I'll find/write a build script so that people can download the prebuilt firmware.

    The two guides I mostly followed:

    https://medium.com/@paramaggarwal/converting-an-stm32f103-board-to-a-black-magic-probe-c013cf2cc38c
    https://gojimmypi.blogspot.com/2017/07/BluePill-STM32F103-to-BlackMagic-Probe.htm

    in terminal:

    mkdir mbp
    cd mbp
    wget https://raw.githubusercontent.com/jsnyder/stm32loader/master/stm32loader.py
    chmod 774 stm32loader.py
    sudo apt install python-pip
    pip install pyserial --assume-yes
    sudo apt install arm-none-eabi-gdb
     Wiring pic from the Medium guide. If you check STM32 board pinouts you'll see that A9 and A10 are TX and RX respectively.

    Wire up the boards according to the guide, plug in the FTDI USB, pass through the FTDI in VirtualBox to the VM. It connects as /dev/ttyUSB0 as shown in dmesg:

    dmesg | grep tty
    sudo ./stm32loader.py -p /dev/ttyUSB0

    Test build BMP firmware:

    sudo apt-get install gcc-arm-none-eabi --assume-yes
    sudo apt-get install dfu-util --assume-yes
    git clone https://github.com/blacksphere/blackmagic.git
    cd blackmagic
    make

     
    If that completes without errors then build the STM32 version

    cd src
    make clean && make PROBE_HOST=stlink
    

     
    That creates blackmagic_dfu.bin and blackmagic.bin. Now the firmware is built and can be flashed to the STM32. Either hit reset on the STM32 or unplug/replug. Then flash:

    sudo ./stm32loader.py -p /dev/ttyUSB0 -V -e -w -v ./blackmagic/src/blackmagic_dfu.bin

    Unplug it all. We don't need the USB to serial anymore. Reset the STM32's boot1 jumper to 0. Plug it through USB. The BMP updater firmware doesn't work with Win10 so I have to install the libusbK drivers using Zadig as mentioned here:
    https://docs.particle.io/faq/particle-tools/installing-dfu-util/core/#windows-32-bit

    Have the STM32 plugged in, start Zadig, select Black Magic (Upgrade) in the dropdown, use the arrows to select libusbK, install driver. VirtualBox still didn't pass through, and I'm being dumb and lazy, so I just used the dfu-util Windows build and transferred blackmagic.bin to Windows. Use dfu-util v0.9. Some other guide I had been following used v0.6 but that caused issue for me.

    http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip

    Check the device ID with:

    dfu-util.exe -l

    which returned "Found DFU: [1d50:6017]" etc, I guess that's it. Time to flash:

    dfu-util.exe -d 1d50:6017 -s 0x08002000:leave -D blackmagic.bin

     Mine succeeded, the Black Magic device shows in Windows. If you get errors, check gojimmypi's account of fiddling with the memory.

    I gave it a quick test in gdb as well. I was able to start gdb and set the target.
    https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands

  • Phone case modeling

    Maave12/04/2017 at 20:48 0 comments

    Phone case design time. I'll be 3d printing this, first in ABS, then in TPU, and eventually using it as a daily driver. I chose Fusion 360 this time to make it easier to edit the model. This is sooo much better than Sketchup, doesn't royally screw the model when I apply fillets, and it allows me to suppress feature later in development.

    Here's the best tutorial I found. The only thing he forgot to mention is the camera controls (middle mouse to pan, shift+middle to orbit).
    https://www.youtube.com/watch?v=A5bc9c3S12g&list=PL40d7srwyc_Ow4aaOGXlP2idPGwD7ruKg

    Here's a supplementary tutorial following the designer's natural workflow
    https://www.youtube.com/watch?v=E0bhdr84FNU

    Screenshot of the case:

    The "test" version with top lip removed so that I can print in hard ABS and a filament-saving space:

    This will be printed on a CEL Robox using ABS. If the test print goes well then I'll print in TPU. I group bought a printer with friends but it's currently down. I'm waiting for my friend to calibrate the bed after installing a new sticky print bed. We'll still have to mod the feed system to work with TPU.

  • Prior attempt

    Maave12/04/2017 at 14:39 0 comments

    I documented my prior attempt but the results weren't great. Here's the summary for historic purposes. This is my first real electronics project so I wanted it easy. I used an Arduino with an HC-05 Bluetooth module reflashed with RN-42 firmware, and Sketchup for the phone case modeling. The HC-05 worked but I don't think that reflashing the firmware is appropriate for a community project. Sketchup was entirely inadequate.

    I ordered parts, breadboard components, and soldering iron. I learned microcontroller basics on the Arduino - blinking LEDs, voltage dividers, button input, debouncing buttons, pull up / pull down, bitpacking. The Arduino was great for learning that. I re-learned soldering which I haven't done in years, and breadboarding. Pro tip, don't buy bottom of the barrel jumpers, half of mine are dead and it caused endless frustration.

    EEVblog how to solder:
    https://www.youtube.com/playlist?list=PL2862BF3631A5C1AA

    Concepts and mindset of soldering:
    https://www.youtube.com/watch?v=vIT4ra6Mo0s

    I had the parts ready when mitxela's guide appeared on HaD so my HC-05 attempt was based off this guide:
    https://mitxela.com/projects/bluetooth_hid_gamepad

    I got the controller to show as an HID gamepad in Windows. This is where I stopped with the Arduino/HC-05 and ordered nrf51822 gear. It can definitely work, I just don't think it's ideal.

    Here's the phone case I started for my Nexus 6P. My friends and I had already been using Sketchup for other projects however it turned out to be a poor choice for small models - I had issues with keeping faces flat and with Sketchup combining nearby lines.

    My new attempt is using the nrf51822 BLE SoC and Fusion 360. I got nrf51822 compiling and flashing working but no code of my own yet. I've made great progress with Fusion 360, parametric modeling rocks. More updates to come.

View all 3 project logs

Enjoy this project?

Share

Discussions

Michael Jensen wrote 5 days ago point

I saw that you were inspired by the OpenPandora. -- I'm interested in reusing the keyboard / gamepad from mine and integrating it into a phone case in a similar way to yours. -- If you make progress on the software side of things, I might end up using your code as a starting point.

  Are you sure? yes | no

Maave wrote 4 days ago point

Very cool, I hope my project helps.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates