# Planetary Gear Dreidels

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/141/614/medium800thumb/3d_printing_withMenorah.jpg?1765466736 )

'Tis the season for festive displays, but Hanukkah doesn't always get the same kitschy, fun decor that other holidays do. In this project, you'll build a [planetary gear](https://en.wikipedia.org/wiki/Epicyclic_gearing) that rotates three dreidels using an STSPIN220 silent stepper motor driver and a KB2040 running CircuitPython. It's giving Stu Pickles chaotic menorah energy from [_A Rugrats Chanukah Special_](https://www.imdb.com/title/tt1159155/).

https://youtube.com/shorts/wQyD0XrkOZg

The 3D printed gears fit loosely on the gear carrier. This allows them to rotate smoothly.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/618/medium640/3d_printing_edited_P1480781.png?1765467297)

The enclosure and dreidels can take advantage of multicolor printing for the Hebrew characters.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/141/619/medium640/3d_printing_edited_P1480778.png?1765467836)

An MPM3610 buck converter makes it possible to power the entire project with a 12V power supply. The stepper motor needs 12V and then the MPM3610 is able to output 5V to power the KB2040 via its **RAW** pin.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/616/medium640/3d_printing_edited_P1480715.jpg?1765466899)

## Parts
Featured
### Adafruit KB2040 - RP2040 Kee Boar Driver

[Adafruit KB2040 - RP2040 Kee Boar Driver](https://www.adafruit.com/product/5302)
A wild Kee Boar appears! It’s a shiny **KB2040**! An Arduino Pro Micro-shaped board for Keebs with RP2040. (#keeblife 4 evah) A lot of folks like using Adafruit parts for their Keeb builds – but with the ItsyBitsy not being pin-compatible with the Pro Micro pinout, it...

In Stock
[Buy Now](https://www.adafruit.com/product/5302)
[Related Guides to the Product](https://learn.adafruit.com/products/5302/guides)
![Angled shot of short black microcontroller.](https://cdn-shop.adafruit.com/640x480/5302-07.jpg)

Featured
### Adafruit STSPIN220 Stepper Motor Driver Breakout Board

[Adafruit STSPIN220 Stepper Motor Driver Breakout Board](https://www.adafruit.com/product/6353)
Stepper motors are used for CNC machines, 3D printers, and whenever else one needs precise, powerful motion. But to get good behavior from steppers, you need a motor driver chip that can provide high bursts of current, and for smooth motion, be able to PWM that current for microstepping...

In Stock
[Buy Now](https://www.adafruit.com/product/6353)
[Related Guides to the Product](https://learn.adafruit.com/products/6353/guides)
![Video of a motor stepper driver board driving a stepper motor connected to a microcontroller.](https://cdn-shop.adafruit.com/product-videos/640x480/6353-05.jpg)

Featured
### MPM3610 5V Buck Converter Breakout - 21V In 5V Out at 1.2A

[MPM3610 5V Buck Converter Breakout - 21V In 5V Out at 1.2A](https://www.adafruit.com/product/4739)
This little buck converter based on the MPM3610 is a marvel, taking up to 21V input and providing a 5V output with up to 1.2A current. It's great for supplying power to popular 5V voltage circuits from a range of battery or power options. &nbsp;This chip provides up to 1.2 Amp load current...

In Stock
[Buy Now](https://www.adafruit.com/product/4739)
[Related Guides to the Product](https://learn.adafruit.com/products/4739/guides)
![MPM3610 5V Buck Converter Breakout Board](https://cdn-shop.adafruit.com/640x480/4739-04.jpg)

Featured
### Stepper motor - NEMA-17 size - 200 steps/rev, 12V 350mA

[Stepper motor - NEMA-17 size - 200 steps/rev, 12V 350mA](https://www.adafruit.com/product/324)
A stepper motor to satisfy all your robotics needs! This 4-wire bipolar stepper has 1.8° per step for smooth motion and a nice holding torque. The motor was specified to have a max current of 350mA so that it could be driven easily with an <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/324)
[Related Guides to the Product](https://learn.adafruit.com/products/324/guides)
![Angled shot of a Stepper motor - NEMA-17.](https://cdn-shop.adafruit.com/640x480/324-03.jpg)

Featured
### Panel Mount 2.1mm DC barrel jack

[Panel Mount 2.1mm DC barrel jack](https://www.adafruit.com/product/610)
This power jack is designed to easily attach to a panel up to 8mm thick (0.315" or 5/16") and fit 2.1mm power plugs snugly and securely. Perfect for adding a power connector to your project enclosure. We like this jack in particular for its long body (so you can use it on thicker...

Out of Stock
[Buy Now](https://www.adafruit.com/product/610)
[Related Guides to the Product](https://learn.adafruit.com/products/610/guides)
![Angled Front Shot of the Panel Mount 2.1mm DC barrel jack.](https://cdn-shop.adafruit.com/640x480/610-08.jpg)

Featured
### 12V 5A switching power supply

[12V 5A switching power supply](https://www.adafruit.com/product/352)
This is a beefy switching supply, for when you need a lot of power! It can supply 12V DC up to 5 Amps, running from 110V or 220V power (the plug it comes with is for US/Canada/Japan but you can use any plug adapter for your country, or just replace the cable with a standard 'figure-8'...

In Stock
[Buy Now](https://www.adafruit.com/product/352)
[Related Guides to the Product](https://learn.adafruit.com/products/352/guides)
![Power brick with coiled cables.](https://cdn-shop.adafruit.com/640x480/352-07.jpg)

### Silicone Cover Stranded-Core Wire - 30AWG in Various Colors

[Silicone Cover Stranded-Core Wire - 30AWG in Various Colors](https://www.adafruit.com/product/2051)
Silicone-sheathing wire is super-flexible and soft, and its also strong! Able to handle up to 200°C and up to 600V, it will do when PVC covered wire wimps out. We like this wire for being extremely supple and flexible, so it is great for wearables or projects where the wire-harness has to...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2051)
[Related Guides to the Product](https://learn.adafruit.com/products/2051/guides)
![Silicone Cover Stranded-Core Wire - 30AWG in Various Colors laid out beside each other. ](https://cdn-shop.adafruit.com/640x480/2051-01.jpg)

### JST PH 2-Pin Cable - Female Connector 100mm

[JST PH 2-Pin Cable - Female Connector 100mm](https://www.adafruit.com/product/261)
Red and black tinned wires with a 2-pin JST PH connector on the end. 4" / 100mm long. Matches up nicely with our Lipoly chargers!

[We have the socket 'mating' version of this cable](https://www.adafruit.com/product/3814) over here, <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/261)
[Related Guides to the Product](https://learn.adafruit.com/products/261/guides)
![Top view shot of a red and black JST PH 2-Pin Cable to Female Connector - 100mm.](https://cdn-shop.adafruit.com/640x480/261-01.jpg)

### JST PH 2-Pin Cable – Male Header 200mm

[JST PH 2-Pin Cable – Male Header 200mm](https://www.adafruit.com/product/3814)
For a really long time we assumed that the JST PH didn't have a free-hanging male header version. But then we found this **JST-PH 2-pin Male Cable,** and we were like,&nbsp;_this is perfect!_ It's not a genuine JST connector, but it's 100%...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3814)
[Related Guides to the Product](https://learn.adafruit.com/products/3814/guides)
![Top view shot of JST PH 2-Pin Cable - Male Header - 200mm.](https://cdn-shop.adafruit.com/640x480/3814-02.jpg)

### Black Nylon Machine Screw and Stand-off Set – M2.5 Thread

[Black Nylon Machine Screw and Stand-off Set – M2.5 Thread](https://www.adafruit.com/product/3299)
Totaling 380 pieces, this **M2.5 Screw Set** &nbsp;is a must-have for your workstation.&nbsp;You'll have enough screws, nuts, and hex standoffs to fuel your maker tendencies&nbsp;for days on end! M2.5 size screws fit almost all of the Adafruit breakout/dev board mounting holes...

In Stock
[Buy Now](https://www.adafruit.com/product/3299)
[Related Guides to the Product](https://learn.adafruit.com/products/3299/guides)
![Black Nylon Screw and Stand-off Set with M2.5 Threads, kit box](https://cdn-shop.adafruit.com/640x480/3299-00.jpg)

### Black Nylon Machine Screw and Stand-off Set – M3 Thread

[Black Nylon Machine Screw and Stand-off Set – M3 Thread](https://www.adafruit.com/product/4685)
Totaling **420 pieces** , this **M3 Screw Set** &nbsp;is a must-have for your workstation.&nbsp;You'll have enough screws, nuts, and hex standoffs to fuel your maker tendencies&nbsp;for days on end! M3 size screws fit a number of&nbsp;Adafruit breakout/dev board...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4685)
[Related Guides to the Product](https://learn.adafruit.com/products/4685/guides)
![Opened box showing many nylon screws](https://cdn-shop.adafruit.com/640x480/4685-01.jpg)

### Multi-Colored Heat Shrink Pack - 3/32" + 1/8" + 3/16" Diameters

[Multi-Colored Heat Shrink Pack - 3/32" + 1/8" + 3/16" Diameters](https://www.adafruit.com/product/1649)
Heat shrink is the duct tape of electronics which I guess makes this heat shrink the colorful and exciting duct tape they sell&nbsp;at craft stores. &nbsp;This heat shrink comes in six different colors - red, blue, green, yellow, white and the traditional black.

Each pack contains ten...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1649)
[Related Guides to the Product](https://learn.adafruit.com/products/1649/guides)
![Array of many colorful heatshrink tubes.](https://cdn-shop.adafruit.com/640x480/1649-00.jpg)

# Planetary Gear Dreidels

## Circuit Diagram

![](https://cdn-learn.adafruit.com/assets/assets/000/141/503/medium800/3d_printing_spinningDreidelsFritzRevB_bb.png?1764953468 )

An MPM3610 buck converter lets you power the entire project with a 12V DC power supply. It converts the 12V down to 5V to power the KB2040 through the **RAW** pin.

### Power

- **DC power positive** to **MPM3610 Vin (red wire)**
- **DC power ground** to **MPM3610 GND (black wire)**
- **DC power positive** to **STSPIN220 + terminal block (red wire)**
- **DC power ground** to **STSPIN220 - terminal block (black wire)**
- **MPM3610 5V** to **KB2040 RAW (orange wire)**
- **MPM3610 GND** to **KB2040 G (black wire)**

### STSPIN220 Wiring

- **KB2040 3V** to **STSPIN220 VDD (red wire)**
- **KB2040 GND** to **STSPIN220 GND (black wire)**
- **KB2040 D2** to **STSPIN220 DIR (blue wire)**
- **KB2040 D3** to **STSPIN220 STEP (green wire)**
- **KB2040 D4** to **STSPIN220 MS1 (yellow wire)**
- **KB2040 D5** to **STSPIN220 MS2 (white wire)**
- **KB2040 D6** to **STSPIN220 EN (cyan wire)**
- **KB2040 D7** to **STSPIN220 RST (pink wire)**

### Stepper Motor

- **STSPIN220 1A** to **stepper motor coil A+ (green wire)**
- **STSPIN220 2A** to **stepper motor coil A- (grey wire)**
- **STSPIN220 1B** to **stepper motor coil B+ (yellow wire)**
- **STSPIN220 2B** to **stepper motor coil B- (red wire)**

# Planetary Gear Dreidels

## 3D Printing

![](https://cdn-learn.adafruit.com/assets/assets/000/141/544/medium800/3d_printing_edited_P1480654.jpg?1765229030 )

You can 3D print all of the parts for this project. Here is a list to help you keep track:

- Main enclosure - 1x
- Bottom lid - 1x
- Sun gear - 1x
- Planet gears - 3x
- Dreidels - 3x
- Gear carrier - 1x
- Stepper motor mount - 1x
- Electronics mount - 1x
- Disk cover - 1x

The files can be downloaded directly below or from Printables. The files are available as .STL files or compiled .3MF files that include multicolor info, multiple copies of the model if needed and printing settings.

[Printables Download](https://www.printables.com/model/1511903-planetary-gear-dreidels)
[CAD Files Direct Download](https://cdn-learn.adafruit.com/assets/assets/000/141/610/original/planetaryDreidelsCADfiles.zip?1765464659)
The source file is also available as both a Fusion360 project file and .STEP file.

[Source Files Download](https://cdn-learn.adafruit.com/assets/assets/000/141/611/original/planetaryDreidelsSourceFiles.zip?1765464671)
The Hebrew letters on the dreidels and enclosure can be printed with a contrasting color for printers that can do multicolor printing. They are designed with a 45° chamfer around the edges so that they print cleanly.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/585/medium640thumb/3d_printing_dreidelsPrinting.jpg?1765314779)

## Modeling Gears

Modeling gears can be tricky. I followed along with this [YouTube video](https://www.youtube.com/watch?v=W-tIlhVpZpw) to get the gear system in place. It goes into great detail on the math you use to create these gear systems.

https://www.youtube.com/watch?v=W-tIlhVpZpw

# Planetary Gear Dreidels

## Install 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_kb2040/)
 **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/108/852/medium800/adafruit_products_KeeBoar_boot_reset.jpg?1644515196)

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)
# Planetary Gear Dreidels

## Code the Dreidels

![](https://cdn-learn.adafruit.com/assets/assets/000/141/620/medium800/3d_printing_edited_P1480775.png?1765468087 )

Once you've finished setting up your KB2040 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/Planetary_Gear_Dreidels/code.py

## Upload the Code and Libraries to the KB2040

After downloading the Project Bundle, plug your KB2040 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 KB2040's **CIRCUITPY** drive.

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

Your KB2040 **CIRCUITPY** drive should look like this after copying the **lib** folder and the **code.py** file.

![CIRCUITPY drive](https://adafruit.github.io/Adafruit_Learning_System_Guides/Planetary_Gear_Dreidels.png )

## How the CircuitPython Code Works

The code begins by assigning variable names to the GPIO pins used with the STSPIN220.

```python
DIR_PIN = board.D2  # DIRection pin
STEP_PIN = board.D3  # STEP pin
MODE1_PIN = board.D4  # Mode 1 pin (REQUIRED for mode switching)
MODE2_PIN = board.D5  # Mode 2 pin (REQUIRED for mode switching)
EN_FAULT_PIN = board.D6  # Enable/Fault pin (optional)
STBY_RESET_PIN = board.D7  # Standby/Reset pin (REQUIRED for mode switching)
```

These pins are passed to the STSPIN initializer.

```python
print("Initializing STSPIN220...")
motor = adafruit_stspin.STSPIN(
    STEP_PIN,
    DIR_PIN,
    STEPS_PER_REVOLUTION,
    mode1_pin=MODE1_PIN,
    mode2_pin=MODE2_PIN,
    en_fault_pin=EN_FAULT_PIN,
    stby_reset_pin=STBY_RESET_PIN,
)
```

Before the loop, a few parameters are setup for motor speed, microstep mode and steps per revolution.

```python
STEPS_PER_REVOLUTION = 200
motor.speed = 60
motor.step_mode = adafruit_stspin.Modes.STEP_1_128
```

In the loop, the motor is stepped continuously to rotate the gear mechanism.

```python
while True:
    # continuously step the motor
    total_microsteps = STEPS_PER_REVOLUTION * motor.microsteps_per_step
    motor.step(total_microsteps)
```

# Planetary Gear Dreidels

## Wiring

![](https://cdn-learn.adafruit.com/assets/assets/000/141/545/medium800/3d_printing_edited_P1480641.jpg?1765229042 )

## DC Jack
Solder the black wire from the JST-PH plug connector to the **ground terminal** on the DC jack. Solder the red wire from the JST-PH plug connector to the **voltage terminal** on the DC jack. Cover the connections with heat shrink.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/578/medium640/3d_printing_edited_P1480662.jpg?1765312463)

## MPM3610 Wiring
Solder the red wire from the JST-PH socket connector to **Vin**. Solder the black wire from the JST-PH socket connector to **GND**.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/574/medium640/3d_printing_edited_P1480657.jpg?1765312186)

Solder a second red wire to **Vin**. This wire will power the stepper motor via the terminal block on the STSPIN220 breakout.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/575/medium640/3d_printing_edited_P1480664.jpg?1765312295)

Solder two additional black wires to **GND**. One will connect to the STSPIN220 **GND** terminal block and the other will connect to the KB2040 **GND**.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/576/medium640/3d_printing_edited_P1480665.jpg?1765312404)

Cover these solder joints with heat shrink.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/577/medium640/3d_printing_edited_P1480671.jpg?1765312418)

Solder one of the **GND** wires from the MPM3610 to **GND** on the STSPIN220.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/579/medium640/3d_printing_edited_P1480675.jpg?1765312614)

Solder a wire from **5V** on the MPM3610 to **RAW** on the KB2040.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/580/medium640/3d_printing_edited_P1480677.jpg?1765312678)

## STSPIN220 and KB2040
Solder a wire from **GND** on the STSPIN220 to **GND** on the KB2040 (black wire).

Solder a wire from **3V** on the KB2040 to **VDD** on the STSPIN220 (red wire).

![](https://cdn-learn.adafruit.com/assets/assets/000/141/581/medium640/3d_printing_edited_P1480685.jpg?1765313046)

Solder wires to **DIR (blue wire)**, **STEP (green wire)**, **MS1 (yellow wire)**, **MS2 (white wire)**, **EN (green wire)** and **RST (blue wire)** on the STSPIN220. To keep the wire organized, you may want to use a piece of larger heat shrink.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/582/medium640/3d_printing_edited_P1480690.jpg?1765313118)

Connect the STSPIN220 pins to the KB2040:

- **DIR** to **D2 (blue wire)**
- **STEP** to **D3 (green wire)**
- **MS1** to **D4 (yellow wire)**
- **MS2** to **D5 (white wire)**
- **EN** to **D6 (green wire)**
- **RST** to **D7 (blue wire)**

![](https://cdn-learn.adafruit.com/assets/assets/000/141/583/medium640/3d_printing_edited_P1480694.jpg?1765313226)

That completes all of the wiring.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/586/medium800/3d_printing_edited_P1480696.jpg?1765317869 )

# Planetary Gear Dreidels

## Assembly

![](https://cdn-learn.adafruit.com/assets/assets/000/141/594/medium800/3d_printing_edited_P1480704.jpg?1765463046 )

## Electronics
Carefully flex the KB2040 mount to secure the KB2040. Attach the MPM3610 to the outer mounting hole with an M2.5 screw. Attach the STSPIN220 to the mount with M2.5 screws.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/595/medium640/3d_printing_edited_P1480715.jpg?1765463062)

Connect **GND** from the MPM3610 to the **- terminal block** on the STSPIN220 (black wire). Connect **Vin** from the MPM3610 to the **+ terminal block** on the STSPIN220 (red wire).

![](https://cdn-learn.adafruit.com/assets/assets/000/141/596/medium640/3d_printing_edited_P1480720.jpg?1765463139)

Connect the stepper motor wires to the terminal block on the STSPIN220:

- **Stepper coil 1 positive** to **STSPIN220 1A (green wire)**
- **Stepper coil 1 negative** to **STSPIN220 2A (grey wire)**
- **Stepper coil 2 positive** to **STSPIN220 1B (yellow wire)**
- **Stepper coil 2 negative** to **STSPIN220 2B (red wire)**

![](https://cdn-learn.adafruit.com/assets/assets/000/141/597/medium640/3d_printing_edited_P1480729.jpg?1765463209)

## Stepper Motor Mount
Place the stepper motor mount over the stepper motor, lining up the top mounting holes. Place the electronics mount on top of the stepper mount. The electronics should be facing downwards.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/598/medium640/3d_printing_edited_P1480733.jpg?1765463330)

Secure the cover disk over the mounts with four M3 screws so that all of the pieces are attached to the stepper motor.

Now is a good time to install CircuitPython on the KB2040 and upload the Project Bundle to the board, if you have not previously done so.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/599/medium640/3d_printing_edited_P1480737.jpg?1765463435)

![](https://cdn-learn.adafruit.com/assets/assets/000/141/600/medium640/3d_printing_edited_P1480739.jpg?1765463497)

Yellow: You'll want to upload the code to the KB2040 before completing the assembly.

## Power
Insert the DC jack in the mounting hole in the main enclosure.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/601/medium640/3d_printing_edited_P1480705.jpg?1765463511)

Insert the enclosure into the bottom lid.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/141/602/medium640/3d_printing_edited_P1480744.jpg?1765463548)

Plug the DC jack JST-PH connector into the MPM3610 JST-PH connector. This connects the power supply to **Vin** and **GND**.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/603/medium640/3d_printing_edited_P1480746.jpg?1765463576)

## Bringing It All Together
Take the stepper motor assembly and put it inside the enclosure. Secure the motor mount to the bottom lid with four M3 screws.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/604/medium640/3d_printing_edited_P1480752.jpg?1765463628)

![](https://cdn-learn.adafruit.com/assets/assets/000/141/605/medium640/3d_printing_edited_P1480755.jpg?1765463635)

Attach the gear carrier onto the stepper motor shaft.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/606/medium640/3d_printing_edited_P1480757.jpg?1765463675)

Place the three planet gears on the outer pegs on the carrier.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/141/607/medium640/3d_printing_edited_P1480762.jpg?1765463704)

Place the center sun gear on the center peg on the carrier.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/608/medium640/3d_printing_edited_P1480763.jpg?1765463736)

Place the dreidels onto the mounts on each of the three planet gears. That completes the assembly!

![](https://cdn-learn.adafruit.com/assets/assets/000/141/609/medium640/3d_printing_edited_P1480768.jpg?1765463764)

# Planetary Gear Dreidels

## Dreidel Dreidel Dreidel

![](https://cdn-learn.adafruit.com/assets/assets/000/141/617/medium800thumb/3d_printing_heroGif.jpg?1765466964 )

After assembly, plug in a 12V power supply to the DC jack. You'll see the gears start to spin. The planetary gear mechanism has two motions occurring at the same time. The outer planet gears are rotating while revolving around the center sun gear.

The gear carrier helps to create an illusion that the gears are floating inside the enclosure.

![](https://cdn-learn.adafruit.com/assets/assets/000/141/612/medium640thumb/3d_printing_topViewDreidels.jpg?1765466172)

https://youtube.com/shorts/wQyD0XrkOZg


## Guide Products

### Adafruit KB2040 - RP2040 Kee Boar Driver

[Adafruit KB2040 - RP2040 Kee Boar Driver](https://www.adafruit.com/product/5302)
A wild Kee Boar appears! It’s a shiny **KB2040**! An Arduino Pro Micro-shaped board for Keebs with RP2040. (#keeblife 4 evah) A lot of folks like using Adafruit parts for their Keeb builds – but with the ItsyBitsy not being pin-compatible with the Pro Micro pinout, it...

In Stock
[Buy Now](https://www.adafruit.com/product/5302)
[Related Guides to the Product](https://learn.adafruit.com/products/5302/guides)
### Adafruit STSPIN220 Stepper Motor Driver Breakout Board

[Adafruit STSPIN220 Stepper Motor Driver Breakout Board](https://www.adafruit.com/product/6353)
Stepper motors are used for CNC machines, 3D printers, and whenever else one needs precise, powerful motion. But to get good behavior from steppers, you need a motor driver chip that can provide high bursts of current, and for smooth motion, be able to PWM that current for microstepping...

In Stock
[Buy Now](https://www.adafruit.com/product/6353)
[Related Guides to the Product](https://learn.adafruit.com/products/6353/guides)
### MPM3610 5V Buck Converter Breakout - 21V In 5V Out at 1.2A

[MPM3610 5V Buck Converter Breakout - 21V In 5V Out at 1.2A](https://www.adafruit.com/product/4739)
This little buck converter based on the MPM3610 is a marvel, taking up to 21V input and providing a 5V output with up to 1.2A current. It's great for supplying power to popular 5V voltage circuits from a range of battery or power options. &nbsp;This chip provides up to 1.2 Amp load current...

In Stock
[Buy Now](https://www.adafruit.com/product/4739)
[Related Guides to the Product](https://learn.adafruit.com/products/4739/guides)
### Stepper motor - NEMA-17 size - 200 steps/rev, 12V 350mA

[Stepper motor - NEMA-17 size - 200 steps/rev, 12V 350mA](https://www.adafruit.com/product/324)
A stepper motor to satisfy all your robotics needs! This 4-wire bipolar stepper has 1.8° per step for smooth motion and a nice holding torque. The motor was specified to have a max current of 350mA so that it could be driven easily with an <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/324)
[Related Guides to the Product](https://learn.adafruit.com/products/324/guides)
### Panel Mount 2.1mm DC barrel jack

[Panel Mount 2.1mm DC barrel jack](https://www.adafruit.com/product/610)
This power jack is designed to easily attach to a panel up to 8mm thick (0.315" or 5/16") and fit 2.1mm power plugs snugly and securely. Perfect for adding a power connector to your project enclosure. We like this jack in particular for its long body (so you can use it on thicker...

Out of Stock
[Buy Now](https://www.adafruit.com/product/610)
[Related Guides to the Product](https://learn.adafruit.com/products/610/guides)
### 12V 5A switching power supply

[12V 5A switching power supply](https://www.adafruit.com/product/352)
This is a beefy switching supply, for when you need a lot of power! It can supply 12V DC up to 5 Amps, running from 110V or 220V power (the plug it comes with is for US/Canada/Japan but you can use any plug adapter for your country, or just replace the cable with a standard 'figure-8'...

In Stock
[Buy Now](https://www.adafruit.com/product/352)
[Related Guides to the Product](https://learn.adafruit.com/products/352/guides)
### Silicone Cover Stranded-Core Wire - 30AWG in Various Colors

[Silicone Cover Stranded-Core Wire - 30AWG in Various Colors](https://www.adafruit.com/product/2051)
Silicone-sheathing wire is super-flexible and soft, and its also strong! Able to handle up to 200°C and up to 600V, it will do when PVC covered wire wimps out. We like this wire for being extremely supple and flexible, so it is great for wearables or projects where the wire-harness has to...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2051)
[Related Guides to the Product](https://learn.adafruit.com/products/2051/guides)
### JST PH 2-Pin Cable - Female Connector 100mm

[JST PH 2-Pin Cable - Female Connector 100mm](https://www.adafruit.com/product/261)
Red and black tinned wires with a 2-pin JST PH connector on the end. 4" / 100mm long. Matches up nicely with our Lipoly chargers!

[We have the socket 'mating' version of this cable](https://www.adafruit.com/product/3814) over here, <a...></a...>

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

## Related Guides

- [Adafruit KB2040](https://learn.adafruit.com/adafruit-kb2040.md)
- [Adafruit STSPIN220 Stepper Motor Driver Breakout Board](https://learn.adafruit.com/adafruit-stspin220-stepper-motor-driver-breakout-board.md)
- [Rumi Sword - KPop Demon Hunters](https://learn.adafruit.com/rumi-sword.md)
- [3D Print Ratcatcher 2 Controller Device](https://learn.adafruit.com/3d-print-ratcatcher-2-controller-device-wand.md)
- [Circuit Playground Express Compass](https://learn.adafruit.com/circuit-playground-express-compass.md)
- [LED Matrix FIFA World Cup Scoreboard](https://learn.adafruit.com/led-matrix-fifa-world-cup-scoreboard.md)
- [PyPortal Alarm Clock](https://learn.adafruit.com/pyportal-alarm-clock.md)
- [CircuitPython OctoPrint Controller and Monitor](https://learn.adafruit.com/circuitpython-octoprint-controller-and-monitor.md)
- [Animatronic Cosplay Wings](https://learn.adafruit.com/animatronic-cosplay-wings.md)
- [LED Trampoline](https://learn.adafruit.com/led-trampoline.md)
- [USB MIDI Host Messenger](https://learn.adafruit.com/usb-midi-host-messenger.md)
- [Motorized Camera Slider 2-Axis](https://learn.adafruit.com/motorized-camera-slider-2-axis.md)
- [PyPortal Weather Station](https://learn.adafruit.com/pyportal-weather-station.md)
- [USB MIDI Keyset Controller](https://learn.adafruit.com/midi-keyset.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)
- [NeoPixel Star Crown with WLED](https://learn.adafruit.com/neopixel-star-crown-with-wled.md)
- [Cyber Cat MIDI Keyboard](https://learn.adafruit.com/midi-cyber-cat-keyboard.md)
