The simplest way to connect arcade buttons and a joystick to both a PC and a Raspberry Pi is a USB arcade encoder. Wire each switch to the encoder’s labeled input, connect the encoder’s common ground, then plug it into the host. The operating system sees the cabinet as a keyboard or gamepad, so you can configure it in RetroPie, MAME, or another emulator without writing GPIO code.
Direct Raspberry Pi GPIO wiring is also possible and can reduce hardware, but it is Pi-specific: every switch needs a GPIO input, all switches share a Pi ground, and your software must support the chosen GPIO method. Legacy DB9 joysticks require an exact, hardware-specific pinout check before any signal is connected.
As an Amazon Associate I earn from qualifying purchases.
Choose the connection method first
Your host, the number and type of controls, and how much wiring and software maintenance you want determine the right architecture. A USB encoder is the practical default for a cabinet that may move between a Windows, Linux, or Raspberry Pi system. GPIO is useful when the controls are permanently attached to a Pi and you are comfortable configuring input software. A DB9 adapter or direct wiring is a special-case project, not a universal standard.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
| Connection | Best use | Host compatibility | Wiring and software | Important limits |
|---|---|---|---|---|
| USB arcade encoder | One cabinet used with a PC and Raspberry Pi | PC and Pi with a USB port; the encoder may present as keyboard or gamepad | Switch wires go to labeled encoder terminals; no separate GPIO driver code on the PC | Input count and special-control support depend on the encoder |
| Direct Raspberry Pi GPIO | Pi-only builds and projects that need direct switch access | Raspberry Pi only | Each switch line goes to a GPIO input and a shared common goes to ground; software configuration is required | Pin availability, GPIO numbering, and driver support vary by Pi model and image |
| Legacy DB9 joystick | Existing vintage or Competition Pro-style hardware | Only after the exact connector pinout and an interface method are verified | Signals must be mapped individually to GPIO or another interface | DB9 wiring is not universal; a wrong pin can damage hardware or produce incorrect inputs |
Why a USB encoder is usually the portable choice
An encoder translates the electrical state of arcade microswitches into ordinary USB input events. The host does not need to know that the input came from a Sanwa-style joystick or a cabinet button. Ultimarc describes its I-PAC range as interfaces that connect arcade controls to a host USB port. The I-PAC2 provides 32 inputs, keyboard and gamepad modes, generic USB operation, and Linux/Raspberry Pi support. It also includes a dedicated connection for a trackball or spinner, which matters if your cabinet needs more than digital buttons.
#1 Best Overall
- Spacious Design: Measuring 21.1" wide and 14.1" deep, our lap desk comfortably fits most laptops up to 15.6". Extra room for accessories ensures convenience.
- Enhanced Functionality: Packed with handy features, including a 5x9" precision tracking mouse pad and a built-in phone slot for seamless work or video calls. Plus, enjoy ergonomic support with the integrated cushioned wrist rest.
- Cool Comfort: Enjoy a stable surface with our lap desk's dual bolster cushion, designed for comfort and airflow, keeping your lap cool during extended use.
- Durable Surface: Work with confidence on our lap desk's solid surface, featuring a sleek black carbon color, ensuring optimal air circulation to prevent your laptop from overheating.
- On-the-Go Convenience: With an integrated handle and lightweight design (2.8 lbs), our lap desk is portable for travel or moving around the house, offering flexibility in any space.
Because the encoder is USB, the same harness can be moved from a PC to a Pi. You still configure the controls in the operating system or emulator, but you do not rewrite GPIO code each time the host changes.
When direct GPIO is the better fit
GPIO wiring can be appropriate for a Pi-only project, an educational build, or a design where you want complete control over the input driver. A switch is electrically simple: one terminal is the signal and the other is common. The Pi reads the signal on a GPIO input and detects the switch closing to ground. The software layer then turns those readings into joystick or keyboard events.
The trade-off is that GPIO is tied to the Pi’s header and to the software image you select. Moving the cabinet to a PC means adding a separate interface. GPIO also leaves less room for unusual controls unless your board, driver, and available pins support them.
Parts and safety checks
Prepare the parts before mounting anything. For a typical digital cabinet, you need:
Rank #2
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
- A joystick with four directional microswitches.
- Push buttons for the action, start, and coin inputs you plan to use.
- A USB arcade encoder and its wiring harnesses, or jumper wires and a breadboard for a GPIO build.
- A USB cable for the encoder route.
- A Raspberry Pi with the required GPIO header if you are wiring directly to GPIO.
- A multimeter or continuity tester for unfamiliar connectors and legacy hardware.
Sanwa-style harnesses commonly expose one common connection and four directional switch lines. Do not assume a wire color or connector orientation is universal. Identify the common wire and each direction from the joystick’s documentation or by testing continuity while moving the stick.
Raspberry Pi GPIO inputs are logic-level connections. Do not apply 5 V to a GPIO pin. The cited direct-wiring setups connect switches between GPIO inputs and ground; they do not establish a universal rule for every joystick harness, so verify the exact board and connector documentation before powering the Pi.
Connect arcade controls with a USB encoder
This procedure works for a mixed PC/Raspberry Pi cabinet. The terminal names differ between encoder models, but the wiring principle is the same: every switch signal goes to its labeled input and all commons are connected as the encoder documentation requires.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitches- Plan the inputs. Identify the joystick directions, action buttons, start, coin, and any service or menu button. Leave one convenient button for an escape or menu function so you can operate the cabinet without a full-size keyboard.
- Mount the controls. Install the joystick and buttons in the control panel. Make sure each microswitch is firmly seated and that the lever’s up, down, left, and right positions match the physical layout.
- Connect the joystick. Attach the harness signal terminals to the encoder inputs labeled Up, Down, Left, and Right. Attach the joystick common or ground to the encoder’s common connection. If the harness has a five-pin connector, verify its orientation and which pin is common rather than relying on a color convention.
- Connect the buttons. Run each button’s signal terminal to the matching encoder input, such as Button 1, Button 2, Start, or Coin. Connect every button COM terminal to the encoder ground/common circuit. Some harnesses provide a daisy-chain ground; use it only if it is wired for your encoder.
- Inspect for shorts. With the host disconnected, check that no signal terminal is touching an adjacent input and that the common chain reaches every switch. A continuity test can confirm that an unpressed switch is open and a pressed switch closes to common.
- Plug in USB. Connect the encoder to a PC or Raspberry Pi USB port. An encoder that supports keyboard mode will generate key presses; one in gamepad mode will appear as a controller. The I-PAC family can operate in either mode, and its default MAME-oriented assignments can be used before custom programming.
- Verify each input. Use the host’s controller or keyboard test screen, or an emulator’s input display, and press one control at a time. If two controls activate together, inspect the ground chain and the two signal terminals before changing software settings.
Configure RetroPie after the encoder is detected
At first startup, RetroPie presents a controller-configuration prompt. Hold the requested button and assign directions, action buttons, Start, and Coin as the prompts appear. A keyboard-mode encoder may need to be treated as keyboard input rather than a conventional gamepad, depending on the image and configuration you installed.
Rank #3
- Note: Not suitable for MacBooks released after 2023 or devices with a protruding front camera; Not applicable to full-screen or notch-style tempered glass screen protectors; Do not use on the rear camera of the phone.
- 💻 Why Do You Need a Webcam Cover Slide? — Safeguard your privacy by covering your webcam with our reliable webcam cover when not in use. Don't let anyone secretly watch you. Stay protected!
- ✅ Thin & Stylish — Enhance your laptop's functionality and aesthetics with our 0.027" ultra-thin webcam covers. Seamlessly close your laptop while adding a touch of sophistication.
- ✅ Fits Most Devices — Compatible with laptops, phones, tablets, desktops! Keep your privacy intact on Ap/ple, Mac/Book, iPh/one, iP/ad, H/P, L/novo, De/ll, Ac/er, As/us, Sa/msung devices.
- ✅ 365 Days Protection — Our upgraded 3.0 adhesive ensures a strong hold that won't damage your equipment. Experience reliable, long-term privacy protection day in and day out.
Record the assignment you choose. If you skip an optional control, hold a button as instructed by the configuration screen to continue, then test the result in a game. Configuration at the front end does not guarantee that every arcade title uses the same layout.
Remap controls in MAME or another emulator
Open the emulator’s input configuration when a game has a different control scheme, extra buttons, or a two-player layout. Map the physical control to the game’s named action rather than assuming that “Button 1” always means the same thing. Keep a dedicated escape, menu, or quit input. I-PAC shift functions can provide cabinet commands such as menu access without adding a keyboard, but the exact key combination depends on how the encoder is programmed.
Wire arcade controls directly to Raspberry Pi GPIO
Direct GPIO does not use a USB encoder. The Pi reads each switch on a header pin, while a shared ground completes the circuit. The MakeCode harness example uses a Sanwa-style five-pin joystick, jumper wires, and a breadboard. Adafruit’s setup likewise connects controls directly to GPIO and ground without external pull-up resistors in that particular configuration.
- Confirm the Pi and software. Use a model with the GPIO header required by your project and an operating-system image that supports the GPIO input method or driver you intend to use.
- Choose and document GPIO pins. Make a table before wiring: physical control, GPIO number, and software name. Decide whether your software uses physical header numbers, BCM GPIO numbers, or another numbering scheme; mixing these systems is a common cause of wrong inputs.
- Create a common ground rail. Join the joystick common and every button COM terminal to one ground rail. Connect that rail to a Pi ground pin, not to a 5 V pin.
- Connect the joystick signals. Run the four directional switch lines to four separate GPIO inputs. Verify which line is Up, Down, Left, or Right with the joystick documentation or a continuity test.
- Connect button signals. Run each remaining button signal to its own GPIO input. Do not place two independent controls on the same GPIO unless your input design deliberately supports that arrangement.
- Check voltage and shorts. Inspect every connection with the Pi powered off. Ensure the wiring exposes only Pi logic levels and that no 5 V source can reach an input.
- Enable the input method. Configure the GPIO driver or front end required by your software image. The driver must know which pins are inputs and how a switch closure to ground is interpreted.
- Test one control at a time. Confirm each direction and button in the driver’s test screen before launching an emulator. A permanently active input usually indicates a swapped common/signal connection, an incorrect pull-up or pull-down setting, or the wrong GPIO number.
- Map the controls in the emulator. Use the same logical mapping process as with a USB controller. RetroPie’s first-start configuration flow is a useful model, but individual games can still require their own input remap.
Understanding the Sanwa-style five-pin joystick
The five positions normally represent one common connection plus four directional switches. The connector is convenient because it can carry all five lines together, but the pin order and orientation must be verified for the particular joystick and harness. If the common line is placed on a GPIO input and a direction is placed on ground, the Pi may report a permanently active or inverted control. Test the harness before inserting it into the header.
Rank #4
- Anti-Slip Surface - Transform your laptop into a mobile workstation with the AboveTEK portable laptop lap desk. The anti-slip surface provides a strong grip for laptops up to 15.6 inches(Diagonal), while the double rubber strip on the bottom ensures a stable display or typing experience on your lap, couch, or bed.
- Retractable Mouse Pad - Retractable laptop mouse pad extends on both directions for the left/right handed with elevation along the edges for stopping mouse from falling off. The size of laptop tray is 14" X 9.7" and the size of mouse pad is 7.4" X 6.1".
- Effective Heat Shield - The effective heat shield made of sturdy and thick material protects your laptop from overheating. Prioritizes your comfort and safety, an ideal lap pad or board for working anywhere.
- EASY to Carry and Store - With an ergonomic and simplistic design, the lap desk is portable to store in a backpack. Only 15" in size, 2.2 lb of weight and with slim 0.6 inch thickness, it is ready to be easily carried around.
- Widely Applicable - The smooth platform accommodates laptops and tablets up to 15.6 inches(Diagonal), making it a versatile accessory and one of the best gifts for mom, dad, students and professionals. Perfect for use as a laptop bed tray or tablet holder anywhere at home, library, or park.
GPIO limitations that affect cabinet design
The number of usable inputs is not a single universal figure. It depends on the Pi model, pins reserved by other peripherals, your numbering scheme, and the input driver. A USB encoder with a stated capacity gives a clearer expansion target; direct GPIO requires you to count available pins and leave room for any display, audio, shutdown button, or other hardware in the same project.
Use a legacy DB9 joystick only after checking its pinout
A DB9 plug describes the connector shape, not a universal joystick standard. Identify the exact joystick model and its wiring before connecting it to a Pi or an adapter. A Raspberry Pi Magazine example for a Competition Pro-style joystick assigns DB9 pins 1–4 to Up, Down, Left, and Right, pin 6 to Fire, and pin 8 to Ground, then maps those signals to Raspberry Pi GPIO pins. That assignment applies to the example hardware; it must not be treated as a general DB9 rule.
- Identify the joystick’s model and connector orientation.
- Obtain or measure the pinout with a continuity tester.
- Write down every signal and its intended GPIO or interface input.
- Confirm the Pi’s GPIO numbering scheme and ground pin.
- Connect signals with power removed.
- Power the system only after checking for 5 V exposure, shorts, and reversed ground.
- Test each direction and fire input separately before mapping an emulator.
If the pinout cannot be established confidently, stop and use a known encoder or a documented adapter instead. Guessing on a DB9 connector can produce incorrect controls and may damage the Pi.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Configure the host and emulator
PC workflow
After a USB encoder is connected, let the operating system enumerate it. In keyboard mode, open a text editor or keyboard-test utility and verify that each switch produces the intended key. In gamepad mode, use the operating system’s controller panel or the emulator’s input screen. If the device is not detected, try another USB cable or port, inspect the encoder’s power indicator if present, and recheck the common connection.
Best Value
- Spacious Design: Measuring 21.1" wide and 12" deep, our lap desk comfortably fits most laptops up to 15.6". Extra room for accessories ensures convenience.
- Enhanced Functionality: Packed with handy features, including a 5x9" precision tracking mouse pad and a built-in phone slot for seamless work or video calls. Plus, enjoy laptop support with the integrated device ledge.
- Cool Comfort: Enjoy a stable surface with our lap desk's dual bolster cushion, designed for comfort and airflow, keeping your lap cool during extended use.
- Durable Surface: Work with confidence on our lap desk's solid surface, featuring a blush pink color, ensuring optimal air circulation to prevent your laptop from overheating.
- On-the-Go Convenience: With an integrated handle and lightweight design (2.14 lbs), our lap desk is portable for travel or moving around the house, offering flexibility in any space.
Open the emulator’s global input settings and assign the controls in a consistent order. Then open a representative game and check its per-game settings. Arcade emulators often preserve original machine layouts, so a global assignment may not cover a title with a spinner, trackball, separate service controls, or a different number of action buttons.
Raspberry Pi and RetroPie workflow
Connect the USB encoder before the first controller setup if you are using the encoder route. Follow the startup prompt to assign directions, actions, Start, and Coin. For GPIO, make sure the driver is active before opening the same configuration flow. Test in the front end, launch a game, and remap that game if its original controls differ.
Keep an accessible escape or menu function. A cabinet that can start games but cannot leave them is difficult to maintain. With a programmable encoder, reserve an input or shift combination for this purpose; with GPIO, assign a dedicated service button and configure it in the front end or emulator.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteTroubleshoot the symptoms you see
| Symptom | Likely cause | What to check |
|---|---|---|
| No controls respond | USB device not enumerated, missing ground, or GPIO driver not active | Try another USB port or cable; verify the encoder appears to the host; check the shared ground; confirm the GPIO software is enabled |
| One control is always active | Common and signal reversed, wrong GPIO numbering, or incorrect input bias | Power off, test continuity, compare the pin table with the software configuration, and verify the input’s pull-up/pull-down setting |
| Two buttons trigger together | Shorted signal wires or an incorrectly daisy-chained ground | Separate adjacent terminals and test each switch independently |
| Directions are swapped | Harness orientation or labels do not match the physical layout | Identify each microswitch by continuity and remap the logical direction |
| Front end works but a game does not | Per-game arcade layout differs from the global mapping | Open that game’s input configuration and assign its individual actions |
| Pi resets or behaves erratically | Unsafe voltage, a short, or inadequate power wiring | Disconnect power, remove any 5 V source from GPIO, inspect for shorts, and reconnect only after the logic-level wiring is confirmed |
| DB9 controls do not match the labels | The joystick uses a different pinout than the example | Stop guessing; verify the exact model’s pinout with documentation or a meter |
Plan for trackballs, spinners, and extra controls
Buttons and joystick directions are digital switches. Trackballs and spinners are different: they generate movement information and may need a dedicated interface. The I-PAC2 documentation lists a dedicated trackball/spinner connector, while direct GPIO capacity and driver support depend on the Pi model and software. If your cabinet includes an analog-style control, check that capability before choosing an encoder or committing to a GPIO pin budget.
Also count service, test, pause, and menu inputs, not only the controls visible during play. A 32-input encoder gives a defined expansion ceiling; a GPIO design must reserve pins for every planned function and any other electronics in the cabinet.
Quick Recap
Decision checklist
- Choose USB encoder when the cabinet must work on both a PC and a Raspberry Pi, when you want keyboard/gamepad compatibility, or when you prefer to avoid GPIO driver code.
- Choose direct GPIO when the project is Pi-only, you need direct switch access, and you can document the pin map and maintain the input software.
- Use DB9 wiring only for a known, tested legacy joystick with a verified pinout and a safe interface plan.
- Check input capacity against the total of joystick directions, action buttons, Start, Coin, service controls, menu functions, and any trackball or spinner requirements.
- Document everything with a wiring diagram and a table of logical names, physical pins, and emulator assignments before closing the control panel.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

