# PyBadge GamePad

## Overview

https://youtu.be/I6P-7q-skiM

In this project, we’re making GamePads for the Adafruit PyBadge.

PyBadge is great for conferences but it also makes a really nice gaming device!

You can make gaming sessions more comfortable with a 3D printed thumbpad and buttons!

The case is designed to house a bigger 3d printed thumbpad and buttons. You can even use flexible filaments for a softer touch with a bit more grip.

![3d_printing_hero-tetris.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/384/medium640/3d_printing_hero-tetris.jpg?1561388717)

We designed three difference cases for the back of the PyBadge to fit the header version and the PyBadge LC model. The PyBadge LC is a lot more slimmer&nbsp;without the headers and connectors.

A third version of the case includes cutouts to connect FeatherWings!

![3d_printing_hero-headers.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/383/medium640/3d_printing_hero-headers.jpg?1561388552)

![](https://cdn-learn.adafruit.com/assets/assets/000/077/410/medium800thumb/3d_printing_gameplay-loop.jpg?1561395046)

An easy to copy and paste list of parts used in this project.

- [Adafruit PyBadge](https://www.adafruit.com/product/4200)
- [USB Cable with data lines](https://www.adafruit.com/product/4148)
- [350mAh 3.7v lipo battery](https://www.adafruit.com/product/4237)
- [Mini oval speaker](https://www.adafruit.com/product/3923)
- [Inventor II 3D Printer](https://www.adafruit.com/product/3897)
- [Filament for 3D Printers](https://www.adafruit.com/product/2080)
- [3x M2x5mm screws](https://www.albanycountyfasteners.com/2MM-x-4-Phillips-Flat-Head-Machine-Screw-p/1011-1000.htm)
- [4x M3x5mm screws](https://www.albanycountyfasteners.com/3-MM-x-5-Phillips-Flat-Head-Machine-Screw-p/1011-1006.htm)

![3d_printing_parts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/385/medium640/3d_printing_parts.jpg?1561388995)

### Adafruit PyBadge for MakeCode Arcade, CircuitPython, or Arduino

[Adafruit PyBadge for MakeCode Arcade, CircuitPython, or Arduino](https://www.adafruit.com/product/4200)
What's the size of a credit card and can run CircuitPython, MakeCode Arcade or Arduino? That's right, its the **Adafruit PyBadge!** We wanted to see how much we could cram into a ​3 3⁄8 × ​2 1⁄8 inch rounded rectangle, to make an all-in-one dev board with...

In Stock
[Buy Now](https://www.adafruit.com/product/4200)
[Related Guides to the Product](https://learn.adafruit.com/products/4200/guides)
![Angled shot of a Adafruit PyBadge for MakeCode Arcade, CircuitPython, or Arduino. ](https://cdn-shop.adafruit.com/640x480/4200-01.jpg)

### Adafruit PyBadge LC - MakeCode Arcade, CircuitPython, or Arduino

[Adafruit PyBadge LC - MakeCode Arcade, CircuitPython, or Arduino](https://www.adafruit.com/product/3939)
What's the size of a credit card and can run CircuitPython, MakeCode Arcade or Arduino even when you're on a budget? That's right, it's the&nbsp; **Adafruit PyBadge LC!** &nbsp;We wanted to see how much we could cram into a ​3 3⁄8 × ​2 1⁄8 inch...

In Stock
[Buy Now](https://www.adafruit.com/product/3939)
[Related Guides to the Product](https://learn.adafruit.com/products/3939/guides)
![Angled Shot of Adafruit PyBadge - Low Cost. ](https://cdn-shop.adafruit.com/640x480/3939-05.jpg)

### Lithium Ion Polymer Battery with Short Cable - 3.7V 350mAh

[Lithium Ion Polymer Battery with Short Cable - 3.7V 350mAh](https://www.adafruit.com/product/4237)
Lithium-ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light, and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery has a capacity of 350mAh for a total of about 1.3 Wh. If you need a larger (or smaller!) battery, <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/4237)
[Related Guides to the Product](https://learn.adafruit.com/products/4237/guides)
![Lithium Ion Polymer Battery 3.7v 350mAh with JST 2-PH connector and short cable](https://cdn-shop.adafruit.com/640x480/4237-04.jpg)

### Mini Oval Speaker - 8 Ohm 1 Watt

[Mini Oval Speaker - 8 Ohm 1 Watt](https://www.adafruit.com/product/3923)
Hear the good news! This wee speaker&nbsp;is&nbsp;a&nbsp;great addition to any audio project where you need 8 ohm impedance and 1W or less of power. We particularly like this&nbsp;speaker&nbsp;as it is&nbsp;small and comes with nice skinny wires with a connector on the end. It has a handy...

In Stock
[Buy Now](https://www.adafruit.com/product/3923)
[Related Guides to the Product](https://learn.adafruit.com/products/3923/guides)
![Small, black, oval speaker with Pico Blade connector.](https://cdn-shop.adafruit.com/640x480/3923-06.jpg)

# PyBadge GamePad

## Circuit Diagram

This provides a visual reference for wiring of the components. They aren't true to scale, this is just meant to be used as reference. This diagram was created using the&nbsp;[Fritzing software package](http://fritzing.org/download/).

Take a moment to review the components in the circuit diagram. This illustration is meant for&nbsp;referencing wired connections - The length of wire,&nbsp;position and size of components are not exact.

![](https://cdn-learn.adafruit.com/assets/assets/000/077/409/medium800/3d_printing_circuit-diagram.jpg?1561394695)

## Volume Switch

We wanted a way to quickly lower the volume when playing in quiet areas, so we added a slide switch to control the speaker volume.&nbsp;

When we flip the slide switch off, the PyBadge switches from the oval speaker to the build in buzzer speaker!

This makes on the go gaming session a-lot more enjoyable in public areas.

&nbsp;

![gaming_hero-volume-switch.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/504/medium640/gaming_hero-volume-switch.jpg?1561512605)

## Speaker Wires

Start by measuring the speaker wires so they have enough slack to work with when inserting the board into the case.

Carefully pull apart the red and black wires up to where we'll add the slide switch. Use flush diagonal cutters to trim and tin the ends of the black wire.&nbsp;

## Slide Switch

Trim the pins on the slide switch short to fit the walls inside the case. Cut and tin the ends of the black wires and then solder the wires on two of the the pins on the slide switch. Use any two pins that are side by side. You can remove the third pin.&nbsp;

## Mount Slide Switch

Next we'll need to carefully position the board and slide switch into the mounting walls on the bottom right corner. Insert the slide switch into the cutout, at an angle. We can use tweezers to press fit the back of the slide switch between the three walls. Make sure to move the wires away from the stand off and then finish mounting the top half of the case.

![gaming_volume-switch-soldered.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/508/medium640/gaming_volume-switch-soldered.jpg?1561513176)

![gaming_volume-switch-soldered-mounting.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/510/medium640/gaming_volume-switch-soldered-mounting.jpg?1561513443)

![gaming_volume-switch-mounted.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/511/medium640/gaming_volume-switch-mounted.jpg?1561513867)

![gaming_volume-switch-hero.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/520/medium640/gaming_volume-switch-hero.jpg?1561517966)

# PyBadge GamePad

## Code

## For a complete guide on setting up nofriendo on your PyBadge, follow the complete guide in the link below:
[How to Install NES Emulator for Arcada](https://learn.adafruit.com/nes-emulator-for-arcada)
![](https://cdn-learn.adafruit.com/assets/assets/000/077/379/medium800/3d_printing_copy-uf2.jpg?1561386060)

## Be sure to check out the homebrew roms linked above!
PyBadge works with CircuitPython, MakeCode Arcade and Arduino!

Adafruit’s NoFriendo software emulates NES games so you can play the classics or homebrew titles.

Use the built-in menu system to select and load ROMs.

You can even save and reload game states! This makes playing ROMs much more enjoyable!

Start by downloading the ready-to-go UF2 file.

To install, just drag and drop ithe UF2 file onto the PYBADGE USB drive.

Create an NES directory and load up your favorite ROM files!

![3d_printing_rom-select.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/407/medium640/3d_printing_rom-select.jpg?1561393725)

![3d_printing_menu.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/408/medium640/3d_printing_menu.jpg?1561393761)

# PyBadge GamePad

## 3D Printing

## 3D Printed Parts

The parts in this kit are designed to be 3D printed with FDM based machines. STL files are oriented to print "as is". Parts require tight tolerances that might need adjustment of slice settings. Reference the suggested settings below.

&nbsp;

![3d_printing_print-loop.gif](https://cdn-learn.adafruit.com/assets/assets/000/077/380/medium640thumb/3d_printing_print-loop.jpg?1561387127)

## CAD Files

The fusion 360 source file is included and features original sketches and feature timeline along with easily editable user parameters. The parts can further be separated into small pieces for fitting on printers with smaller build volumes. Note: STEP file is included for other 3D surface modeling programs such as Onshape, Solidworks and Rhino.

&nbsp;

![3d_printing_3d-parts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/381/medium640/3d_printing_3d-parts.jpg?1561387203)

[Edit Design](https://a360.co/2ZPE6mx)
[Download STLs](https://www.thingiverse.com/thing:3712039)
## Settings

Use these settings as reference. Values listed were used in&nbsp;[Prusa Slicer](https://github.com/prusa3d/PrusaSlicer/releases)&nbsp;slicing software.

- 0.2mm Layer Height / 0.4mm nozzle
- 0.38mm Line Width (inner & outer widths)
- 40mm/s printing speed
- 20% infill
- Supports: No

![3d_printing_slice-loop.gif](https://cdn-learn.adafruit.com/assets/assets/000/077/382/medium640thumb/3d_printing_slice-loop.jpg?1561388048)

## NinjaFlex buttons

The buttons are print in flexible material. We used NinjaFlex 85A (elastic) for a more rubbery, squishy feel.

**We recommend printing two of the buttons and thumbpads at the same time to prevent these small parts from heating up a deforming.&nbsp; &nbsp;**

Below are some of the setting we modified in the default flexible materials profile in Prusa Slicer.

- no retraction (off)
- 30mm/s print speed
- 230c nozzle
- 55c Bed
- first layer height .25mm (avoids bonding to the bed)

# PyBadge GamePad

## Assemble

## PyBadge LC Speaker&nbsp;

We designed three different cases for the back of the PyBadge to fit the PyBadge header version and the PyBadge LC model, which has no headers or connectors. The third version of the case includes cutouts to connect Feather Wings.&nbsp;

Having no headers keeps the case design slim, so we’ll need to solder our speaker to the solder pads on the back.

Start by measuring the wire length. I looped it around the speaker to ensure we have enough wire to solder.&nbsp; Next we'll remove the pico connector and align and solder the wires to the pads.

![3d_printing_speaker-wire-measure.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/388/medium640/3d_printing_speaker-wire-measure.jpg?1561389490)

![3d_printing_speaker-wire-tin.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/389/medium640/3d_printing_speaker-wire-tin.jpg?1561389537)

![3d_printing_speaker-wire-solder.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/390/medium640/3d_printing_speaker-wire-solder.jpg?1561389615)

![3d_printing_speaker-wire-soldered.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/391/medium640/3d_printing_speaker-wire-soldered.jpg?1561389667)

## Attach Speaker

Remove the protective backing on the front of the speaker (fabric side) and stick it over the outline on the PCB.

We can use mounting tack to secure the lipo battery.

## Attach Battery

Roll up a small amount of tack and place over the "battery" text on the back of the board. We used the 350mAh lipo battery. First gently curve the wires to make it easily when plugging in the connectors.

Lay the battery over the tack and gently press the battery to adhere it to the tack.

![3d_printing_speaker-attached.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/392/medium640/3d_printing_speaker-attached.jpg?1561390132)

![3d_printing_battery-attached.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/393/medium640/3d_printing_battery-attached.jpg?1561390183)

## Case Assembly&nbsp;

Now we can move on to assembling the top half of the case.

We’ll use superglue to attach the button housing. This medium grade starbond superglue dries slowly so you can align the pieces more carefully.

To avoid hazing on the case, a small desktop fan will help keep the fumes away. You can use clamps to hold parts together as they dry.

The display bezel is attached after the button housings have fully cured.

![3d_printing_button-parts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/394/medium640/3d_printing_button-parts.jpg?1561392038)

![3d_printing_case-glue.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/395/medium640/3d_printing_case-glue.jpg?1561392102)

![3d_printing_case-clamp.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/396/medium640/3d_printing_case-clamp.jpg?1561392143)

![3d_printing_case-glued.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/397/medium640/3d_printing_case-glued.jpg?1561392207)

## Gamepad and Buttons

We can print our buttons in PLA or even flexible materials.&nbsp;

Install the gamepad by inserting it into the housing. Add the washer and use an M2x5mm long screw to secure it in place.

We’ll also setup the action buttons with a washer and machine screws. This prevents the buttons from coming out.

![3d_printing_thumbPad-align.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/398/medium640/3d_printing_thumbPad-align.jpg?1561392279)

![3d_printing_thumbPad-base.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/399/medium640/3d_printing_thumbPad-base.jpg?1561392329)

![3d_printing_button-base.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/400/medium640/3d_printing_button-base.jpg?1561392462)

![3d_printing_button-base-screw.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/401/medium640/3d_printing_button-base-screw.jpg?1561392770)

## Reset Button

An extra button is added to the bottom half of the case for better access to the RESET button. Pass the smaller diameter end through the cutout on the case until the larger end lays flat around the cutout.&nbsp;

## &nbsp;

## Mount PyBadge

Place the PyBadge board over the standoffs and line up the mounting &nbsp;holes. Insert with the USB port first, at an angle.&nbsp;

Then fit the top half over the PyBadge.

Now you can insert four M3x6mm screws to secure the both sides of the case.

![3d_printing_case-bottom.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/402/medium640/3d_printing_case-bottom.jpg?1561393026)

![3d_printing_case-bottom-reset.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/403/medium640/3d_printing_case-bottom-reset.jpg?1561393076)

![3d_printing_case-bottom-board.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/404/medium640/3d_printing_case-bottom-board.jpg?1561393119)

![3d_printing_case-top-attach.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/405/medium640/3d_printing_case-top-attach.jpg?1561393160)

## Complete!&nbsp;

Now we can test out button presses. If any of the buttons stick, we can inspect the printed washers. Make sure any brims are fully removed by trimming any excess material with flush cutters.&nbsp;

Flip on the switch and game on!&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/077/411/medium800thumb/3d_printing_gameplay-loop-thumb.jpg?1561395213)


## Featured Products

### Adafruit PyBadge for MakeCode Arcade, CircuitPython, or Arduino

[Adafruit PyBadge for MakeCode Arcade, CircuitPython, or Arduino](https://www.adafruit.com/product/4200)
What's the size of a credit card and can run CircuitPython, MakeCode Arcade or Arduino? That's right, its the **Adafruit PyBadge!** We wanted to see how much we could cram into a ​3 3⁄8 × ​2 1⁄8 inch rounded rectangle, to make an all-in-one dev board with...

In Stock
[Buy Now](https://www.adafruit.com/product/4200)
[Related Guides to the Product](https://learn.adafruit.com/products/4200/guides)
### Adafruit PyBadge LC - MakeCode Arcade, CircuitPython, or Arduino

[Adafruit PyBadge LC - MakeCode Arcade, CircuitPython, or Arduino](https://www.adafruit.com/product/3939)
What's the size of a credit card and can run CircuitPython, MakeCode Arcade or Arduino even when you're on a budget? That's right, it's the&nbsp; **Adafruit PyBadge LC!** &nbsp;We wanted to see how much we could cram into a ​3 3⁄8 × ​2 1⁄8 inch...

In Stock
[Buy Now](https://www.adafruit.com/product/3939)
[Related Guides to the Product](https://learn.adafruit.com/products/3939/guides)
### NinjaFlex - 1.75mm Diameter - Midnight Black - 0.5Kg

[NinjaFlex - 1.75mm Diameter - Midnight Black - 0.5Kg](https://www.adafruit.com/product/1690)
Looking beyond ABS? Tired of PLA? Open a world of possibilities, limited only by your imagination. NinjaFlex, a cutting-edge filament for 3D printers, is a specially formulated thermoplastic elastomer (TPE) that produces flexible prints with elastic properties. Patent pending technology allows...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1690)
[Related Guides to the Product](https://learn.adafruit.com/products/1690/guides)
### Monoprice Inventor II 3D Printer with Touchscreen and WiFi

[Monoprice Inventor II 3D Printer with Touchscreen and WiFi](https://www.adafruit.com/product/3897)
The **Monoprice Inventor II 3D Printer Touchscreen with WiFi** is a perfect entry-level 3D printer with small footprint and reliable performance. It comes equipped with WiFi so you don't need a cable tether and a lovely 3.5" color touchscreen for settings & feedback....

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/3897)
[Related Guides to the Product](https://learn.adafruit.com/products/3897/guides)
### Mini Oval Speaker - 8 Ohm 1 Watt

[Mini Oval Speaker - 8 Ohm 1 Watt](https://www.adafruit.com/product/3923)
Hear the good news! This wee speaker&nbsp;is&nbsp;a&nbsp;great addition to any audio project where you need 8 ohm impedance and 1W or less of power. We particularly like this&nbsp;speaker&nbsp;as it is&nbsp;small and comes with nice skinny wires with a connector on the end. It has a handy...

In Stock
[Buy Now](https://www.adafruit.com/product/3923)
[Related Guides to the Product](https://learn.adafruit.com/products/3923/guides)
### Lithium Ion Polymer Battery with Short Cable - 3.7V 350mAh

[Lithium Ion Polymer Battery with Short Cable - 3.7V 350mAh](https://www.adafruit.com/product/4237)
Lithium-ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light, and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery has a capacity of 350mAh for a total of about 1.3 Wh. If you need a larger (or smaller!) battery, <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/4237)
[Related Guides to the Product](https://learn.adafruit.com/products/4237/guides)

## Related Guides

- [Adafruit PyBadge and PyBadge LC](https://learn.adafruit.com/adafruit-pybadge.md)
- [Arcada Animated GIF Display](https://learn.adafruit.com/pyportal-animated-gif-display.md)
- [Blinka Jump PyBadge Game](https://learn.adafruit.com/blinka-jump-pybadge-game.md)
- [PyBadger Event Badge](https://learn.adafruit.com/pybadger-event-badge.md)
- [PyGamer Marble Labyrinth in MakeCode Arcade](https://learn.adafruit.com/pygamer-marble-labyrinth-in-makecode-arcade.md)
- [CircuitPython Stage game library](https://learn.adafruit.com/circuitpython-stage-game-library.md)
- [CircuitPython Turtle Graphics](https://learn.adafruit.com/circuitpython-turtle-graphics.md)
- [PyPaint Drawing Program In CircuitPython](https://learn.adafruit.com/pypaint.md)
- [Two Player Game System for PyGamer and RFM69HCW Radio Wing](https://learn.adafruit.com/two-player-game-system-for-pygamer-and-rfm69hcw-radio-wing.md)
- [Playing Arduboy Games on Arcada](https://learn.adafruit.com/playing-arduboy-games-on-arcada.md)
- [Creating Your First Tilemap Game with CircuitPython](https://learn.adafruit.com/creating-your-first-tilemap-game-with-circuitpython.md)
- [PyGamer NeoPixel Controller](https://learn.adafruit.com/pygamer-neopixel-controller.md)
- [Game & Watch Octopus](https://learn.adafruit.com/game-watch-octopus.md)
- [Submitting Games to MakeCode Arcade Front Page](https://learn.adafruit.com/submitting-games-to-makecode-arcade-front-page.md)
- [NES Emulator for Arcada](https://learn.adafruit.com/nes-emulator-for-arcada.md)
- [Bounce - an accelerometer game in Arduino for PyGamer and PyBadge](https://learn.adafruit.com/bounce-an-accelerometer-game-in-arduino-for-pygamer-and-pybadge.md)
