Part 1, part 2 and part 3 of this build can be found in the links.
In this post we will look at how to complete the build now that we have Retropie running on the Raspberry Pi, the screen working and an enclosure to put everything in.
The initial planning for this project I included the use individual discreet inputs for each of the button inputs I wanted. Tactile switches were bought and tested but I ran into problems when I tried to find a way to mount them and also in finding some button caps that looked good and worked. One solution was to 3D-print mountings and button caps but this would have required of me to first learn CAD and then either find a 3D-printer or buy one to make the parts I needed. A quicker and simpler solution was to use a ready made off-the-shelf controller.
For this I bought a pair of iNNext classic USB controllers from Amazon. As the Raspberry Pi and RetroPie already support these, I only need to find a way to fit the controller into the enclosure I made. The PCB of the controller was carefully cut into three parts, the left buttons, the right buttons and the centre containing the controlling circuit. After the cut, small parts of the PCB tracks were exposed by scratching off the top layer. Ribbon cable were then used to reconnect the left and right parts of the PCB with the centre piece. With this the controller movement and action buttons could be moved to where I needed them while still using the original contact pads.
For the select, start and shoulder buttons I decided to use the tactile buttons I already had. Holes, just large enough for these buttons to poke through the enclosure, were carefully drilled and the question of keeping the buttons in place left for later. As a last resort it was decided to use glue if necessary but this I wanted to avoid. The tactile buttons were connected to the USB controller in place of the contact pads used before. Before fitting everything to the enclosure every button was tested to ensure there are no bad contacts.
The three parts of the controller’s PCB were glued to some perfboard which can be screwed to the enclosure.
Battery and charging circuit
As a power source I selected a 3.7 V, 2000 mAh LiPo battery. The battery is compact and it’s shape fits into the packaging I had in mind. Next I needed a compact charging circuit as it was important to have it as easy as possible to recharge the battery. A power supply circuit was also needed to provide 5V, needed by every other circuit in the project, from the 3.7V provided by the battery. A circuit for each could be build but Adafruit already supplies the solution in the PowerBoost 1000c. This takes care of both charging the battery and the 5V supply and seemed a safe choice for charging LiPo batteries. The only drawback is that the circuit is slightly expensive.
For the power-on switch a SS12D00G3 slider switch from eBay was connected to the relevant pins on the PowerBoost 1000c.
The final but of circuitry needed was to get sound out of the Raspberry Pi Zero. To reduce the cost of the Raspberry Pi Zero, the analogue output was removed in it’s design. However, it is well documented across the internet how to use a PWM output to regain an analogue output. Part of this requires a small filter circuit to be build that sits between the Pi PWM output and the speaker.
To replicate this a good place to start is to look at this Adafruit page and whatever else you can find, like this. For the low and high pass filter combination only a few capacitors and resistors, as described in the links, are required. To ensure the sound is sufficiently amplified, I used a PAM8403 amplifier from eBay. This requires only the channels, speakers and 5V to be connected.
The last step was to fit everything together into the enclosure.
The screen was fitted first. To secure it some perspex standoffs were made into which I drilled small holes to screw the screen to the enclosure. Next was the controller movement and action buttons on either side of the screen. For each of the movement and action buttons I removed the button cap guides from the original controller enclosure and glued them to the new enclosure. The PCB pieces for the controller was then secured using the same method with perspex stand-offs and screws. On the back of one set of buttons I glued the single speaker the project uses.
The second layer of electronics consisted off the sound circuit, Raspberry Pi, battery and power supply circuit. Each were either screwed down using the enclosure or the perfboard making up the first layer. The tactile switches are held in place by cut-outs from the perfboard and some glue.
During all of the experimentation with, and also building of the enclosure, some marks were left in the perspex. To hide these I decided to paint most of the enclosure black. The rear panel was left translucent to show some of the electronics inside.
This is the end of this build. I have certainly forgotten details on quite a lot of the steps. If you have any questions leave them as a comment below.