# Talking D20 with RP2040 PropMaker Feather

## Overview

https://youtu.be/-aibIM8q0RY

![](https://cdn-learn.adafruit.com/assets/assets/000/124/117/medium800/3d_printing_hero-gravel.jpg?1693319846)

Build a D20 gaming die that tells you what number you rolled! Made with 3D printed parts, CircuitPython and an Adafruit RP2040 PropMaker Feather.

## RP2040 PropMaker

This is a remake of a [classic DIY project](https://learn.adafruit.com/talking-d20-20-sided-gaming-die) from 2015. This new build simplifies the assembly: instead of several breakout boards, everything is now all-in-one!

![3d_printing_hero-propmaker.jpg](https://cdn-learn.adafruit.com/assets/assets/000/124/119/medium640/3d_printing_hero-propmaker.jpg?1693321082)

### 

No. It’s full of electronics!

There’s a space to add a few pennies or some plumber’s putty as a counterbalance…you can work at it a bit if you like…but this will _never_ be a perfect entropy source. It’s intended for casual gaming, as an “executive decision maker,” or simply a conversation piece to get folks interested in code and electronics.

## Parts
Featured
### Adafruit RP2040 Prop-Maker Feather with I2S Audio Amplifier

[Adafruit RP2040 Prop-Maker Feather with I2S Audio Amplifier](https://www.adafruit.com/product/5768)
The Adafruit Feather series gives you lots of options for a small, portable, rechargeable microcontroller board. By picking a feather and stacking on a FeatherWing you can create advanced projects quickly. One popular combo is our [Feather M4](https://www.adafruit.com/product/3857)...

In Stock
[Buy Now](https://www.adafruit.com/product/5768)
[Related Guides to the Product](https://learn.adafruit.com/products/5768/guides)
![Video of a white hand pressing a button to briefly turn an LED strip into white lights. Also wired up to the microcontroller are a servo motor and a speaker.](https://cdn-shop.adafruit.com/product-videos/640x480/5768-09.jpg)

Featured
### 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...

Out of 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)

Featured
### Lithium Ion Polymer Battery Ideal For Feathers - 3.7V 400mAh

[Lithium Ion Polymer Battery Ideal For Feathers - 3.7V 400mAh](https://www.adafruit.com/product/3898)
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 **400mAh** for a total of about 1.9 Wh. If you need a larger (or smaller!)...

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

Featured
### Breadboard-friendly SPDT Slide Switch

[Breadboard-friendly SPDT Slide Switch](https://www.adafruit.com/product/805)
These nice switches are perfect for use with breadboard and perfboard projects. They have 0.1" spacing and snap in nicely into a solderless breadboard. They're easy to switch no matter what size fingers you have, but not so easy that they'll get flipped by accident. Work great as...

In Stock
[Buy Now](https://www.adafruit.com/product/805)
[Related Guides to the Product](https://learn.adafruit.com/products/805/guides)
![Small, black, SPDT slide switch.](https://cdn-shop.adafruit.com/640x480/805-03.jpg)

Featured
### USB Type A to Type C Cable - approx 1 meter / 3 ft long

[USB Type A to Type C Cable - approx 1 meter / 3 ft long](https://www.adafruit.com/product/4474)
As technology changes and adapts, so does Adafruit. This&nbsp;&nbsp; **USB Type A to Type C** cable will help you with the transition to USB C, even if you're still totin' around a USB Type A hub, computer or laptop.

USB C is the latest industry-standard connector for...

In Stock
[Buy Now](https://www.adafruit.com/product/4474)
[Related Guides to the Product](https://learn.adafruit.com/products/4474/guides)
![Angled shot of a coiled black, USB-C to USB-A cable.](https://cdn-shop.adafruit.com/640x480/4474-02.jpg)

### Part: Neodymium Magnets
quantity: 8
D42 1/4" dia. x 1/8" thick
[Neodymium Magnets](https://www.kjmagnetics.com/proddetail.asp?prod=D42)

### Part: M2.5 Steel Screws
quantity: 2
M2.5 x 6mm long screws
[M2.5 Steel Screws](https://www.mcmaster.com/92095A458/)

### Part: Starbond Medium Super Glue
quantity: 1
2 oz. Medium CA Glue (Premium Cyanoacrylate Super Glue)
[Starbond Medium Super Glue](https://www.amazon.com/Starbond-EM-150-Medium-Premium-Cyanoacrylate/dp/B00C32MHJU/)

### Part: M2.5 Screw Tap
quantity: 1
Metric Machine Taps M2.5 x 0.45mm
[M2.5 Screw Tap](https://www.amazon.com/Saipe-Thread-M1-M3-5-Tapping-Adjustable/dp/B0B38WRV9P/)

## Optional Parts
Featured
### Through-Hole Resistors - 100K ohm 5% 1/4W - Pack of 25

[Through-Hole Resistors - 100K ohm 5% 1/4W - Pack of 25](https://www.adafruit.com/product/2787)
ΩMG! You're not going to be able to resist these handy resistor packs!&nbsp;Well, axially, they&nbsp;do all of the resisting for you!

This is a **25 Pack of 100K Ω Resistors.** More specifically, they are **carbon film** , through-hole...

In Stock
[Buy Now](https://www.adafruit.com/product/2787)
[Related Guides to the Product](https://learn.adafruit.com/products/2787/guides)
![Angled shot of 25 Through-Hole Resistors - 100K ohm 5% 1/4W.](https://cdn-shop.adafruit.com/640x480/2787-00.jpg)

![](https://cdn-learn.adafruit.com/assets/assets/000/124/118/medium800/3d_printing_hero-frog.jpg?1693319956)

# Talking D20 with RP2040 PropMaker Feather

## Circuit Diagram

The diagram below provides a general visual reference for wiring of the components once you get to the **Assembly** page. This diagram was created using the software package [Fritzing](http://fritzing.org/download/).

## Adafruit Library for Fritzing

Adafruit uses the Adafruit's Fritzing parts library to create circuit diagrams for projects. You can download the library or just grab individual parts. Get the library and parts from [GitHub - Adafruit Fritzing Parts](https://github.com/adafruit/Fritzing-Library/tree/master/parts).

![](https://cdn-learn.adafruit.com/assets/assets/000/123/693/medium800/3d_printing_Circuit-Diagram.jpg?1692634600)

## Wired Connections

- The speaker wires are connected to pins on the screw block terminal. **Red** to **SPK+** , **Black** to **SPK** -
- The slide switch is connected to the **EN** and **GND** pins on the Feather.
- A 400mAh battery is connected to the battery port on the Feather.

## Optional: Battery Monitor

With the addition of two 100KΩ resistors (and a small edit to the code, explained later), the D20 can sense and announce when the battery needs charging.

Featured
### Through-Hole Resistors - 100K ohm 5% 1/4W - Pack of 25

[Through-Hole Resistors - 100K ohm 5% 1/4W - Pack of 25](https://www.adafruit.com/product/2787)
ΩMG! You're not going to be able to resist these handy resistor packs!&nbsp;Well, axially, they&nbsp;do all of the resisting for you!

This is a **25 Pack of 100K Ω Resistors.** More specifically, they are **carbon film** , through-hole...

In Stock
[Buy Now](https://www.adafruit.com/product/2787)
[Related Guides to the Product](https://learn.adafruit.com/products/2787/guides)
![Angled shot of 25 Through-Hole Resistors - 100K ohm 5% 1/4W.](https://cdn-shop.adafruit.com/640x480/2787-00.jpg)

The two resistors are connected in series. One end goes to the board’s **BAT** pin, opposite end to a **GND** pin, and the center point to one of the analog input pins such as **A3**.

The Feather’s main GND pin might already be occupied by a wire for the power switch. If you can’t fit both the wire and resistor through that hole, other ground points will suffice, such as the one on the Servo header.

![](https://cdn-learn.adafruit.com/assets/assets/000/124/149/medium800/gaming_prop-maker-feather-battery-sense.png?1693412152 This is a schematic diagram for clarity. The resistors could be installed directly across the board if you like.)

# Talking D20 with RP2040 PropMaker Feather

## CAD Files

## 3D Printed Parts

STL files for 3D printing are oriented to print "as-is" on FDM style machines. Parts are designed to 3D print without any support material using PLA filament. Original design source may be downloaded using the links below.

![3d_printing_cura-slice.jpg](https://cdn-learn.adafruit.com/assets/assets/000/124/072/medium640/3d_printing_cura-slice.jpg?1693226404)

[Download STLs.zip](https://cdn-learn.adafruit.com/assets/assets/000/124/074/original/STLs.zip?1693235817)
[Download CAD Source](https://cdn-learn.adafruit.com/assets/assets/000/124/075/original/CAD_source.zip?1693235839)
## Build Volume

The parts require a 3D printer with a minimum build volume.

- 68mm (X) x 60mm (Y) x 36mm (Z)

## 3D Printing Service

These parts were made using [JLCPCB's 3D printing service.](https://3d.jlcpcb.com/3d-printing-quote?from=homepage)&nbsp;

Use the following options for matte black resin parts.

- 3D Technology: SLA(resin)
- Material: Black Resin
- Color: Grayish BLack
- Sanding: Yes

![3d_printing_final-closed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/124/077/medium640/3d_printing_final-closed.jpg?1693236048)

This _clear_ die was make using [PCBWAY’s](https://www.pcbway.com) 3D printing service. UTR-8100 transparent resin with spray varnish finish option. This is a costlier route, but delivers an injection-molding-like appearance that would be difficult to achieve any other way.

The numbers were hand-painted to make them “pop.” It’s lovely in a _1990s clear electronics craze_ way.

![gaming_clear-d20-A.jpg](https://cdn-learn.adafruit.com/assets/assets/000/124/230/medium640/gaming_clear-d20-A.jpg?1693954704)

## CAD Assembly

The two halves are joined together with neodymium magnets.

The mini oval speaker is secured to the built-in holder on the Half-A part using the included sticky adhesive.

The 400mAh battery is secured to the mini oval speaker using the other side of the sticky adhesive.

The Feather is secured to half-A using two M2.5x8mm long screws.

The slide switch is press fitted into the built-in holder on half-A.

The cap and counterweights (2x US penny coins) are press fitted into the built-in holder on half-B.

![3d_printing_CAD-explode.gif](https://cdn-learn.adafruit.com/assets/assets/000/124/073/medium640thumb/3d_printing_CAD-explode.jpg?1693231346)

## Dual Extruder/Multi-Material

These STLs have been created for FDM 3D printers with multi-material capabilities.

The numbered labels have&nbsp; been separated from the D20 halves.

Each type of machine features their own software for slicing.

![3d_printing_CAD-MMU.jpg](https://cdn-learn.adafruit.com/assets/assets/000/124/127/medium640/3d_printing_CAD-MMU.jpg?1693400718)

[Download Multi-Material STLs](https://cdn-learn.adafruit.com/assets/assets/000/124/128/original/Dual_Extrude_STLs.zip?1693400818)
## Design Source Files

The project assembly was designed in Fusion 360. This can be downloaded in different formats like STEP, STL and more.

Electronic components like Adafruit's boards, displays, connectors and more can be downloaded from the&nbsp;[Adafruit CAD parts GitHub Repo](https://github.com/adafruit/Adafruit_CAD_Parts/).

![3d_printing_5768-Feather-RP2040-PropMaker.jpg](https://cdn-learn.adafruit.com/assets/assets/000/124/076/medium640/3d_printing_5768-Feather-RP2040-PropMaker.jpg?1693235939)

# Talking D20 with RP2040 PropMaker Feather

## CircuitPython

[CircuitPython](https://github.com/adafruit/circuitpython) is a derivative of [MicroPython](https://micropython.org) designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the **CIRCUITPY** drive to iterate.

## CircuitPython Quickstart

Follow this step-by-step to quickly get CircuitPython running on your board.

[Download the latest version of CircuitPython for this board via circuitpython.org](https://circuitpython.org/board/adafruit_feather_rp2040_prop_maker/)
 **Click the link above to download the latest CircuitPython UF2 file.**

Save it wherever is convenient for you.

![install_circuitpython_on_rp2040_RP2040_UF2_downloaded.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/655/medium640/install_circuitpython_on_rp2040_RP2040_UF2_downloaded.jpg?1618943202)

![](https://cdn-learn.adafruit.com/assets/assets/000/121/865/medium800/adafruit_products_boot_reset.jpg?1686710555)

To enter the bootloader, hold down the **BOOT/**** BOOTSEL button**(highlighted in red above), and while continuing to hold it (don't let go!), press and release the**reset button**(highlighted in red or blue above).&nbsp;**Continue to hold the BOOT/BOOTSEL button until the RPI-RP2 drive appears!**

If the drive does not appear, release all the buttons, and then repeat the process above.

You can also start with your board unplugged from USB, press and hold the BOOTSEL button (highlighted in red above), continue to hold it while plugging it into USB, and wait for the drive to appear before releasing the button.

A lot of people end up using charge-only USB cables and it is very frustrating! **Make sure you have a USB cable you know is good for data sync.**

You will see a new disk drive appear called **RPI-RP2**.

&nbsp;

Drag the **adafruit\_circuitpython\_etc.uf2** file to **RPI-RP2.**

![install_circuitpython_on_rp2040_RP2040_bootloader_drive.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/656/medium640/install_circuitpython_on_rp2040_RP2040_bootloader_drive.jpg?1618943666)

![install_circuitpython_on_rp2040_RP2040_drag_UF2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/657/medium640/install_circuitpython_on_rp2040_RP2040_drag_UF2.jpg?1618943674)

The **RPI-RP2** drive will disappear and a new disk drive called **CIRCUITPY** will appear.

That's it, you're done! :)

![install_circuitpython_on_rp2040_RP2040_CIRCUITPY.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/658/medium640/install_circuitpython_on_rp2040_RP2040_CIRCUITPY.jpg?1618943864)

## Safe Mode

You want to edit your **code.py** or modify the files on your **CIRCUITPY** drive, but find that you can't. Perhaps your board has gotten into a state where **CIRCUITPY** is read-only. You may have turned off the **CIRCUITPY** drive altogether. Whatever the reason, safe mode can help.

Safe mode in CircuitPython does not run any user code on startup, and disables auto-reload. This means a few things. First, safe mode _bypasses any code in_ **boot.py** (where you can set **CIRCUITPY** read-only or turn it off completely). Second, _it does not run the code in_ **code.py**. And finally, _it does not automatically soft-reload when data is written to the_ **CIRCUITPY** _drive_.

Therefore, whatever you may have done to put your board in a non-interactive state, safe mode gives you the opportunity to correct it without losing all of the data on the **CIRCUITPY** drive.

### Entering Safe Mode
To enter safe mode when using CircuitPython, plug in your board or hit reset (highlighted in red above). Immediately after the board starts up or resets, it waits 1000ms. On some boards, the onboard status LED (highlighted in green above) will blink yellow during that time. If you press reset during that 1000ms, the board will start up in safe mode. It can be difficult to react to the yellow LED, so you may want to think of it simply as a slow double click of the reset button. (Remember, a fast double click of reset enters the bootloader.)

### In Safe Mode

If you successfully enter safe mode on CircuitPython, the LED will intermittently blink yellow three times.

If you connect to the serial console, you'll find the following message.

```terminal
Auto-reload is off.
Running in safe mode! Not running saved code.

CircuitPython is in safe mode because you pressed the reset button during boot. Press again to exit safe mode.

Press any key to enter the REPL. Use CTRL-D to reload.
```

You can now edit the contents of the **CIRCUITPY** drive. Remember, _your code will not run until you press the reset button, or unplug and plug in your board, to get out of safe mode._

## Flash Resetting UF2

If your board ever gets into a really _weird_ state and CIRCUITPY doesn't show up as a disk drive after installing CircuitPython, try loading this 'nuke' UF2 to RPI-RP2. which will do a 'deep clean' on your Flash Memory. **You will lose all the files on the board** , but at least you'll be able to revive it! After loading this UF2, follow the steps above to re-install CircuitPython.

[Download flash erasing "nuke" UF2](https://cdn-learn.adafruit.com/assets/assets/000/145/511/original/nuke_universal.uf2?1786537992)
# Talking D20 with RP2040 PropMaker Feather

## Code the D20

Once you've finished setting up your RP2040 Prop-Maker Feather with CircuitPython, you can access the code and necessary libraries by downloading the Project Bundle.

To do this, click on the **Download Project Bundle** button in the window below. It will download to your computer as a zipped folder.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Talking_D20/CircuitPython/code.py

## Upload the Code and Libraries to the RP2040 Prop-Maker Feather

After downloading the Project Bundle, plug your RP2040 Prop-Maker Feather into the computer's USB port with a known good USB data+power cable. You should see a new flash drive appear in the computer's File Explorer or Finder (depending on your operating system) called **CIRCUITPY**. Unzip the folder and copy the following items to the RP2040 Prop-Maker Feather's **CIRCUITPY** drive.

- **lib** folder
- **WAVs** folder
- **code.py**

Your RP2040 Prop-Maker Feather **CIRCUITPY** drive should look like this after copying the **lib** folder, **WAVs** folder and the **code.py** file. _Other files on the drive like_ **boot\_out.txt** _and_ **settings.toml** _can be ignored, they’re just part of how CircuitPython works._

![](https://cdn-learn.adafruit.com/assets/assets/000/124/125/medium800/3d_printing_d20-files.png?1693354428)

## OPTIONAL: Battery Monitoring

If you’ve added two 100K resistors as explained on the “Circuit Diagram” page, the die can monitor and announce when the battery is due for recharging. To enable, look for this line in the code (around line 67 or so):

```python
BATT_SENSE = None  # Assign analog pin if voltage divider present
```

Change this to reference an analog input pin where the resistors are connected. Our wiring diagram showed pin **A3** , so the change would be:

```python
BATT_SENSE = board.A3  # Assign analog pin if voltage divider present
```

## How the CircuitPython Code Works

Sensing a die roll is _hard._ The code uses a similar approach to the earlier [Arduino version of this project](https://learn.adafruit.com/talking-d20-20-sided-gaming-die): it watches for a _free-fall_ state, where readings from the accelerometer will all be near zero. You can see this in action in the `freefall_detect()` function.

**This means the die is triggered by dropping a few inches, or a light toss upward. Gently rolling off an inclined hand won’t suffice.**

Once a roll is detected, it then waits for the accelerometer to settle on a single face at around 1 G (9.8 meters/sec<sup>2</sup>). It then plays a WAV file to announce which face, and a little jab or praise for low or high values.

The code uses a classic **math trick** to speed things along so detection is more responsive. Getting the magnitude (length) of a vector (such as from an accelerometer) usually involves a **square root** …one of the **costlier mathematical operations** you could ask a microcontroller to do, especially one with no FPU:

magnitude = √(x<sup>2</sup> + y<sup>2</sup> + z<sup>2</sup>)

Since we’re just _comparing_ this magnitude to certain thresholds (\<0.3G for free-fall, and 0.9–1.1G for settling), _not_ using the actual value in further operations, we _eliminate the square root_ and instead _square the values we’re comparing against._

magnitude<sup>2</sup> = x<sup>2</sup> + y<sup>2</sup> + z<sup>2</sup>

Free-fall detect is looking for 0.3 G (2.94 m/s<sup>2</sup>) or less. To use the above trick, the square root operation is skipped and we instead compare against 2.94<sup>2</sup>, or about 8.65:

```python
FREEFALL_THRESHOLD = 8.65  # Near-freefall = 0.3G ^ 2
```

Similarly, that’s why the “around 1G detect” uses such large numbers, much more than the 9.8 ±10% one would expect. These are magnitudes _squared:_

```python
if 77.89 < mag < 116.35:  # ~1G
```

It’s probably not a _huge_ performance difference with the D20, but some day when you’re short on CPU cycles this trick might save your tail.

# Talking D20 with RP2040 PropMaker Feather

## Wiring

## Slide Switch Wire

Use the silicone ribbon cable to create a 2-pin cable. Measure and cut the wire to be 7.5cm in length.

![3d_printing_slide-switch-wires.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/618/medium640/3d_printing_slide-switch-wires.jpg?1692289051)

## Wiring Slide Switch

Cut one of the three pins on the slide switch, either the far left or right but not the middle. The, cut the two remaining pins to half their length.

Solder the 2-pin cable to the pins on the slide switch.

![3d_printing_slide-switch-wiring.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/619/medium640/3d_printing_slide-switch-wiring.jpg?1692289029)

## Connect Slide Switch

Get the slide switch ready to connect to the Feather.

![3d_printing_feather-switch.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/622/medium640/3d_printing_feather-switch.jpg?1692289094)

## Connected Slide Switch

The two wires are soldered to the pins on the bottom of the Feather.

Solder one wire to the ground pin (G) and the other to the enable pin (EN). It doesn't matter which wire goes to which pin.

![3d_printing_feather-switch-wiring.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/623/medium640/3d_printing_feather-switch-wiring.jpg?1692289149)

## Soldered Slide Switch

Double check the wires have been properly soldered to the pins on the RP2040 PropMaker Feather.

![3d_printing_feather-switch-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/625/medium640/3d_printing_feather-switch-wired.jpg?1692289214)

## Speaker Wires

Cut the cable from the speaker so the wires are 8cm in length.

Remove a bit of insulation from the two wires and tin them using a bit of solder.

Optionally save the 2-pin connector for another project.

![3d_printing_speaker-wire-setup.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/626/medium640/3d_printing_speaker-wire-setup.jpg?1692289237)

## Battery Monitoring (optional)

This die has the **optional 100K resistors** installed for **battery monitoring**. These can reach point-to-point across the board, using some heat-shrink tube to prevent making contact with other components as the die bounces about. One pin of the servo header is borrowed as a ground point.

![gaming_resistors-p2p.jpg](https://cdn-learn.adafruit.com/assets/assets/000/124/156/medium640/gaming_resistors-p2p.jpg?1693418228)

# Talking D20 with RP2040 PropMaker Feather

## Assembly

## Magnets

Gather up the eight neodymium magnets needed for the two halves.

![3d_printing_magnets.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/592/medium640/3d_printing_magnets.jpg?1692288640)

## Glueing Magnets

To permanently adhere the magnets, we suggest using Starbond's medium super glue.

Use the included fine precision micro tip to apply small drops of glue to the magnet cavities.

Carefully place the four magnets into the glue applied cavities of one half of the D20.

Allow the glue to fully set before proceeding to the second half.

![3d_printing_superglue.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/593/medium640/3d_printing_superglue.jpg?1692288653)

![3d_printing_magnets-half-glued.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/594/medium640/3d_printing_magnets-half-glued.jpg?1692288663)

## Glueing Magnets Continued

Once the glue has fully set, add the second set of magnets to the permanently bonded magnets.&nbsp; This ensures the polarities are matching.

Apply small drops of glue to the four cavities on the second half of the D20.

Carefully fit the second halve onto the magnets so the cavities are properly lined up.

Press the two halves together and let the glue dry.&nbsp;

![3d_printing_magnets-parts-glued.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/595/medium640/3d_printing_magnets-parts-glued.jpg?1692288674)

Danger: 

It’s _easiest_ to assemble the die with magnets all “north up” on one half, and “south up” on the opposite half…but that does create a situation where the die could close wrong.

If you’re _very patient_ and carefully label the polarity of your magnets, a better approach is to have one polarity facing up on the magnets near the 3, 4, 17 and 18 faces, and the opposite polarity on faces 2, 7, 14 and 19. The magnets will naturally resist improper closing when assembled this way.

![gaming_magnet-orientations.jpg](https://cdn-learn.adafruit.com/assets/assets/000/124/160/medium640/gaming_magnet-orientations.jpg?1693419420)

## Tap Standoffs

Use an M2.5 size screw tap to create the proper threads for the two standoffs.&nbsp;

![3d_printing_tap-standoffs.jpg](https://cdn-learn.adafruit.com/assets/assets/000/124/086/medium640/3d_printing_tap-standoffs.jpg?1693237695)

## Install Speaker

Once the glue has fully set on both halves, pull them apart.

Remove the sticker backing from the front of the speaker.

Orient the speaker with the half of the D20 with the oval shaped flat surface. Then, press the speaker onto the surface.&nbsp;

![3d_printing_speaker-installed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/597/medium640/3d_printing_speaker-installed.jpg?1692288686)

## Adding Counter Weights

To balance the two halves, we suggest using two US pennies as counterweights.

Place the two pennies into the cavity, they should have a loose fit.&nbsp;

![3d_printing_pennies-cap.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/598/medium640/3d_printing_pennies-cap.jpg?1692288723)

![3d_printing_pennies-installed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/599/medium640/3d_printing_pennies-installed.jpg?1692288737)

## Install Cap

Press the cap onto the counter weight cavity. It should have a tight tolerance.&nbsp;

Optionally glue the pennies in place for permanently bonded counter weights.&nbsp; &nbsp;

![3d_printing_cap-installed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/601/medium640/3d_printing_cap-installed.jpg?1692288753)

## Speaker Wires

Get the Feather ready to connect the speaker wires.

![3d_printing_feather-d20.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/602/medium640/3d_printing_feather-d20.jpg?1692288764)

## Install Speaker Wires

Insert the two wires from the speaker into the corresponding terminals on the Feather.

Use a screwdriver with a 2.5 sized flat head to secure the speaker wires.

![3d_printing_speaker-wires-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/603/medium640/3d_printing_speaker-wires-install.jpg?1692288790)

## Connect Battery

Get the 400mAh battery. Connect the cable from the battery to the 2-pin JST connector on the Feather.

If the Feather powers on, use the slide switch to turn it off.

![3d_printing_speaker-wires-installed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/605/medium640/3d_printing_speaker-wires-installed.jpg?1692288802)

## Secure Battery

The speaker features a second sticky side on surface of the magnet driver. Remove the protective cover by peeling it off.

Then, position the 400mAh battery and press it onto the sticky surface of the speaker.

![3d_printing_speaker-sticker-peel.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/607/medium640/3d_printing_speaker-sticker-peel.jpg?1692288832)

![3d_printing_battery-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/609/medium640/3d_printing_battery-install.jpg?1692288861)

## Install Switch

Position the slide switch with the built-in holder on the half of the D20.

Insert and press the slide switch in between the walls of the built-in switch holder.

![3d_printing_switch-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/606/medium640/3d_printing_switch-install.jpg?1692288814)

## Installing Feather

Orient the Feather with the D20 so the mounting holes line up with the built-in standoffs.

![3d_printing_feather-installing.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/610/medium640/3d_printing_feather-installing.jpg?1692288878)

## Secure Feather

Insert and fasten the two M2.5 x 6mm long screws to secure the Feather to the half of the D20.

![3d_printing_feather-secure.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/611/medium640/3d_printing_feather-secure.jpg?1692288907)

![3d_printing_feather-installed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/613/medium640/3d_printing_feather-installed.jpg?1692288926)

Danger: 

## Final Check

Take a moment to inspect the components are properly secured in place.

Use the slide switch to power on the Feather before joining the two halves together.

![3d_printing_final-halves-open.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/614/medium640/3d_printing_final-halves-open.jpg?1692288935)

## Closing Halves

The halves can only be joined one way.

Orient the two halves so the magnets are matching.

Slowly bring the two halves together and keep your fingers away from the edges.

![3d_printing_final-halves-closing.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/615/medium640/3d_printing_final-halves-closing.jpg?1692288940)

Danger: 

## Final Build

Congratulations on your build!

Go ahead and give it a roll. For best results, the accelerometer readings work better when it's free falling at least 6 inches (15cm) away from the surface.

![3d_printing_final-closed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/616/medium640/3d_printing_final-closed.jpg?1692288951)


## Guide Products

### Adafruit RP2040 Prop-Maker Feather with I2S Audio Amplifier

[Adafruit RP2040 Prop-Maker Feather with I2S Audio Amplifier](https://www.adafruit.com/product/5768)
The Adafruit Feather series gives you lots of options for a small, portable, rechargeable microcontroller board. By picking a feather and stacking on a FeatherWing you can create advanced projects quickly. One popular combo is our [Feather M4](https://www.adafruit.com/product/3857)...

In Stock
[Buy Now](https://www.adafruit.com/product/5768)
[Related Guides to the Product](https://learn.adafruit.com/products/5768/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...

Out of 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 Ideal For Feathers - 3.7V 400mAh

[Lithium Ion Polymer Battery Ideal For Feathers - 3.7V 400mAh](https://www.adafruit.com/product/3898)
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 **400mAh** for a total of about 1.9 Wh. If you need a larger (or smaller!)...

In Stock
[Buy Now](https://www.adafruit.com/product/3898)
[Related Guides to the Product](https://learn.adafruit.com/products/3898/guides)
### Breadboard-friendly SPDT Slide Switch

[Breadboard-friendly SPDT Slide Switch](https://www.adafruit.com/product/805)
These nice switches are perfect for use with breadboard and perfboard projects. They have 0.1" spacing and snap in nicely into a solderless breadboard. They're easy to switch no matter what size fingers you have, but not so easy that they'll get flipped by accident. Work great as...

In Stock
[Buy Now](https://www.adafruit.com/product/805)
[Related Guides to the Product](https://learn.adafruit.com/products/805/guides)
### USB Type A to Type C Cable - approx 1 meter / 3 ft long

[USB Type A to Type C Cable - approx 1 meter / 3 ft long](https://www.adafruit.com/product/4474)
As technology changes and adapts, so does Adafruit. This&nbsp;&nbsp; **USB Type A to Type C** cable will help you with the transition to USB C, even if you're still totin' around a USB Type A hub, computer or laptop.

USB C is the latest industry-standard connector for...

In Stock
[Buy Now](https://www.adafruit.com/product/4474)
[Related Guides to the Product](https://learn.adafruit.com/products/4474/guides)
### Through-Hole Resistors - 100K ohm 5% 1/4W - Pack of 25

[Through-Hole Resistors - 100K ohm 5% 1/4W - Pack of 25](https://www.adafruit.com/product/2787)
ΩMG! You're not going to be able to resist these handy resistor packs!&nbsp;Well, axially, they&nbsp;do all of the resisting for you!

This is a **25 Pack of 100K Ω Resistors.** More specifically, they are **carbon film** , through-hole...

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

## Related Guides

- [Adafruit RP2040 Prop-Maker Feather](https://learn.adafruit.com/adafruit-rp2040-prop-maker-feather.md)
- [PropMaker Jack O'Lantern](https://learn.adafruit.com/propmaker-jack-o-lantern.md)
- [PyPortal Winamp MP3 Player](https://learn.adafruit.com/pyportal-winamp-mp3-player.md)
- [MIT Green Building NeoPixel Tetris](https://learn.adafruit.com/tetris-building.md)
- [CLUE Step Counter](https://learn.adafruit.com/clue-step-counter-st-lsm6ds33.md)
- [Adafruit IO IOT Hub with the Adafruit FunHouse](https://learn.adafruit.com/adafruit-io-hub-with-the-adafruit-funhouse.md)
- [Garmin Lidar Lite Range Finder](https://learn.adafruit.com/garmin-lidar-lite-range-finder.md)
- [MCUME Emulators on Fruit Jam](https://learn.adafruit.com/mcume-emulators-on-fruit-jam.md)
- [CircuitPython USB VID/PID Reporter](https://learn.adafruit.com/circuitpython-usb-vid-pid-reporter.md)
- [LED Masquerade Masks with n00ds](https://learn.adafruit.com/led-masquerade-masks-with-n00ds.md)
- [Simple Vertical Wordclock](https://learn.adafruit.com/vertical-wordclock.md)
- [WiFi Jellyfish Lantern with WLED](https://learn.adafruit.com/wifi-jellyfish-lantern-with-wled.md)
- [Lego Neon NeoPixel Sign with CircuitPython](https://learn.adafruit.com/lego-neon-sign.md)
- [PyPortal Alarm Clock](https://learn.adafruit.com/pyportal-alarm-clock.md)
- [Doomscroll and Chill - A Wireless BLE Scroll Wheel Remote](https://learn.adafruit.com/doomscroll-and-chill-wireless-ble-scroll-wheel-rotary-encoder-remote.md)
- [Light Up Prop with Prop-Maker](https://learn.adafruit.com/prop-maker-light-wand.md)
