Arduino / XBox V1 RF(Wireless) Controller Hack:
The above pictures show the process of installing an Arduino Nano into a generic wireless Xbox V1 controller and wiring it up. I removed the vibrating motors, chopped the circuit board, and added my own transmitter (visible on top-left of controller). I also chopped a hole for USB connection and transmitter wires which will be shortened. (315Mhz RF module using VirtualWire)
If you look close you will see that the wiring could have been laid out much better and arranged in more of a logical way. I didn't plan on using all the buttons and d-pad, but once I got started, I couldn't leave all those unused pins and buttons. It was also bit of a rush job as usual.
The joysticks work by using 2 potentiometers each as shown in the above pics (Orange), and the triggers use just one. All I had to do was scratch out the connections on the circuit board and wire up my own. I also chopped the circuit board in half to make more room for the Arduino. I currently have both joysticks, the d-pad, triggers and A-B-X-Y buttons all functioning. (uses 6 analog and 8 digital pins). Built in LED indicator is wired to pin 13.
I am not posting a schematic for this since it is pretty straight-forward, but here are some basic steps:
1. First off, the 'outputs' on the controller itself are just potentiometers and buttons. They get wired to the Arduino in the same way as any potentiometer or button.
2. Connect the center of each pot to an analog input
3. Connect each button to a digital input.
4. Leave all ground connections in place
5. Scratch out + connections and wire your own to 5v on Arduino. Use resistors built into controller where possible, otherwise include where required.
6. Adjust input pins in source code as necessary.
The only complicated part is the number of wires to connect and fit in there.
The controller starts by determining the zero-point or center area of the joysticks. Any slight movements in this area will be equal to zero movement. Movements outside this area will be measured by the analog inputs reading two potentiometers per joystick. Triggers are measured by analog inputs reading one potentiometer per trigger. All joystick movements/variables are sent as 1 byte each, in a single transmission, multiple times per second. Triggers are the same.
Source code for controller here (Only transmits trigger and joystick movements currently)
A complete rewrite of JunkBot code seemed in order, since controlling it with a proper controller and coding it differently could simplify things greatly. That is in progress, but movement is pretty much done:
Basic JunkBotX source here (comment out SD card initialization if not hooked up)
JunkBotX_SD source (working code, but in progress) here
- SD Card logging of movements
- fwd/rvs playback
Controller Source to accommodate record/playback (B and Y buttons) here