Intro: RetroPi Xbox Controller
While attending a conference for work, I received a Raspberry Pi Zero as a giveaway. Naturally I started trying to figure out what to do with it. Remote control a drone? Webcam collar for my cat? With a computer that small, there were lots of things that could be done.
While searching the web to see what others had done with the Zero, I came across Terence Eden's Blog where he described placing his zero inside an Xbox controller. I decided to try and make a "cleaner" version of his project.
- As few wires as possible: Ideally, I only want the HDMI adapter cable coming out the front. This means it will need...
- Battery with charging circuit: I want to be able to play for some reasonable amount of time without having to have an external power source plugged in. The good news is the Zero sips power, so we should be able to get at least an hours worth of run-time from a reasonably small battery.
- Multiplayer support: I want to be able to plug in at least one additional controller for 2 player games. This means having a USB hub with exposed jacks on the "mother" controller.
- Power and Reset switches: I need to be able to turn it off when not in use, and I need to be able to reset the Zero if an Emulator locks up.
Step 1: Parts List and Notes
- Classic Xbox "Duke" controller
- Make sure to get the classic, and not a newer "slim" controller. I started with a slim, but it really doesn't have enough room.
- Pi Zero
- Memory Card with RetroPie on it.
- I'm not going to cover the software bits, but I used these install instructions.
- Small USB Hub
- I used an old USB 1.0 hub I had laying around, but this one looks like it *might* work ok, and would offer faster speeds than the one I used. Trick is to find a slim hub with all 4 ports coming out the narrow edge of the hub. Avoid USB 3.0 hubs, as there are some issues using them with the Pi (again, I learned this the hard way.
Step 2: A Note on Testing
Before you start chopping all the big bits into little bits, take all of your pieces and test them together to make sure things work as expected. You will have to put a standard USB connector on your controller for this step. Simply cut the end off of the Xbox controller and a sacrificial USB cable, and match up the wire colors.
Why test? I'll give you an example. My original intent was to wire things together as follows:
Pi Zero > Controller > Hub (Via Controller memory port)
That way, all 4 hub ports would be available for external devices. Unfortunately for some reason, my controller would only work when plugged into the hub. I'm not really sure why, but if I had not tested first, I would have wasted a lot of time with something that was not going to work in the first place.
Step 3: Disassemble the Controller
(I didn't take nearly enough pictures, and for that I am sorry. I will try to fill in as best I can)
- Remove the 7 screws holding the controller together. Then pull halves apart.
(hold controller upside down so the buttons do not spill out).
- Remove screws holding controller board to bottom housing.
Step 4: Prepare the Controller PCB
To maximize space under the Controller PCB for the Zero, we want to remove the existing controller cable, and memory connector. And then solder new controller wires coming out the top of the Controller PCB.
- Remove existing cable header
- Remove Memory card connectors
- solder new controller cables
Step 5: Prepare Lower Controller Housing
To make the Zero fit, we have to cut and trim some plastic on the bottom housing.
- Trim plastic from Dpad support
- Trim plastic tab from front support
- Cut and shape top left screw hole as as shown.This will be used for the reset button.
Step 6: Mount Zero
Using a small amount of hot glue, tack the corners of the Zero in place in the bottom housing.
We will come back and add more hot glue to make it permanent later.
Step 7: Prepare Connector Plate.
We are going to use the bottom part of the memory card plate to act as a base for our power and HDMI connections.
- We will be bending the HDMI adapter cable into a pretzel, so carefully remove the insulation from the cable and female connector as shown. Try to leave the shielding tape. wrap the bare cable with a single piece of electrical tape folded over the cable longways to act as insulation.
- Cut/Trim the memory card plate. Remove the top and middle pieces leaving only the bottom. Cut a notch for the HDMI connector that will be sticking out of the Zero. Make this notch as small as possible (test fit a lot).
- Cut off the male end of your USB extension cable, and remove the insulation and D+ and D- cables.
- Hot glue the USB and HDMI connectors to this modified plate.
Step 8: Wire It All Together
Now we wire all the pieces we have so far. For these steps, you will need to pay careful attention to the
orientation/wire color of the parts you are taking off and soldering. a handy USB pinout guide is available here.
- De-solder input connector or wire from hub
- De-solder 1 USB port from the hub (this is where the controller will connect).
- Solder header wires on input port of the hub.
- Solder wires from controller to the port we removed on the hub
- Solder input header wires to solder pads on Pi.
You will notice in my pictures things are already hot glued in place. Regretfully I forgot to take pictures before I applied hot glue. I would encourage you to test everything before making it permanent.
Step 9: Add Reset Button.
- Solder length of wire to contact switch and glue switch into place we prepared earlier. route wires around outside of the lower housing of the controller, using hot glue to hold in place.
- Solder wires to reset pins on the Zero.
Step 10: Power Wires and Bottom Final Assembly
- Solder wires to pins 4 (+5v) and 6 (Gnd) of the Zero's GPIO, these will be used to power the Pi.
- Using hot glue, attach USB hub to the controller board.
Make sure to check for fit, especially around the joystick. You may have to trim the collar on the upper controller housing to fit around the USB hub on that side. Apply hot glue to any solder points to act as insulation.
- Connect HDMI to Zero, and install connector plate, carefully bending/routing the HDMI cable to fit.
- Securely glue down the Zero.
- Attach controller PCB to bottom assembly, being sure to bring the USB power and power to Zero wires through to the top.
- Remove middle two pins from JST socket.
- Solder JST to Zero/USB power wires as follows (looking at the socket pins down, opening towards you):
1 - Gnd to Zero
2 - +5v to Zero
3 - Not used
4 - Not used
5 - +5v from USB
6 - Gnd from USB
Step 11: A Pause Before the Next Step...
Originally, my plan was to have LEDs to indicate Power, charging, charged, and low battery status. when I received the 1000C however, I realized this was not possible. because the 1000C did not have a breakout for anything except low battery. That left me two options:
- solder taps onto the SMD LEDs on the 1000C
- use the existing LEDs on the 1000C
Option 1 is only really an option if you have experience soldering SMD, and have the specialized tools to do it. I have neither.
So I started looking at option 2 and realized the Xbox logo jewel on the controller gives me a ready made window for the 1000C.
So then I tried to remove the clear portion of the jewel from the controller so I could more easily make a cutout for the 1000C. I did some reading and the recommendations I found said to use a hair dryer to heat the front and back of the jewel, and then flex the plastic to release the glue.
DO NOT DO THIS
You will see in the next picture, but I got part of the controller too hot, and deformed the hole for the buttons. This almost ruined my controller.
My advice is to cut from below, just be careful to not scratch the clear portion.
Step 12: Prepare Top Housing of Controller
- Carefully measure and cut out plastic below the "jewel" to make a hole for the 1000C.
Clip off screw post closest to the top left joystick. This makes room for the USB Hub.
Carefully melt/cut a mounting hole for the power switch right above the "select/start" buttons.
Mount switch in mounting hole.
Step 13: Prepare the 1000C
Solder three wires to the Gnd, EN and Vsh pins on the 1000C. These will go to the power switch. I used Black, White and Red respectively.
assuming you are using the same JST I bought, remove the middle two wires of the JST pigtail, and cut about half of the pigtail off. Strip and re-tin wire ends, then solder to the 1000C as follows:
- Green: to (-) pin of 1000C's output
- Orange: to (+) pin of 1000C's output
- Red: to "USB" Pin
- Black: to Gnd Pin
Solder the power switch wires to the switch as shown in the picture.
Step 14: Mount Charging and Battery Circuit to Top Housing.
(Again, I suck at taking pictures, I'm sorry.)
- Connect battery JST connector to 1000C
- Fasten 1000C into top housing using hot glue
- Secure Battery on top of 1000C using Hot glue.
Step 15: Done!
Connect the JST connector, re-assemble the top and bottom halves, and you are ready to game.
I'm a little worried about the USB ports on mine, it seems like they may be easily snapped off by an overly-enthusiastic gamer. I may build up some glue as reinforcement, but doing so will make the controller hard to disassemble in the future, so I may hold off until I've played with it awhile and made sure everything works.