# CNC Rotary Macropad

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/131/617/medium800/3d_printing_fianl-build-alt.jpg?1722266923)

https://youtu.be/UmJdvE2cYZE

## CNC MacroPad

You can build a dedicated macropad for controlling your 3D printing slicing software with snap-part NeoKey switches, a CNC rotary encoder and the Feather RP2040 running CircuitPython.

![3d_printing_hero-keypress.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/635/medium640/3d_printing_hero-keypress.jpg?1722353150)

## Glowing Hotkeys

Each key is assigned to a shortcut for the popular Ultimaker CURA slicing software. The large (and heavy) rotary encoder can rotate around your model and even zoom in/out!

![3d_printing_hero-cura-hotkeys.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/636/medium640/3d_printing_hero-cura-hotkeys.jpg?1722353254)

## Dynamic Rotary Encoder

The CNC rotary encoder can switch between three different modes. The lower three key switches can toggle between each mode. This makes the rotary encoder much more versatile allowing you to quickly switch between keyboard arrow keys and the mouse scroll wheel.

![3d_printing_demo-cura-XYZ-2.gif](https://cdn-learn.adafruit.com/assets/assets/000/131/621/medium640thumb/3d_printing_demo-cura-XYZ-2.jpg?1722273095)

## Customizable Macropad

The CircuitPython code allows for easily customization. Change the keyboard shortcuts to control any number of software such as CAD, graphics and video editing applications.

![3d_printing_hero-landscape.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/637/medium640/3d_printing_hero-landscape.jpg?1722353735)

## Parts
### NeoKey 5x6 Ortho Snap-Apart Mechanical Key Switches w/ NeoPixel

[NeoKey 5x6 Ortho Snap-Apart Mechanical Key Switches w/ NeoPixel](https://www.adafruit.com/product/5157)
For folks who want ready-to-go keeb action, we've got the lovely [Adafruit Macropad with a 3x4 grid of MX+NeoPixel key switches](https://www.adafruit.com/product/5100) - but for those who like to forge their own path, we now present the easiest way of creating custom ortholinear...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5157)
[Related Guides to the Product](https://learn.adafruit.com/products/5157/guides)
![Top view video of a Black woman's hands pressing the key switches on to emit rainbow colors from the NeoPixels.](https://cdn-shop.adafruit.com/product-videos/640x480/5157-03.jpg)

### Adafruit Feather RP2040

[Adafruit Feather RP2040](https://www.adafruit.com/product/4884)
A new chip means a new Feather, and the Raspberry Pi RP2040 is no exception. When we saw this chip we thought "this chip is going to be awesome when we give it the Feather Treatment" and so we did! This Feather features the&nbsp; **RP2040** , and all niceties you know and...

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

### CNC Rotary Encoder - 100 Pulses per Rotation - 60mm Silver

[CNC Rotary Encoder - 100 Pulses per Rotation - 60mm Silver](https://www.adafruit.com/product/5735)
We have various [PCB-mount rotary encoders in the shop](https://www.adafruit.com/search?q=rotary+encoder), great for making interfaces where you may want to spin a knob around to select a value.&nbsp;These large knobs are also encoders, but very large - like hand-sized! They're...

In Stock
[Buy Now](https://www.adafruit.com/product/5735)
[Related Guides to the Product](https://learn.adafruit.com/products/5735/guides)
![Hand rotating the rotary clockwise in a fast then slow motion. ](https://cdn-shop.adafruit.com/product-videos/640x480/5735-04.jpg)

### Kailh Mechanical Key Switches - Linear Black - 12 pack

[Kailh Mechanical Key Switches - Linear Black - 12 pack](https://www.adafruit.com/product/5876)
For crafting your very own custom keyboard, these **&nbsp;Kailh Black&nbsp;Linear mechanical key switches** &nbsp;are deeee-luxe! With smooth actuation and Cherry MX compatibility, they're lovely when you want a&nbsp; **smooth linear&nbsp;** keystroke with...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5876)
[Related Guides to the Product](https://learn.adafruit.com/products/5876/guides)
![Angled shot of twelve black Kailh key switches.](https://cdn-shop.adafruit.com/640x480/5876-00.jpg)

### Clear Keycaps for MX Compatible Switches - 12-pack

[Clear Keycaps for MX Compatible Switches - 12-pack](https://www.adafruit.com/product/5068)
Here is a **12&nbsp;pack** of Clear DSA keycaps for your next mechanical keyboard or&nbsp;[NeoKey](https://www.adafruit.com/?q=neokey&sort=BestMatch)&nbsp;project. Snap 'em onto any&nbsp; **Cherry MX or compatible switch&nbsp;** to turn your&nbsp;<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/5068)
[Related Guides to the Product](https://learn.adafruit.com/products/5068/guides)
![Group shot of Clear DSA Keycaps for MX Compatible Switches - 12 pack](https://cdn-shop.adafruit.com/640x480/5068-04.jpg)

### Part: Red Wire
quantity: 1
Silicone Cover Stranded-Core Wire - 50ft 30AWG Red
[Red Wire](https://www.adafruit.com/product/3165)

### Part: Blue Wire
quantity: 1
Silicone Cover Stranded-Core Wire - 50ft 30AWG Blue
[Blue Wire](https://www.adafruit.com/product/3166)

### Part: Black Wire
quantity: 1
Silicone Cover Stranded-Core Wire - 50ft 30AWG Black
[Black Wire](https://www.adafruit.com/product/3164)

### Part: Yellow Wire
quantity: 1
Silicone Cover Stranded-Core Wire - 50ft 30AWG Yellow
[Yellow Wire](https://www.adafruit.com/product/3167)

### Part: Green Wire
quantity: 1
Silicone Cover Stranded-Core Wire - 50ft 30AWG Green
[Green Wire](https://www.adafruit.com/product/3168)

### Part: White Wire
quantity: 1
Silicone Cover Stranded-Core Wire - 50ft 30AWG White
[White Wire](https://www.adafruit.com/product/3169)

### Part: Rubber Feet
quantity: 1
Little Rubber Bumper Feet - Pack of 4
[Rubber Feet](https://www.adafruit.com/product/550)

### Part: Prying Tool
quantity: 1
Spudger - Double Sided Prying Tool
[Prying Tool](https://www.adafruit.com/product/3434)

### Part: Pink and Purple Woven USB A to USB C Cable
quantity: 1
1 meter long
[Pink and Purple Woven USB A to USB C Cable](https://www.adafruit.com/product/5153)

## Hardware

- 4x M2.5 x 6mm long steel machine screws (NeoKey PCB mount)
- 4x M2.5 x 6mm long steel machine screws (Feather RP2040)

# CNC Rotary Macropad

## 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 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/131/615/medium800/3d_printing_Circuit-Diagram-V5.jpg?1722266000)

## Wired Connections

**CNC Rotary Encoder**

- **GND** from rotary encoder to **GND** pin&nbsp;on **Feather**
- **VCC** from rotary encoder to **3V** pin on **Feather**
- **A** from rotary encoder to **A3** on **Feather**
- **B** from rotary encoder to **A4** on **Feather**

**3x4 NeoKey Snap Keypad**

- **NeoKey Snap COL 1 to A0 pin on Feather**
- **NeoKey Snap COL 2 to A1 pin on Feather**
- **NeoKey Snap COL 3 to A2 pin on Feather**
- **NeoKey Snap ROW 1 to D12 on Feather**
- **NeoKey Snap ROW 2 to D11 on Feather**
- **NeoKey Snap ROW 3 to D10 on Feather**
- **NeoKey Snap ROW 4 to D9 on Feather**
- **NeoKey Snap IN (I) top left to D5 on Feather**
- **NeoKey Snap GND to GND on Feather**
- **NeoKey Snap VIN to 3V on Feather**

**5V USB Power**

The Feather is powered by 5V USB plugged into a computer.

# CNC Rotary Macropad

## 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_3d-parts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/612/medium640/3d_printing_3d-parts.jpg?1722263012)

[Download STLs.zip](https://cdn-learn.adafruit.com/assets/assets/000/131/638/original/STLs.zip?1722359769)
[Download CAD source](https://cdn-learn.adafruit.com/assets/assets/000/131/619/original/CAD.zip?1722267752)
## Build Volume

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

- 155mm (X) x 72mm (Y) x 20mm (Z)

![3d_printing_cura-slicer.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/253/medium640/3d_printing_cura-slicer.jpg?1721059674)

## 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_4884_Feather-RP2040.gif](https://cdn-learn.adafruit.com/assets/assets/000/131/613/medium640thumb/3d_printing_4884_Feather-RP2040.jpg?1722263090)

# CNC Rotary Macropad

## 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_feather_rp2040/)
 **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/102/705/medium800/adafruit_products_FeatherRP_buttons_highlighted.jpg?1623167565)

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/101/659/original/flash_nuke.uf2?1618945856)
# CNC Rotary Macropad

## Code the Macropad

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

## Upload the Code and Libraries to the Feather RP2040

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

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

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

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

## How the CircuitPython Code Works

The top of the code has a dictionary called `keymap`. This dictionary has the attributes for each key on the macropad. These include the keyboard shortcut and NeoPixel color. The `axis_states` array affects the keyboard shortcuts for the rotary encoder. These shortcuts are defined in the `encoder_map` dictionary. You can edit these dictionaries to customize the code for your setup.

```python
# axis states selected with keys 9-11
axis_states = [0, "x", "y", "z"]
state = axis_states[0]
# keymap for key matrix
keymap = {
    (0): (axis_states[0], (Keycode.COMMAND, Keycode.COMMA), BLUE), # SETTINGS
    (1): (axis_states[0], (Keycode.COMMAND, Keycode.P), ORANGE), # SLICE MODEL
    (2): (axis_states[0], (Keycode.COMMAND, Keycode.D), RED), # CLEAR BED

    (3): (axis_states[0], [Keycode.T], GREEN), # MOVE
    (4): (axis_states[0], [Keycode.S], AQUA), # SCALE
    (5): (axis_states[0], [Keycode.R], BLUE), # ROTATE

    (6): (axis_states[0], [Keycode.M], AQUA), # MIRROR
    (7): (axis_states[0], [Keycode.E], PURPLE), # SUPPORT BLOCKERS
    (8): (axis_states[0], [Keycode.I], PINK), # TABS

    (9): (axis_states[1], None, RED), # SET X-AXIS STATE
    (10): (axis_states[2], None, GREEN), # SET Y-AXIS STATE
    (11): (axis_states[3], None, BLUE),  # SET Z-AXIS STATE
}
# keymap for encoder based on state; pos = [0], neg = [1]
encoder_map = {
    ("x"): ([Keycode.RIGHT_ARROW], [Keycode.LEFT_ARROW]),
    ("y"): ([Keycode.UP_ARROW], [Keycode.DOWN_ARROW]),
    # ("z"): ([Keycode.W], [Keycode.S]),
}
```

Next the key matrix is setup using a `KeyMatrix`. The `key_to_pixel_map()` function maps the NeoPixels to their key in the matrix. The rotary encoder is instantiated using `rotaryio`.

```python
# make a keyboard
kbd = Keyboard(usb_hid.devices)
# key matrix
COLUMNS = 3
ROWS = 4
keys = keypad.KeyMatrix(
    row_pins=(board.D12, board.D11, board.D10, board.D9),
    column_pins=(board.A0, board.A1, board.A2),
    columns_to_anodes=False,
)
# neopixels and key num to pixel function
pixels = neopixel.NeoPixel(board.D5, 12, brightness=0.3)
def key_to_pixel_map(key_number):
    row = key_number // COLUMNS
    column = key_number % COLUMNS
    if row % 2 == 1:
        column = COLUMNS - column - 1
    return row * COLUMNS + column
pixels.fill(OFF)  # Begin with pixels off.

# make an encoder
encoder = rotaryio.IncrementalEncoder(board.D24, board.D25)
last_position = 0
```

## The Loop

The loop consists of two parts: monitoring the rotary encoder and monitoring the key matrix. The rotary encoder is controlled by keys 9, 10 and 11 in the matrix. These keys select the `axis_states` index to control either the x, y or z axis. Depending on which axis is selected, the rotary encoder will send its defined keycode from the&nbsp;`encoder_map` dictionary; or in the case of the z axis a mouse scroll.

```python
while True:
    # poll for key event
    key_event = keys.events.get()
    # get position of encoder
    position = encoder.position
    # if position changes..
    if position != last_position:
        # ..and it increases..
        if position > last_position:
            # ..and state is x:
            if state is axis_states[1]:
                kbd.press(*encoder_map[state][0])
            # ..and state is y:
            if state is axis_states[2]:
                kbd.press(*encoder_map[state][0])
            # ..and state is z:
            if state is axis_states[3]:
                mouse.move(wheel=-1)
        # ..and it decreases..
        if position < last_position:
            # ..and state is x:
            if state is axis_states[1]:
                kbd.press(*encoder_map[state][1])
            # ..and state is y:
            if state is axis_states[2]:
                kbd.press(*encoder_map[state][1])
            # ..and state is z:
            if state is axis_states[3]:
                mouse.move(wheel=1)
        # print(position)
        # release all keys
        kbd.release_all()
    # update last_position
    last_position = position
```

The `keypad` module monitors the key matrix for events. If keys 0-8 are pressed, then their keyboard shortcut is sent over USB HID. If keys 9-11 are pressed, then their NeoPixel remains lit and an axis is selected for the rotary encoder to control.

```python
# if a key event..
    if key_event:
        # print(key_event)
        # ..and it's pressed..
        if key_event.pressed:
            # ..and it's keys 0-8, send key presses from keymap:
            if keymap[key_event.key_number][0] is axis_states[0]:
                state = axis_states[0]
                kbd.press(*keymap[key_event.key_number][1])
            # ..and it's key 9, set state to x
            if keymap[key_event.key_number][0] is axis_states[1]:
                state = axis_states[1]
                pixels[key_to_pixel_map(10)] = OFF
                pixels[key_to_pixel_map(11)] = OFF
            # ..and it's key 10, set state to y
            if keymap[key_event.key_number][0] is axis_states[2]:
                state = axis_states[2]
                pixels[key_to_pixel_map(9)] = OFF
                pixels[key_to_pixel_map(11)] = OFF
            # ..and it's key 11, set state to z
            if keymap[key_event.key_number][0] is axis_states[3]:
                state = axis_states[3]
                pixels[key_to_pixel_map(9)] = OFF
                pixels[key_to_pixel_map(10)] = OFF
            # turn on neopixel for key with color from keymap
            pixels[key_to_pixel_map(key_event.key_number)] = keymap[key_event.key_number][2]
        # ..and it's released..
        if key_event.released:
            # if it's key 0-8, release the key press and turn off neopixel
            if keymap[key_event.key_number][0] is axis_states[0]:
                kbd.release(*keymap[key_event.key_number][1])
                pixels.fill(OFF)
```

# CNC Rotary Macropad

## Wiring

## Snap-apart NeoKeys

Use pliers to carefully snap off the top and bottom mounting strips.

Then, use your hands to carefully wiggle the extra three columns off.

Finally, remove the extra row.

Remember to save these extras somewhere safe, you can use them for another project later!

![3d_printing_snap-apart.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/558/medium640/3d_printing_snap-apart.jpg?1722258813)

Warning: Please use eye protection when cutting PCB material to avoid fragments getting in ones eyes.

## Wires

Measure and cut pieces of colored silicone covered wires for soldering the electronics.

- 1x Black & Red Wires (6 inches long)
- 1x Black & Red Wires (9 inches long)
- 3x Blue Wires (6 inches long)
- 5x White Wires (6 inches long)
- 1x Green Wire (6 inches long)
- 1x Yellow Wire (6 inches long)

![3d_printing_wires.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/559/medium640/3d_printing_wires.jpg?1722258840)

## Wires for Rotary Encoder

These four wires are specifically longer for the rotary encoder.

![3d_printing_rotary-wires.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/565/medium640/3d_printing_rotary-wires.jpg?1722258987)

## Wires for Rows

Get the four white colored wires ready to solder to the Snap-apart NeoKey switches.

![3d_printing_snap-wires.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/560/medium640/3d_printing_snap-wires.jpg?1722258859)

## Wiring Rows

Solder the four white wires to each of the **Row** pins on the right side of NeoKey PCB.

![3d_printing_rows-wires.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/561/medium640/3d_printing_rows-wires.jpg?1722258883)

## Wiring Columns

Solder the three blue wires to each of the Col pins on the NeoKey PCB.

![3d_printing_col-wires.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/562/medium640/3d_printing_col-wires.jpg?1722258897)

## VIN, GND and Data-In Wires

Solder the shorter black wire to the allocated GND pin on the NeoKey PCB.

Next, solder the shorter red wire to the designated VIN pin on the NeoKey PCB.

Then, solder the remaining white wire to the DATA-IN pin on the NeoKey PCB.

![3d_printing_vin-wire.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/563/medium640/3d_printing_vin-wire.jpg?1722258919)

## Check Wiring

Take a moment to ensure all of the wires have been properly soldered to the NeoKey PCB.

![3d_printing_snap-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/564/medium640/3d_printing_snap-wired.jpg?1722258954)

## Wiring Feather

Get the Feather RP2040 ready for soldering the wired connections from the Snap-apart NeoKey PCB.

![3d_printing_snap-feather-wires.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/566/medium640/3d_printing_snap-feather-wires.jpg?1722259311)

## Solder Rows

Start by soldering the white wires from the NeoKey PCB (from top to bottom) to pins&nbsp; **D12** , **D11** , **D10** and **D9** on the Feather RP2040.

![3d_printing_row-feather-solder.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/567/medium640/3d_printing_row-feather-solder.jpg?1722259325)

## NeoPixel Signal

Solder the white wire from the **DATA-IN** pin on the NeoKey PCB to the **D5** pin on the Feather RP2040.

![3d_printing_neo-feather-solder.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/568/medium640/3d_printing_neo-feather-solder.jpg?1722259365)

## Wiring Columns

Solder the blue wires from the **Col** pins on the NeoKey PCB to pins **A0** , **A1** , and **A2** on the Feather RP2040.

![3d_printing_col-feather-solder.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/569/medium640/3d_printing_col-feather-solder.jpg?1722259406)

## Wiring 3V

Solder the red wire from the VIN pin on the NeoKey PCB to one of the 3V pins on the Feather RP2040.

Then, solder the longer red wire to the remaining 3V pin on the Feather RP2040.

![3d_printing_rotary-VCC-feather-solder.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/572/medium640/3d_printing_rotary-VCC-feather-solder.jpg?1722259529)

## Wiring Ground

Solder the black wire from the **GND** pin on the NeoKey PCB to the **GND** pin on the Feather RP2040.

Then, solder the longer black wire to the same **GND** pin on the Feather RP2040.

![3d_printing_GNDs-feather-solder.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/571/medium640/3d_printing_GNDs-feather-solder.jpg?1722259506)

## Rotary Wires

Solder the green wire to the **D24** pin on the Feather RP2040.

Then, solder the yellow wire to the **D25** pin on the Feather RP2040.

![3d_printing_rotary-AB-feather-solder.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/573/medium640/3d_printing_rotary-AB-feather-solder.jpg?1722259544)

## Check Wires on the Feather

Take a moment to check all of the wires have been properly soldered to the Feather RP2040.

![3d_printing_feather-snap-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/574/medium640/3d_printing_feather-snap-wired.jpg?1722259619)

# CNC Rotary Macropad

## Assembly

## Screws for the Mount

Get the 3D printed mount ready to attach to the snap-apart NeoKey PCB. Use the following screws to secure the mount to the PCB.

- 4x M2.5 x 6mm long steel machine screws

![3d_printing_snap-mount-screws.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/575/medium640/3d_printing_snap-mount-screws.jpg?1722259660)

## Install Mount

Place the 3D printed mount over the snap-part NeoKey PCB with the Feather and wires fitted through the mount.

Line up the four standoffs from the 3D printed mount with the mounting holes in the center of the NeoKey PCB.

![3d_printing_snap-mount-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/576/medium640/3d_printing_snap-mount-install.jpg?1722259678)

## Secure Mount

Flip the snap-part NeoKey PCB over. Insert and fasten the M2.5 x 6mm long steel screws to secure the snap-apart NeoKey PCB to the 3D printed mount.

![3d_printing_snap-mount-fasten.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/577/medium640/3d_printing_snap-mount-fasten.jpg?1722259695)

![3d_printing_snap-mount-secured.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/578/medium640/3d_printing_snap-mount-secured.jpg?1722259706)

## Screws for the Rotary Encoder

Get the rotary encoder ready to attach to the 3D printed top cover.

Remove the three hex nuts from the rotary encoder.

![3d_printing_rotary-nuts-cover.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/579/medium640/3d_printing_rotary-nuts-cover.jpg?1722259723)

## Secure Rotary Encoder

Orient the three screws from the rotary encoder with the mounting holes on the 3D printed top cover.

Fit the rotary encoder through the 3D printed top cover with the screws going through the mounting holes.

Insert and fasten the hex nuts to secure the rotary encoder to the 3D printed top cover.

![3d_printing_rotary-cover-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/580/medium640/3d_printing_rotary-cover-install.jpg?1722259743)

![3d_printing_rotary-cover-secure.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/581/medium640/3d_printing_rotary-cover-secure.jpg?1722259759)

## Screws for the Feather

Get the Feather RP2040 ready to secure to the 3D printed bottom cover. Use the following hardware.

- 4x M2.5 x 6mm long steel screws

![3d_printing_btm-feather-screws.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/582/medium640/3d_printing_btm-feather-screws.jpg?1722259772)

## Install & Secure the Feather

Place the Feather RP2040 over the built-in standoffs on the 3D printed bottom cover.

Insert and fasten the four M2.5 x 6mm long steel screws to secure the Feather RP2040 to the 3D printed bottom cover.

![3d_printing_btm-feather-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/585/medium640/3d_printing_btm-feather-install.jpg?1722259831)

![3d_printing_btm-feather-fasten.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/586/medium640/3d_printing_btm-feather-fasten.jpg?1722259839)

## Secured Feather

Take a moment to ensure the Feather RP2040 has been properly secured to the 3D printed bottom cover.

![3d_printing_btm-feather-secured.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/587/medium640/3d_printing_btm-feather-secured.jpg?1722259853)

## Secure Mount to Bottom

Place the 3D printed mount with the snap-apart NeoKey PCB over the Feather RP2040 and 3D printed bottom cover.

Line up the remaining mounting holes on the 3D printed bottom cover with the standoffs on the 3D printed mount with the snap-part NeoKey PCB.

Insert and fasten four M2.5 x 6mm long steel screws to secure the 3D printed snap-apart NeoKey PCB to the 3D printed bottom cover.

![3d_printing_snap-btm-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/588/medium640/3d_printing_snap-btm-install.jpg?1722259867)

![3d_printing_snap-btm-fasten.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/589/medium640/3d_printing_snap-btm-fasten.jpg?1722259883)

## 3D Printed Frame

Get the 3D printed frame ready to install onto the 3D printed bottom cover.

![3d_printing_btm-frame.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/590/medium640/3d_printing_btm-frame.jpg?1722259905)

## Install Frame to Bottom

Get to install the 3D printed frame onto the 3D printed bottom cover by orienting the parts together.

Firmly press the parts together to snap fit them closed.

Check the USB-C port from the Feather RP2040 is properly lined up with the cutout on the 3D printed frame.

![3d_printing_btm-frame-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/591/medium640/3d_printing_btm-frame-install.jpg?1722259930)

![3d_printing_btm-frame-USB.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/592/medium640/3d_printing_btm-frame-USB.jpg?1722259944)

## Connect Rotary Encoder Wires

Get the four remaining wires from the Feather RP2040 ready to connect to the screw-block terminals on the rotary encoder.

Use a screwdriver to loosen the four screws on the rotary encoder.

Insert each wire into their corresponding screw-block terminals.

- Green wire to **A** terminal
- Yellow wire to **B** terminal
- Black wire to **0V** terminal
- Red wire to **Vcc** terminal

Use the screwdriver to secure the wires to the rotary encoders screw-block terminals.

![3d_printing_rotary-wires-secure.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/593/medium640/3d_printing_rotary-wires-secure.jpg?1722259962)

## Install Top to Frame

Orient the 3D printed top cover with the 3D printed frame.

Ensure all of the wires are fitted inside the 3D printed frame.

Press the parts together to snap fit them closed.

![3d_printing_btm-top-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/594/medium640/3d_printing_btm-top-install.jpg?1722259973)

![3d_printing_btm-top-secure.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/595/medium640/3d_printing_btm-top-secure.jpg?1722259983)

## Key Switches

Get the twelve mechanical key switches ready to install onto the snap-part NeoKey PCB.

Take a moment to get familiar with how the key switches will need to be oriented with the socket pins on the snap-part NeoKey PCB.

![3d_printing_keyswitches.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/596/medium640/3d_printing_keyswitches.jpg?1722260006)

## Install Key Switches

Begin fitting the mechanical key switch onto the sockets on the snap-apart NeoKey PCB.

Carefully press the key switches into the sockets, being cautious not to bend the pins.

![3d_printing_keys-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/597/medium640/3d_printing_keys-install.jpg?1722260026)

![3d_printing_keys-install-2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/598/medium640/3d_printing_keys-install-2.jpg?1722260040)

## Installed Key Switches

Check the key switches are flush with the surface on the top cover.

Install the remaining key switches on to the snap-part NeoKey PCB.

Ensure all of the key switches are properly installed onto the snap-apart NeoKey PCB and top cover.

![3d_printing_keys-secured.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/599/medium640/3d_printing_keys-secured.jpg?1722260070)

![3d_printing_keys-installed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/600/medium640/3d_printing_keys-installed.jpg?1722260080)

## Key Caps

Get the twelve key caps ready to install.

![3d_printing_key-caps.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/601/medium640/3d_printing_key-caps.jpg?1722260121)

## Install Key Caps

Begin installing each key cap onto the mechanical key switches.

![3d_printing_cap-installing.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/602/medium640/3d_printing_cap-installing.jpg?1722260134)

![3d_printing_cap-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/603/medium640/3d_printing_cap-install.jpg?1722260146)

## Installed Key Caps

Double check all of the key caps are fully seated onto the tems of the mechanical key switches.

![3d_printing_caps-installed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/604/medium640/3d_printing_caps-installed.jpg?1722260162)

## Final Build

Congratulations on your build! Use a USB-C cable to power and connect the rotary macropad to your computer.

![3d_printing_fianl-build-alt.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/605/medium640/3d_printing_fianl-build-alt.jpg?1722260188)

# CNC Rotary Macropad

## Usage

## Shortcut Legend for CURA Slicing Software

Use the legend below to reference the assigned keyboard shortcuts for the [Ultimaker Cura Slicing Software](https://ultimaker.com/software/ultimaker-cura/).

![](https://cdn-learn.adafruit.com/assets/assets/000/131/616/medium800/3d_printing_key-legend-v3.jpg?1722266537)


## Featured Products

### NeoKey 5x6 Ortho Snap-Apart Mechanical Key Switches w/ NeoPixel

[NeoKey 5x6 Ortho Snap-Apart Mechanical Key Switches w/ NeoPixel](https://www.adafruit.com/product/5157)
For folks who want ready-to-go keeb action, we've got the lovely [Adafruit Macropad with a 3x4 grid of MX+NeoPixel key switches](https://www.adafruit.com/product/5100) - but for those who like to forge their own path, we now present the easiest way of creating custom ortholinear...

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

[Adafruit Feather RP2040](https://www.adafruit.com/product/4884)
A new chip means a new Feather, and the Raspberry Pi RP2040 is no exception. When we saw this chip we thought "this chip is going to be awesome when we give it the Feather Treatment" and so we did! This Feather features the&nbsp; **RP2040** , and all niceties you know and...

In Stock
[Buy Now](https://www.adafruit.com/product/4884)
[Related Guides to the Product](https://learn.adafruit.com/products/4884/guides)
### CNC Rotary Encoder - 100 Pulses per Rotation - 60mm Silver

[CNC Rotary Encoder - 100 Pulses per Rotation - 60mm Silver](https://www.adafruit.com/product/5735)
We have various [PCB-mount rotary encoders in the shop](https://www.adafruit.com/search?q=rotary+encoder), great for making interfaces where you may want to spin a knob around to select a value.&nbsp;These large knobs are also encoders, but very large - like hand-sized! They're...

In Stock
[Buy Now](https://www.adafruit.com/product/5735)
[Related Guides to the Product](https://learn.adafruit.com/products/5735/guides)
### Kailh Mechanical Key Switches - Linear Black - 12 pack

[Kailh Mechanical Key Switches - Linear Black - 12 pack](https://www.adafruit.com/product/5876)
For crafting your very own custom keyboard, these **&nbsp;Kailh Black&nbsp;Linear mechanical key switches** &nbsp;are deeee-luxe! With smooth actuation and Cherry MX compatibility, they're lovely when you want a&nbsp; **smooth linear&nbsp;** keystroke with...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5876)
[Related Guides to the Product](https://learn.adafruit.com/products/5876/guides)
### Clear Keycaps for MX Compatible Switches - 12-pack

[Clear Keycaps for MX Compatible Switches - 12-pack](https://www.adafruit.com/product/5068)
Here is a **12&nbsp;pack** of Clear DSA keycaps for your next mechanical keyboard or&nbsp;[NeoKey](https://www.adafruit.com/?q=neokey&sort=BestMatch)&nbsp;project. Snap 'em onto any&nbsp; **Cherry MX or compatible switch&nbsp;** to turn your&nbsp;<a...></a...>

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

[Silicone Cover Stranded-Core Wire - 50ft 30AWG Red](https://www.adafruit.com/product/3165)
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/3165)
[Related Guides to the Product](https://learn.adafruit.com/products/3165/guides)
### Silicone Cover Stranded-Core Wire - 50ft 30AWG Blue

[Silicone Cover Stranded-Core Wire - 50ft 30AWG Blue](https://www.adafruit.com/product/3166)
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...

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

[Silicone Cover Stranded-Core Wire - 50ft 30AWG Black](https://www.adafruit.com/product/3164)
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/3164)
[Related Guides to the Product](https://learn.adafruit.com/products/3164/guides)

## Related Guides

- [Introducing Adafruit Feather RP2040](https://learn.adafruit.com/adafruit-feather-rp2040-pico.md)
- [Adafruit NeoKey 5x6 Ortho Snap-Apart](https://learn.adafruit.com/adafruit-neokey-5x6-ortho-snap-apart.md)
- [Darth Faders](https://learn.adafruit.com/darth-faders.md)
- [Numpad 4000 Mechanical Keyswitch Data Entry Device](https://learn.adafruit.com/numpad-4000-mechanical-keyswitch-data-entry-device.md)
- [4x4 Rotary Encoder MIDI Messenger](https://learn.adafruit.com/4x4-rotary-encoder-midi-messenger.md)
- [Customizing USB Devices in CircuitPython](https://learn.adafruit.com/customizing-usb-devices-in-circuitpython.md)
- [DIY Decorative Resin Keycaps](https://learn.adafruit.com/diy-decorative-resin-keycaps.md)
- [Mini GIF Players](https://learn.adafruit.com/mini-gif-players.md)
- [Adafruit DS3502 I2C Digital Potentiometer](https://learn.adafruit.com/ds3502-i2c-potentiometer.md)
- [Discord and Slack Connected Smart Plant with Adafruit IO Actions](https://learn.adafruit.com/discord-and-slack-connected-smart-plant-with-adafruit-io-triggers.md)
- [Edit CircuitPython Code on iOS with Runestone](https://learn.adafruit.com/editing-circuitpython-on-ios-with-runestone.md)
- [Bubble Table with LED Animations and IR Remote Control](https://learn.adafruit.com/bubble-table-with-led-animations-and-ir-remote-control.md)
- [NeoPixel Rotary Fidget](https://learn.adafruit.com/neopixel-rotary-fidget.md)
- [How to Choose a Microcontroller](https://learn.adafruit.com/how-to-choose-a-microcontroller.md)
- [32x32 Square Pixel Art Animation Display](https://learn.adafruit.com/32x32-square-pixel-display.md)
- [Program RP2040 in Arduino](https://learn.adafruit.com/rp2040-arduino-with-the-earlephilhower-core.md)
- [Cooperative Multitasking in CircuitPython with asyncio](https://learn.adafruit.com/cooperative-multitasking-in-circuitpython-with-asyncio.md)
