Monday, July 22, 2013

Controlling a Controller - Proof of Concept

Introduction

I have seen many interesting modifications of (mostly) game controllers on the internet. They all have one thing common: they were specific to the controller in question. I wanted to design something that could be attached to any controller, regardless if it uses positive logic (button pressed = logic high), negative logic (button pressed = logic low), or something else (button pressed shorts custom levels).

The "final" board. You may notice that quite a few components are not yet mounted. The reason is that I only mounted the essential components, i.e. I only soldered in 1 74HC4066 chip (4 switches) to see if it works. If I ever decide to use this for something I can simply solder in the remaining components.


Although, I did not finish this project due to lack of time, it is in a stage where it proves that it can do its job.


Features

The following are the main features of the device I created. Please note, I have not implemented all of the features below, the hardware, however, is ready, and it's just a matter of writing the firmware for a given feature to work.
  • can control up to 18 buttons on a controller
  • has 3 extra buttons that can be either used on the custom built PCB or built into the original controller
  • has 3 LEDs that can be used as feedback to the user (status, activity, etc.)
  • universal: it can be used with ANY controller that uses buttons for user entry. Examples include game controllers (I used one of my wireless XBOX 360 controllers), mobile phones (obviously, not the ones with a touch screen...), remote controls (for pretty much anything).
  • depending on the firmware it can record/execute macros
  • can connect to a computer via a built in serial interface
  • operates from a single 5V power supply
  • has built-in 3.3V LDO regulator, so this device can power the controller if, like in the case of the  wireless XBOX 360 controller, it uses 2 AA batteries for normal operation.


Possible uses

I think this device can be used by many different kinds of people for many different purposes. The following list is just a quick list of possible uses that came to me at the time of writing this article. 
  • automated game-play in certain games, i.e. macros, rapid fire, etc.
  • ability to perform tasks in a repeatable way
  • help people with limited mobility execute complex tasks with an ordinary remote control
  • for a DIY-er like me, it makes it possible to control button-based devices without knowing its internal workings, protocols, etc.

Hardware

The design is based around a PIC18F4550, because it has a lot of IO pins, built-in serial interface, and the fact that I have used it in past projects, so I know it a little bit. Since it doesn't need high precision timing I am using its internal 8MHz clock source.

The schematics of this circuit is very simple.
The button clicks are simulated with bilateral switches that come in packages of 4 in the 74HC4066 chip. According to the datasheet the closed resistance is less than 50 ohms. Before building the circuit I tested it with my wireless XBOX360 controller if that's acceptable.

Front side of PCB


Back side of PCB


A 40 pin (2*20) 90 degree header is used for connecting the device with the controller with a 40 pin IDE cable. This was an excellent choice as it plugs in to my circuit on one end and standard jumper cables can be plugged in at the other end - making quick changes in the development process easy.

Here shines the IDE cable's easy connectivity: standard jumper cables as well as 0.1 mil pin headers are all easily attached to it.


30AWG magnet wires are soldered in to the appropriate locations on the motherboard of the XBOX360 controller.
I also created a header for the serial connection for computers. The pinout matches the pinout of a cheap USB/serial converter purchased on eBay.

An ICSP header is also on the board for easy development/debugging.


Firmware

The firmware is written in Microchip's C18 v3.44. Of all the possible functions only a handful are implemented because I don't really need this controller (I was just curious if it could be done). The following functions are implemented:
  • Serial communication with a PC: when data is received an on-board LED flashes.
  • S basic (state machine) menu system accessible through the serial connection.
  • Through this menu system it is now possible to switch the XBOX360 console on and off

Some of my thoughts on all this...

This device, as it is now, is not more than a very fancy/complicated way of switching my XBOX on and off. However, it also demonstrates that it is relatively easy to expand any button-based controller with this method.
Also, this is merely the first step of creating a really useful expansion to any controller. Of the top of my head the following further hardware development directions are obvious:
  • USB connectivity for easier and full communication with computers.
  • Make it accept other/custom sensors/switches to further aid people with limited mobility.
  • Make it handle (accept and drive) analog signal sources, like joysticks on game controllers.
In the comments below I welcome your ideas on what to use this device for.


It's competition time!

I would like to invite you all to submit your ideas on what this device could be used for. You don't have to be technical minded to enter. To submit your idea, just leave a message in the comments below. This competition is open from the time of publication of this post until the end of August 2013. On September 1st, if there are sufficient number of entries, I will pick the 3 best ideas and post them on this blog.

Prizes:

The prizes are nothing world shattering since I'm on a limited budget. However, the winners will be able to pick PCBs from this or previous projects of mine on this blog (while stocks last). The first prize is 3 PCBs, the second prize is 2 PCBs, and the third prize is 1 PCB. Also, the winners can be proud to win my first competition! :)

Licensing

Creative Commons License
This project is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Permissions beyond the scope of this license may be available at http://diy.viktak.com.