/raspswitch-mirror

Yet another RetroPie handheld console but this one has a collasible Bluetooth gamepad

Primary LanguageC++MIT LicenseMIT


Table of Contents


This repo is hosted on Gitlab. Any issues or pull requests on Github will be ignored and closed.

Introduction

Welcome to the RaspSwitch repo. The steps in this readme instruct how to make a Nintendo Switch-inspired handheld retro-gaming console. What makes this unique to other variants is a DIY bluetooth, collapsible gamepad deemed the DuinCon. Heavy inspiration from the SwitchBerry.

alt text alt text

alt text alt text

Design Overview

Below are wiring diagrams of the RaspSwitch. These are for reference only. Make sure you understand each component's function.

Console

alt text

The console consists of a Raspberry Pi 3 A+ and the HyperPixel 4.0 as the display. A Powerboost 1000c and a 2500mAh lithium battery supply power. In practice, the battery life is ~1.5 hours. You can use an external battery pack to lengthen that. There's also circuitry to turn the console on and off with a switch, a power LED that turns on when the battery is low, and electronics that switch audio from the built-in speakers to headphones if they're plugged in.

NOTE: I want to reiterate that the above is just for reference. Several elements are not in the fritzing diagram including the HyperPixel 4.0, USB cable from the PowerBoost 1000c, etc.

DuinoCon

alt text

The bluetooth gamepad is fairly simple. It's main components are an Arduino Micro, two shift registers, two thumb joysticks, and a blueSMIRF module. A 1200mAh lithium ion battery and Powerboost 1000c supply power. I was getting 4+ hours of use from this battery. Mechanically speaking, the gamepad is one unit that can collapse instead of two separate gamepads like the Nintendo Switches joycons. I'll be honest, separate gamepads are probably more functional than a collapsible gamepad, but at least now you can learn from my mistakes.

Full Component List

Setting up the blueSMIRF as an HID Device

  1. Load the Arduino Micro with command mode test firmware.
  2. Send $$$<cr> via the serial monitor to enter command mode.
  3. Send SU,96 to change the baud rate to 9600 bps.
  4. Send S~,6 to switch the module to the HID profile.
  5. Send R,1 to reboot.
  6. Send SH,0220 to make the module a gamepad.
  7. Send GH to check that it changed. The response needs to be SA,1 or at least not SA,0 to work.

Test the gamepad functionality

  1. Follow the instructions in the firmware comments to wire the components on a breadboard. Use the wiring diagrams and schematic as reference only. DO NOT SOLDER ANYTHING YET.
  2. Connect to any bluetooth capable device and ensure the blueSMIRF is seen as a bluetooth joystick and all the buttons and analog axes work. I used jstest-gtk for debugging. There's probably a similar program for your OS.

Setting up RetroPie

  1. Ensure you have a USB keyboard and a Ethernet connection.
  2. Download RetroPie image.
  3. Use Etcher (our your favorite image burning tool) to install RetroPie on a micro SD card.
  4. Boot RetroPie on the Raspberry Pi.
  5. Configure a USB keyboard as a RetroPie controller.
  6. Update RetroPie.
  7. Change the timezone to yours.
  8. Change the keyboard layout to one you're familiar with.
  9. Connect to wifi.
  10. Enable autologin.
  11. Enable SSH and change the password.
  12. Register the DuinoCon as a bluetooth gamepad.
  13. Configure DuinoCon as a RetroPie controller.
  14. Force reconnection in background.
  15. Install the HyperPixel 4.0 software with curl https://get.pimoroni.com/hyperpixel4 | bash more info at https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-hyperpixel-4

NOTE: I've tried to configure the Raspberry Pi to switch between HDMI and the HyperPixel but have had modest success. You can read up on it here and take your best shot https://forums.pimoroni.com/t/hyperpixel-selective-output-eg-on-boot/5193/3 .

Mechanical Assembly Sanity Check

  1. 3D print all the parts.

  2. Before you install the threaded inserts, you should assemble the 3D printed parts to make sure they mate as intended. You'll likely have to do some post-processing depending on the 3D printer you use. I modeled the parts to have excess material so they could be printed on any printer and be post-processed for proper assembly. Use the following steps as a minimum checklist for part assembly.

  3. A micro SD card should be able to slip through slot on the side of the console. It should not stick...like at all.

alt text

  1. The port for the headphone jack, SPDT switch, and RGB led should slip into it's hole in the front of the console enclosure. A little sticktion is ok.

  2. The console's tabs should slip into the gamepads slots. There should be zero stick...like at all.

alt text alt text

  1. The slide bay should slip into the two halves of the gamepads. There should be zero stick...like at all.

alt text

  1. The linear shaft should slip into the shaft guide. A little sticktion is ok.

alt text

  1. The console release tip should slip through it's housing in left gamepad half. There should be zero stick...like at all.

  2. The console catch should slip though it's housing in the left gamepad half. There should be zero stick...like at all.

alt text

  1. A spring should rest in the right gamepad catch enclosure when it's flipped upside down.

alt text

  1. The assembled right gamepad catch should slip in and out of it's enclosure. There should be zero stick...like at all.

alt text

Full Assembly

NOTE: I'd recommend only charging one battery and leaving another in a low/near-dead state to troubleshoot the low battery fuction of the 1000C.

ANOTHER NOTE: I'd recommend using stranded wire as it's more flexible than solid core.

ONE MORE NOTE: You will need to cut the protoboards I link to in the full component list. I did this easily with a dremel tool.

Console Assembly

Console Component list

  • Raspberry Pi A+ x1
  • Hyperpixel 4.0 display x1
  • GPIO header extension x1
  • M2.5 mm shoulder x4
  • M2.5 fasteners x4
  • M2 threaded inserts x12
  • M2x6 fasteners x10
  • M2x3 fasteners x2
  • 2500mAh Lithium ion battery x1
  • Powerboost 1000c x1
  • Appropriately sized protoboard for audio/power circuit x1
  • 3.5 mm audio jack x1
  • 3.5 mm audio plug x1
  • Right angle HDMI adapter x1
  • RGB led x1
  • SPDT switch x1
  • 0.5W 1" speaker x2
  • 10k ohm resistor x1
  • 10 ohm resistor x1
  • all 3D printed parts
  1. Test your components on a breadboard

  2. Seriously, save yourself some time and connect everything, raspberry pi, Arduino, all the components on a breadboard and use the joysticks, buttons, headphone jacks, switches...test all of this before you start soldering anything.

  3. Make sure you did the mechanical assembly right.

  4. I'm being repetitive but seriously if you skipped the mechanical assembly part above go back up and do it.

  5. Solder the audio/power PCB including the Powerboost 1000c, 3.5mm plug, and speakers that I forgot to solder in the photo below.

alt text

  1. Test that the audio jack and speakers work in a known good audio source. Also, check that the LED turns green and red as expected and the slide switch works.

  2. Install the threaded inserts in the top and bottom half of the console enclosures.

alt text

  1. Install the audio/power PCB, don't install the Powerboost 1000c yet. The M2X3 fastener works best here.

alt text

  1. Install the HDMI adapter and3.5mm plug onto the Pi. Then install the Pi into the bottom half of the console enclosure without the micro SD card. It's easiest to slide the Pi in sideways.

  2. Install the Powerboost 1000c, but don't fasten down the fastener too tight as you might need to adjust it for the next step. The M2x3 fastener works best here.

alt text

  1. Attach a USB cable to the Powerboost 1000c and Raspberry Pi. You might need to push down the LED wires to accomplish this.

alt text

  1. Install the threaded inserts and header pin extender onto the Hyperpixel 4.0. Then install the Hyperpixel 4.0 onto the Raspberry Pi. Once the screen is on, screw in the fasteners included with the display (M2.5) from the bottom half of the console into the raspberry pi.

alt text

  1. Install the speakers into the top half of the console. M2x6 fasteners works best here.

  2. Install the top half of the console enclosure onto the bottom half of the enclosure. Use M2x6 fasteners.

alt text

Gamepad Assembly

NOTE: This is a complex soldering assembly. No less than 7 boards need to be soldered to the Arduino in some way. It's worth your time and sanity to review the circuit to make sure you understand what each wire is for. You may also want to practice making solder bridges.

Component List

  • Arduino Micro x1
  • 20 pin DIP IC socket x1
  • Powerboost 1000c
  • M2 threaded inserts x17
  • M2x6 fasteners x17
  • M2 hex nuts x4
  • M2 washers x4
  • blueSMIRF
  • 1200mAh lithium ion battery
  • Joystick x2
  • Joystick breakout board x2
  • appropriately sized protoboard for the right gamepad face buttons x1
  • appropriately sized protoboard for the left gamepad face buttons x1
  • appropriately sized protoboard for the shoulder buttons x2
  • 3cmx7cm protoboard x1
  • Soft tactile momentary swtich x14
  • 10k ohm resistor x15
  • 100 ohm resistor x1
  • SN74HC165N PISO shift register x2
  • 16 pin DIP IC socket x2
  • 3" linear saft x2
  • 5" linear shaft x2
  • 0.938" spring 1
  • 0.5" spring x 3
  • all 3D printed parts
  1. Did you test the components on a breadboard? Because if you didn't your going to have a bad time.

  2. Assemble all your components and place them on their respective boards.

alt text

NOTE: To ease debugging, these steps will instruct to only solder the components for the right half of the gamepad then test the circuit.

ANOTHER NOTE: Depending on the gauge wire/DIP IC socket leads/protoboard you're using, the hookup wire AND the DIP IC lead could fit in one through hole. It will make soldering a lot neater if you consolidate.

ONE LAST NOTE: You'll need to bend the leads of the ISP on the Arduino Micro as shown in the picture above.

  1. Solder ONLY the 5V and GND pins of the Arduino Micro to the protoboard. Make sure it's in a location that aligns with the USB access port in the bottom half of the right gamepad enclosure. Solder the 5V and GND pins of the Powerboost 1000c to the 5V and GND pins of the Arduino Micro. Check your soldering by powering on the Arduino Micro.

alt text

NOTE: The VS pin should be soldered directly to the SPDT Switch, but everything else that requires 5V, (Arduino, buttons, etc.), should be connected to the 5V pin of the Powerboost.

  1. Solder the SPDT switch, RGB led, and accompanying resistors to the protoboard. I used the solder pads as power and ground planes, but you can solder your own way if you like. Check your soldering by turning the Arduino Micro on and off with the switch.

alt text

  1. Solder all of the components for the right half of the gamepad, connect the electronics to a bluetooth compatible device and check that everything works. Don't solder any of the components for the left half of the gamepad yet.

alt text

  1. Install the M2 threaded inserts into the shaft guides.

alt text

  1. Install the 5" linear shafts in the dual shaft bay and install the M2 threaded inserts into the dual shaft bay.

alt text alt text

  1. Insert the 3" linear shafts into the shaft guide. Hold the shaft guide/linear shaft sub-assembly into place in the bottom gamepad halves and slide the dual shaft bay subassembly into place.

alt text

alt text

alt text

  1. Fasten the end caps into place. Fasten the shaft guide into place.

alt text

  1. Now we're going to switch back to electronics. Solder the second SN74HC165N PISO shift register, push buttons and accompanying resistors onto their PCBs. Solder VCC, GND, and SEL pins of the left joystick to this PCB assembly. DO NOT solder the HOR or VER pins yet.

alt text

  1. Cut long (9"+ at the very least) pieces of hook up wire. You need 2 wires for 5V and GND, 2 wires for HOR and VER of the joystick, 4 wires for the SN74HC165N PISO shift register. Solder the remaining connections. Before you fasten any boards, connect the Arduino to a bluetooth capable device and make sure everything is working properly.

alt text alt text

  1. We're switching back to the 3D printed parts. Install M2 threaded inserts into the top and bottom half of the gamepad enclosures.

alt text alt text

  1. Install M2 threaded inserts into the right gamepad release slide and fasten it to the right gamepad catch.

alt text

  1. Put the right gamepad catch and release assembly into place. Place the 0.938" spring into place. Fasten the enclosure.

alt text alt text

  1. Press fit the blueSMIRF into place.

alt text

  1. Install the shoulder button PCB. M2x3 fasteners work best here. I found it easier to fasten this PCB with the DuinoCon on it's side.

alt text alt text

  1. Put Arduino Micro PCB into place and fasten it with a M2x3.

alt text

  1. Place the joystick PCB into place and fasten it with a M2 hex nut and a washer in between the nut and joystick board.

alt text

  1. Fasten the face button PCB into place and put the 3D printed buttons on the momentary switches. Put the top right half on top and fasten it into place.

alt text

  1. The left gamepad assembly follows a similar procedure except for a key difference: the console catch and release. After installing the left thumb joystick, install the gamepad release tip.

alt text

  1. Install three 0.5" springs into the console catch, then install the console catch into the left gamepad.

alt text

  1. Install the rest of the PCBs and buttons as before and fasten the top into place. You're done!

alt text