Arduino Retro Game Controller

by Arnov Sharma in Circuits > Remote Control

612 Views, 10 Favorites, 0 Comments

Arduino Retro Game Controller

Arduino Retro Game Controller- Pokemon
23.gif
24.gif
IMG_20241011_234121.jpg
Image2.jpg

Greetings everyone and welcome back. Here's something fun.

The Arduino Retro Game Controller was built from scratch using a custom PCB and a couple of 3D-printed parts. The Arduino Micro, which has the Atmega32U microcontroller with HID, compatibility, is being used here to transform the microcontroller into a game controller.

The goal was to put together a game controller that would allow users to play Pokémon games using an emulator. Here, we chose an all-buttons controller that does not have an analog or thumbstick, but we have included two joysticks on the main PCB that will be used in the project's second revision.

Along with a few resistors that are connected in series with each button, the buttons are positioned on the top side of the board. In this case, all of the button data is being read using a single I/O pin.

Along with two 3D-printed handles that are connected to the left and right sides of the circuit, the Arduino Micro is positioned on the bottom side of the board.

When this controller is plugged into any device—Windows, Linux, or even a Raspberry Pi—it registers as a game controller; all the user has to do is map the keys and start using it.

Supplies

These were the materials used in this project.

  1. Custom PCB (Provided by PCBWAY)
  2. 3D Printed Parts
  3. Right Angle Push Buttons
  4. Horizontal Push Buttons
  5. M3 bolts
  6. M3 Threaded Inserters
  7. Arduino Micro

Design

15.PNG
16.PNG
17.PNG
Capture.PNG
2Capture.PNG

We began the project's design by drawing a basic concept that was based on the layout of a typical game controller, which has a PCB in the middle that houses all the components and two holding supports on the left and right sides.

Here, we created a PCB that is attached to the circuit is the left and right handles. The Arduino Micro is located on the back side of the board, while all of the buttons are positioned on the top side.

With a 0.4mm nozzle and a 0.2mm layer height, we used transparent PLA to 3D print the handle components.

Circuit

sch_page-0001.jpg
14.PNG

The Arduino Mini, which serves as the project's main microcontroller, is connected to 12 buttons in a particular sequential order.

Here, we constructed an arrangement resembling a voltage divider using twelve 1k ohm resistors connected in series with the button pins and VCC. The switch has resistors linked to one side and ground connected to the other.

An analog pin receives a value when a button is pressed; by reading this value, we can identify which button is being pressed. This makes it simple to integrate 10–20 buttons into a single I/O pin.

In the schematic, we have also included two thumb sticks that will be used in a future project.

Following the schematic's preparation, we made the board file and used the Cad file's layout to arrange every component correctly.

PCBWAY Service

03.gif
IMG_20240827_210148.jpg
02.gif
Capture3.PNG
01.gif

Following the completion of the board design, we ordered a white solder mask with black silkscreen and submitted the PCB's Gerber data on the PCBWAY quote page.

PCBs were received within a week, and the PCB quality was outstanding. Here, we added a few design elements on the board's silkscreen layer to increase the aesthetic appeal of the project. PCBWAY made the custom layer properly, which shows their great PCB manufacturing capabilities.

Also, PCBWay is hosting its 7th Project Design Contest, a global competition that invites electronics enthusiasts, engineers, and makers to showcase their innovative projects. The contest provides a platform for participants to share their creativity and technical expertise with the broader community.

This year’s competition includes three major categories: electronic project, mechanical project and SMT 32 project

With prizes awarded for the most exceptional designs, the contest aims to inspire and support innovation, making it an exciting opportunity for both professionals and hobbyists to gain recognition and connect with like-minded creators.

You guys can check out PCBWAY if you want great PCB service at an affordable rate.

Circuit Assembly Process

04.gif
05.gif
06.gif
07.gif
08.gif
09.gif
10.gif
11.gif
12.gif
13.gif
14.gif
  1. We start by adding the 1K 1206 resistor in its place by using a soldering iron. Here, we first add solder to one pad, then use a tweezer to pick up the resistor and melt the solder that was applied to the first pad. The resistor was then firmly fixed in place by applying solder to the other pad.
  2. By following this method, we added all 12 resistors in their place.
  3. Next, we placed all of the push buttons in their proper locations, including both horizontal and vertical buttons.
  4. We secured them in place by attaching solder wire to their pads, from the back of the board.
  5. Next, we attach two CON12 header pins from the back of the board to the Arduino Micro footprint.
  6. We solder the CON12 pads from the top side and fasten them firmly.
  7. Next, we use the previously inserted CON12 header pins to connect the Arduino Micro in its location.
  8. The circuit assembly is now finished.

Final Assembly Process

15.gif
16.gif
17.gif
18.gif
19.gif
20.gif
  1. We begin the final assembly step by inserting the threaded inserts into the 3D handle's mounting holes.
  2. Next, we use our soldering tip to heat the insert,, which forces it into place. For each of the four mounting holes, we followed this procedure.
  3. Next, we use four M3 bolts to attach the left and right 3D-printed handles to the circuit.
  4. Assembly is now completed.

CODE

26.gif

We created a basic sketch for the project's code that is based on the Gamepad library, which you must install before using.

In this sketch, the single button, A0, is used to read the various values when any button is pressed. For instance, pressing the UP button yields a value of 0; pressing the Down button yields a value of 511.

Values for each button are different.

For each button, if the analog value from A0 falls within the specified range, the corresponding button is marked as pressed (true); otherwise, it's released (false).

In the below code sections, the microcontroller checks the value of A0 and sets the gamepad buttons accordingly.

if (value > -5 && value < 5) // UP
gp.setButtonState(0, true);
else
gp.setButtonState(0, false);

The code reads an analog input from pin A0 and uses predefined ranges of values to simulate the press and release of gamepad buttons. Each range corresponds to a different button (UP, DOWN, LEFT, RIGHT, triggers, and face buttons like A, B, X, Y). The Gamepad object (gp) handles the state of these buttons by using the setButtonState() function.

To get values of each button, we used the Analog Serial Read Sketch from the example menu and used it to get values of each button.

Next, a table is prepared for recording all of the values, and tolerance values of +5 and -5 are added to the actual value. The tolerance value will be entered into the main code.

Result

Arduino Retro Game Controller- Pokemon
21.gif
22.gif
23.gif
24.gif
25.gif

The result of this little project is a functional game controller that can be used to play retro games that do not need analog thumbsticks.

Using a PC NDS emulator, we launched Pokémon Platinum, one of the best Pokémon games ever made, to test the power of this custom gaming controller.

Prior to anything else, the button layout needs to be configured. This was accomplished by choosing the emulator controller configuration and entering the button layout in the configuration.

The controller was extremely responsive and worked smoothly.

In addition, we appreciate PCBWAY's support of this project. Visit them for a variety of PCB-related services, such as stencil and PCB assembly services, as well as 3D printing services.

Thanks for reaching this far, and I will be back with a new project pretty soon.

Peace.