# NeoPixel Rotary Fidget

## Overview

https://youtu.be/853bwhvw738

## LED Fidget & Game

Build a fun CircuitPython project for fidgeting that doubles as an LED chase game!&nbsp;

Powered by the Adafruit Feather RP2040, this project features the ANO navigation encoder to control a 24 NeoPixel ring.

![led_pixels_hero-rainbow.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/068/medium640/led_pixels_hero-rainbow.jpg?1705412998)

## NeoPixel Fidget

In the fidget mode, use the directional buttons to change the color of the LED. The scroll wheel lets you move an LED pixel along the ring. Press the center button to light up the whole ring!

![led_pixels_loop-rotary.gif](https://cdn-learn.adafruit.com/assets/assets/000/127/071/medium640thumb/led_pixels_loop-rotary.jpg?1705416745)

## LED Chase

Press and hold the center button to go into LED chase game mode. Press the center button when the LED lands on either of the three lit pixels to advance to the next level. If you win all levels, you are rewarded with a lovely rainbow!

![led_pixels_loop-game.gif](https://cdn-learn.adafruit.com/assets/assets/000/127/072/medium640thumb/led_pixels_loop-game.jpg?1705416755)

## Parts
### ANO Directional Navigation and Scroll Wheel Rotary Encoder

[ANO Directional Navigation and Scroll Wheel Rotary Encoder](https://www.adafruit.com/product/5001)
This funky user interface element is reminiscent of the [original clicking scroll wheel interface on the first iPods](https://gizmodo.com/a-visual-history-of-the-ipod-click-wheel-r-i-p-1632640054). It's a fancy mechanical kit but has an intuitiveness that is hard to argue with -...

In Stock
[Buy Now](https://www.adafruit.com/product/5001)
[Related Guides to the Product](https://learn.adafruit.com/products/5001/guides)
![Angled shot of ANM rotary encoder.](https://cdn-shop.adafruit.com/640x480/5001-00.jpg)

### Adafruit ANO Rotary Navigation Encoder to I2C Stemma QT Adapter

[Adafruit ANO Rotary Navigation Encoder to I2C Stemma QT Adapter](https://www.adafruit.com/product/5740)
The ANO rotary encoder wheel is a funky user interface element, reminiscent of the [original clicking scroll wheel interface on the first iPods](https://gizmodo.com/a-visual-history-of-the-ipod-click-wheel-r-i-p-1632640054). It's a nifty kit, but the pin-out is a little odd...

In Stock
[Buy Now](https://www.adafruit.com/product/5740)
[Related Guides to the Product](https://learn.adafruit.com/products/5740/guides)
![Overhead video of a blue-manicured finger manipulating a rotary encoder connected to a 4-digit LED segment display. ](https://cdn-shop.adafruit.com/product-videos/640x480/5740-04.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)

### NeoPixel Ring - 24 x 5050 RGB LED with Integrated Drivers

[NeoPixel Ring - 24 x 5050 RGB LED with Integrated Drivers](https://www.adafruit.com/product/1586)
Round and round and round they go! 24 ultra bright smart LED NeoPixels are arranged in a circle with 2.6" (66mm) outer diameter. The rings are 'chainable' - connect the output pin of one to the input pin of another. Use only one microcontroller pin to control as many as you can...

In Stock
[Buy Now](https://www.adafruit.com/product/1586)
[Related Guides to the Product](https://learn.adafruit.com/products/1586/guides)
![Hand holding NeoPixel Ring with 24 x 5050 RGB LED, lit up rainbow](https://cdn-shop.adafruit.com/640x480/1586-00.jpg)

### Lithium Ion Polymer Battery - 3.7v 500mAh

[Lithium Ion Polymer Battery - 3.7v 500mAh](https://www.adafruit.com/product/1578)
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 500mAh for a total of about 1.9 Wh. If you need a larger (or smaller!) battery, <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1578)
[Related Guides to the Product](https://learn.adafruit.com/products/1578/guides)
![Angled shot of a Lithium Ion Polymer Battery 3.7V 500mAh with JST-PH connector.](https://cdn-shop.adafruit.com/640x480/1578-03.jpg)

### Part: Slide Switch
quantity: 1
Breadboard-friendly SPDT Slide Switch
[Slide Switch](https://www.adafruit.com/product/805)

### Part: STEMMA QT cable
quantity: 1
STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long
[STEMMA QT cable](https://www.adafruit.com/product/4399)

### Part: Silicone Cover Stranded-Core Ribbon Cable
quantity: 1
10 Wire 1 Meter Long - 28AWG Black
[Silicone Cover Stranded-Core Ribbon Cable](https://www.adafruit.com/product/3890)

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

## Hardware

The following hardware is required for the assembly.

- 12x M2.5 x 6mm long machine screws

# NeoPixel Rotary Fidget

## 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/126/975/medium800/led_pixels_circuit-diagram.jpg?1704988328)

## Wired Connections

- 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.
- The ANO Rotary Encoder is connected to Feather using a STEMMA QT cable.

**24x NeoPixel Ring**

- Data Input from NeoPixel ring to D5 on Feather
- GND from NeoPixel ring to GND on Feather
- +5V from NeoPixel ring to 3V on Feather

# NeoPixel Rotary Fidget

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

![led_pixels_3d-parts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/053/medium640/led_pixels_3d-parts.jpg?1705348867)

[Download STLs.zip](https://cdn-learn.adafruit.com/assets/assets/000/127/056/original/STLs.zip?1705349514)
[Download CAD source](https://cdn-learn.adafruit.com/assets/assets/000/127/057/original/CAD.zip?1705349660)
[Download Fusion 360 File](https://cdn-learn.adafruit.com/assets/assets/000/130/451/original/ANO_NeoPixel_Fidget_F360.zip?1717605002)
## CAD Assembly

The Feather is secured to the PCB mount with screws.

The slide switch press fits into a built-in holder on the PCB mount.

The battery is fitted on top of the Feather.

The PCB mount is secured to the bottom cover using screws. The case and bottom cover snap fit.

The 24x NeoPixel ring press fits into the ring holder.

The ring holder fits on top of the case.

The diffuser is press fitted into the ring holder.

The wheel cover fits into the ring holder.

![led_pixels_CAD.gif](https://cdn-learn.adafruit.com/assets/assets/000/127/052/medium640thumb/led_pixels_CAD.jpg?1705348839)

## Build Volume

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

- 75mm (X) x 75mm (Y) x 30mm (Z)

![led_pixels_cura-slice.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/055/medium640/led_pixels_cura-slice.jpg?1705349077)

## 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/).

![led_pixels_5740_ANO_Rotary_Encoder_QT.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/054/medium640/led_pixels_5740_ANO_Rotary_Encoder_QT.jpg?1705348933)

# NeoPixel Rotary Fidget

## 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)
# NeoPixel Rotary Fidget

## Code the NeoPixel Rotary Fidget

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/NeoPixel_Fidget_Spinner/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 RP2040'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/NeoPixel_Fidget_Spinner.png )

## How the CircuitPython Code Works

The code begins by setting up the NeoPixel ring and the ANO rotary encoder. The rotary encoder uses a seesaw chip to communicate over I2C. The five buttons are created as `Button` objects from the **adafruit\_debouncer** library.

```python
# NeoPixel ring setup. Update num_pixels if using a different ring.
num_pixels = 24
pixels = neopixel.NeoPixel(board.D5, num_pixels, auto_write=False)

i2c = board.STEMMA_I2C()
seesaw = seesaw.Seesaw(i2c, addr=0x49)

buttons = []
for b in range(1, 6):
    seesaw.pin_mode(b, seesaw.INPUT_PULLUP)
    ss_pin = digitalio.DigitalIO(seesaw, b)
    button = Button(ss_pin, long_duration_ms=1000)
    buttons.append(button)

encoder = rotaryio.IncrementalEncoder(seesaw)
last_position = 0
```

## Colors

The `colors` list indexes predefined colors from the **adafruit\_led\_animation** library.

```python
colors = [color.RED, color.YELLOW, color.ORANGE, color.GREEN,
          color.TEAL, color.CYAN, color.BLUE, color.PURPLE, color.MAGENTA]
```

## The Loop

The state of `game_mode` determines what functionality is active in the loop. If `game_mode` is `False`, then the fidget acts as a fidget toy. When you press any of the arrow buttons, the NeoPixel color changes by either increasing or decreasing the `color_index` value. If you spin the rotary encoder, a single pixel will move around the ring. If you press the center button, the entire ring will light up. If you hold the center button down for a full second or longer, a `long_press` is detected and `game_mode` changes to `True`.

```python
if not game_mode:
        for b in range(5):
            buttons[b].update()
            if buttons[b].released or buttons[b].pressed:
                pixels.fill(color.BLACK)
        position = encoder.position
        if position != last_position:
            pixels[last_position % num_pixels] = color.BLACK
            pixels[position % num_pixels] = colors[color_index]
            # print("Position: {}".format(position))
            last_position = position

        if buttons[0].pressed:
            # print("Center button!")
            pixels.fill(colors[color_index])

        elif buttons[0].long_press:
            # print("long press detected")
            pixels.fill(color.BLACK)
            new_target = True
            game_mode = True

        if buttons[1].pressed:
            # print("Up button!")
            color_index = (color_index + 1) % len(colors)
            pixels[10] = colors[color_index]

        if buttons[2].pressed:
            # print("Left button!")
            color_index = (color_index + 1) % len(colors)
            pixels[4] = colors[color_index]

        if buttons[3].pressed:
            # print("Down button!")
            color_index = (color_index - 1) % len(colors)
            pixels[22] = colors[color_index]

        if buttons[4].pressed:
            # print("Right button!")
            color_index = (color_index - 1) % len(colors)
            pixels[16] = colors[color_index]

        pixels.show()
```

When `game_mode` is `True`, a modified version of the [NeoPixel chase game](https://learn.adafruit.com/pixel-chase-game) begins.&nbsp;

The goal is to press the center button when the moving NeoPixel lands on the target pixels.&nbsp;The target pixels are placed randomly so it’s different for each level. The game advances and speeds up as you score and hit the targets.&nbsp;The running pixel changes color as you level up and goes in the order of ROYGBIV.&nbsp;If you miss a target, the game starts over.

To change `game_mode` to `False`, you can hold down the center button for a `long_press` to return to the fidget toy mode.

```python
if game_mode:
        buttons[0].update()
        if buttons[0].long_press:
            # print("long press detected")
            pixels.fill(color.BLACK)
            pixels.show()
            game_mode = False
            pixels.fill(colors[color_index])
        #  if new level starting..
        if new_target:
            if buttons[0].released:
            #  randomize target location
                y = random.randint(5, 22)
                x = y - 1
                z = y + 1
                new_target = False
                pixels[x] = color.WHITE
                pixels[y] = colors[next_color]
                pixels[z] = color.WHITE
        else:
            #  delay without time.sleep()
            if (pixel + speed) < time.monotonic():
                #  turn off pixel behind chaser
                if num > 0:
                    last_num = num - 1
                    pixels[last_num] = color.BLACK
                    pixels.show()
                #  keep target pixels their colors when the chaser passes
                if last_num in (x, y, z):
                    pixels[x] = color.WHITE
                    pixels[y] = colors[next_color]
                    pixels[z] = color.WHITE
                #  move chaser pixel by one
                if num < num_pixels:
                    pixels[num] = colors[now_color]
                    pixels.show()
                    num += 1
                #  send chaser back to the beginning of the circle
                if num == num_pixels:
                    last_num = num - 1
                    pixels[last_num] = color.BLACK
                    pixels.show()
                    num = 0
                #  if the chaser hits the target...
                if last_num in [x, y, z] and not buttons[0].value:
                    #  fills with the next color
                    pixels.fill(colors[next_color])
                    pixels.show()
                    #  chaser resets
                    num = 0
                    time.sleep(0.5)
                    pixels.fill(color.BLACK)
                    pixels.show()
                    #  speed increases for next level
                    speed = speed - level
                    #  color updates
                    next_color = (next_color + 1) % 9
                    now_color = (now_color + 1) % 9
                    #  setup for new target
                    new_target = True
                #  if the chaser misses the target...
                if last_num not in [x, y, z] and not buttons[0].value:
                    #  fills with current chaser color
                    pixels.fill(color.BLACK)
                    pixels.show()
                    #  chaser is reset
                    num = 0
                    #  speed is reset to default
                    speed = 0.1
                    #  colors are reset
                    next_color = 1
                    now_color = 0
                    #  setup for new target
                    new_target = True
                #  when you have beaten all the levels...
                if speed < final_level:
                    #  rainbows!
                    rainbow_cycle(0.01)
                    time.sleep(1)
                    #  chaser is reset
                    num = 0
                    pixels.fill(color.BLACK)
                    pixels.show()
                    #  speed is reset to default
                    speed = 0.1
                    #  colors are reset
                    next_color = 1
                    now_color = 0
                    #  setup for new target
                    new_target = True
                #  time.monotonic() is reset for the delay
                pixel = time.monotonic()
```

# NeoPixel Rotary Fidget

## Wiring

## ANO Rotary Breakout and Encoder Wheel

Install the rotary wheel to the ANO STEMMA QT breakout by orienting pins in the correct the holes.

Solder all of the pins on the ANO rotary encoder wheel to the ANO STEMMA QT breakout.

![led_pixels_ANO-wheel-soldered.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/003/medium640/led_pixels_ANO-wheel-soldered.jpg?1705168403)

## Slide Switch

Use the ribbon cable to create a 2-pin wire that is 6 inches / 15 cm in length.

Cut the pins on the slide switch so they're half their original length. Remove the third pin (either far left or right, but not the middle).

Solder the 2-pin wire to the two pins on the slide switch.

![led_pixels_switch-wire.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/004/medium640/led_pixels_switch-wire.jpg?1705168417)

![led_pixels_switch-wire-soldering.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/006/medium640/led_pixels_switch-wire-soldering.jpg?1705168472)

## Feather Switch

Solder the 2-pin wire from the switch to the EN and GND pins on the bottom of the Feather RP2040.

![led_pixels_switch-feather.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/005/medium640/led_pixels_switch-feather.jpg?1705168443)

![led_pixels_switch-feather-soldering.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/007/medium640/led_pixels_switch-feather-soldering.jpg?1705168490)

## NeoPixel Ring

Use the ribbon cable to create a 3-pin wire that is 12 inches / 30 cm in length.

Solder the 3-pin wire to the Data Input, GND, and PWR 5+V pins on the bottom of the 24x NeoPixel ring.

![led_pixels_neopixel-wire.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/008/medium640/led_pixels_neopixel-wire.jpg?1705168508)

![led_pixels_neopixel-wire-soldering.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/009/medium640/led_pixels_neopixel-wire-soldering.jpg?1705168517)

## Connect NeoPixel Ring to Feather

Solder the 3-pin wire from the NeoPixel ring to the Feather RP2040.

- Data In from NeoPixel to Pin 5 on Feather
- GND from NeoPixel to GND on Feather
- PWR +5V from NeoPixel to 3V on Feather

![led_pixels_neopixel-feather.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/010/medium640/led_pixels_neopixel-feather.jpg?1705168612)

![led_pixels_neopixel-feather-soldering.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/011/medium640/led_pixels_neopixel-feather-soldering.jpg?1705168618)

## Wired NeoPixel Ring

Take a moment to inspect the wires have been properly soldered to the pin on the Feather RP2040.

![led_pixels_neopixel-feather-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/012/medium640/led_pixels_neopixel-feather-wired.jpg?1705168637)

## Connect ANO Rotary

Use the short STEMMA QT cable to connect the ANO rotary breakout to the Feather RP2040.

![led_pixels_ANO-feather-connect.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/013/medium640/led_pixels_ANO-feather-connect.jpg?1705168657)

## Connect Battery

Plugin the 500mAh lipo battery to the battery port on the Feather RP2040.

Use the slide switch to power the Feather RP2040 on.

![led_pixels_battery-connect-test.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/014/medium640/led_pixels_battery-connect-test.jpg?1705168673)

# NeoPixel Rotary Fidget

## Assembly

## Install Slide Switch

Get the 3D printed PCB mount and circuit ready.

Insert the slide switch into the switch holder on the PCB mount by inserting it at an angle and fitting until it sits flush.

![led_pixels_pcb-mount-feather.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/015/medium640/led_pixels_pcb-mount-feather.jpg?1705168698)

![led_pixels_switch-mount-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/016/medium640/led_pixels_switch-mount-install.jpg?1705168709)

## Install Feather

Place the Feather over the PCB Mount with the mounting holes in the correct orientation.

Use 4x M2.5 x 6mm long machine screws to secure the Feather to the PCB mount.

![led_pixels_feather-pcb-mount.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/017/medium640/led_pixels_feather-pcb-mount.jpg?1705168729)

![led_pixels_feather-mount-secure.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/018/medium640/led_pixels_feather-mount-secure.jpg?1705168738)

## Install Battery

Place the 500 mAh battery over the Feather so it fits in between the standoffs.&nbsp;

![led_pixels_battery-mount-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/019/medium640/led_pixels_battery-mount-install.jpg?1705168755)

## Install ANO Rotary

Place the ANO rotary breakout over the four tall standoffs with the mounting holes line up.

![led_pixels_ANO-mount-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/020/medium640/led_pixels_ANO-mount-install.jpg?1705168768)

## Secure ANO Rotary

Use 4x M2.5 x 6mm long machine screws to secure the ANO rotary breakout to the PCB mount.

![led_pixels_ANO-mount-secure.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/021/medium640/led_pixels_ANO-mount-secure.jpg?1705168785)

![led_pixels_ANO-mount-secured.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/022/medium640/led_pixels_ANO-mount-secured.jpg?1705168795)

## Test Circuit

Use the slide switch to power on the Feather RP2040 and test out the circuit.

Turn off the Feather when ready to proceed.

![led_pixels_mount-switch.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/023/medium640/led_pixels_mount-switch.jpg?1705168812)

![led_pixels_mount-circuit-test.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/024/medium640/led_pixels_mount-circuit-test.jpg?1705168826)

## Bottom Cover

Orient the bottom cover with the Feather RP2040.

![led_pixels_bottom-cover.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/025/medium640/led_pixels_bottom-cover.jpg?1705168838)

## Secure Bottom Cover

Place the PCB mount assembly over the bottom cover with the mounting holes and slide switch correctly oriented.

Use 4x M2.5 x 6mm long screws to secure the bottom cover to the PCB mount.

![led_pixels_bottom-mount-secure.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/026/medium640/led_pixels_bottom-mount-secure.jpg?1705168849)

![led_pixels_bottom-mount-secured.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/027/medium640/led_pixels_bottom-mount-secured.jpg?1705168858)

## Install Case

Fit the 24x NeoPixel ring through the 3D printed case with the USB cutout properly oriented.

![led_pixels_case-neopixel-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/028/medium640/led_pixels_case-neopixel-install.jpg?1705168871)

## Secure Case to Bottom Cover

Fit the case onto the bottom cover and snap fit them together.

![led_pixels_case-cover-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/029/medium640/led_pixels_case-cover-install.jpg?1705168892)

![led_pixels_case-cover-secured.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/030/medium640/led_pixels_case-cover-secured.jpg?1705168899)

## NeoPixel Ring Holder

Get the NeoPixel ring holder ready to install.

![led_pixels_neopixel-holder.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/031/medium640/led_pixels_neopixel-holder.jpg?1705168910)

## Secure NeoPixel Ring to Holder

Orient the 24x NeoPixel ring with the ring holder so the NeoPixel LEDs are fitted inside the spots in the grid.

Press fit the NeoPixel ring into the holder until it sits flush.

![led_pixels_neopixel-holder-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/032/medium640/led_pixels_neopixel-holder-install.jpg?1705168927)

![led_pixels_neopixel-holder-secured.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/033/medium640/led_pixels_neopixel-holder-secured.jpg?1705168940)

## NeoPixel Wire

Adjust the 3-pin wire from the NeoPixel ring so they're fitted along the bottom of the PCB.

![led_pixels_neopixel-holder-wiring.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/034/medium640/led_pixels_neopixel-holder-wiring.jpg?1705168956)

## Installing Holder

Turn on the Feather RP2040 using the slide switch. Press one of the directional buttons on the ANO wheel to power a single NeoPixel LED.

Rotate the ring holder until the lit LED is lined up correctly with the directional button.&nbsp;

![led_pixels_neopixel-holder-position.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/035/medium640/led_pixels_neopixel-holder-position.jpg?1705169039)

## Secure Ring Holder

Press the ring holder down into the case until it is fully seating into the case.

![led_pixels_ring-holder-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/036/medium640/led_pixels_ring-holder-install.jpg?1705169075)

## Install Rotary Cover

Place the rotary wheel cover over the ANO rotary wheel.

![led_pixels_ring-cover-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/038/medium640/led_pixels_ring-cover-install.jpg?1705169157)

## Secured Rotary Cover

Press the wheel cover down until it sits flush with the ANO rotary wheel.

![led_pixels_ring-cover-secured.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/039/medium640/led_pixels_ring-cover-secured.jpg?1705169186)

## Install Diffuser

Orient the 3D printed diffuser so the squares can be fitted into the ring holders grid.

Press the diffuser into the ring holder until it's been fully seated.

![led_pixels_diffuser-instal.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/043/medium640/led_pixels_diffuser-instal.jpg?1705240657)

![led_pixels_diffuser-installing.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/044/medium640/led_pixels_diffuser-installing.jpg?1705240667)

## Final Build

Use the slide switch to turn the Feather RP2040 on and off.

Congratulations on your build!

![led_pixels_final-build.jpg](https://cdn-learn.adafruit.com/assets/assets/000/127/045/medium640/led_pixels_final-build.jpg?1705240690)

![](https://cdn-learn.adafruit.com/assets/assets/000/127/087/medium800thumb/led_pixels_loop-guide.jpg?1705497784)


## Featured Products

### ANO Directional Navigation and Scroll Wheel Rotary Encoder

[ANO Directional Navigation and Scroll Wheel Rotary Encoder](https://www.adafruit.com/product/5001)
This funky user interface element is reminiscent of the [original clicking scroll wheel interface on the first iPods](https://gizmodo.com/a-visual-history-of-the-ipod-click-wheel-r-i-p-1632640054). It's a fancy mechanical kit but has an intuitiveness that is hard to argue with -...

In Stock
[Buy Now](https://www.adafruit.com/product/5001)
[Related Guides to the Product](https://learn.adafruit.com/products/5001/guides)
### Adafruit ANO Rotary Navigation Encoder to I2C Stemma QT Adapter

[Adafruit ANO Rotary Navigation Encoder to I2C Stemma QT Adapter](https://www.adafruit.com/product/5740)
The ANO rotary encoder wheel is a funky user interface element, reminiscent of the [original clicking scroll wheel interface on the first iPods](https://gizmodo.com/a-visual-history-of-the-ipod-click-wheel-r-i-p-1632640054). It's a nifty kit, but the pin-out is a little odd...

In Stock
[Buy Now](https://www.adafruit.com/product/5740)
[Related Guides to the Product](https://learn.adafruit.com/products/5740/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)
### NeoPixel Ring - 24 x 5050 RGB LED with Integrated Drivers

[NeoPixel Ring - 24 x 5050 RGB LED with Integrated Drivers](https://www.adafruit.com/product/1586)
Round and round and round they go! 24 ultra bright smart LED NeoPixels are arranged in a circle with 2.6" (66mm) outer diameter. The rings are 'chainable' - connect the output pin of one to the input pin of another. Use only one microcontroller pin to control as many as you can...

In Stock
[Buy Now](https://www.adafruit.com/product/1586)
[Related Guides to the Product](https://learn.adafruit.com/products/1586/guides)
### Lithium Ion Polymer Battery - 3.7v 500mAh

[Lithium Ion Polymer Battery - 3.7v 500mAh](https://www.adafruit.com/product/1578)
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 500mAh for a total of about 1.9 Wh. If you need a larger (or smaller!) battery, <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/1578)
[Related Guides to the Product](https://learn.adafruit.com/products/1578/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)
### STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long

[STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long](https://www.adafruit.com/product/4399)
This 4-wire cable is&nbsp;50mm / 1.9" long and fitted with JST SH female 4-pin connectors on both ends. Compared with the chunkier JST PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4399)
[Related Guides to the Product](https://learn.adafruit.com/products/4399/guides)
### Silicone Cover Stranded-Core Ribbon Cable - 10 Wire 1 Meter Long

[Silicone Cover Stranded-Core Ribbon Cable - 10 Wire 1 Meter Long](https://www.adafruit.com/product/3890)
For those who are fans of our silicone-covered wires, but are always looking to _up their wiring game_. We now have **Silicone Cover Ribbon cables!** These may look _a lot_ like <a...></a...>

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

## Related Guides

- [Introducing Adafruit Feather RP2040](https://learn.adafruit.com/adafruit-feather-rp2040-pico.md)
- [ANO Directional Navigation and Scroll Wheel Rotary Encoder and Breakout](https://learn.adafruit.com/ano-rotary-encoder.md)
- [Adafruit ANO Rotary Encoder to I2C Adapter](https://learn.adafruit.com/adafruit-ano-rotary-navigation-encoder-to-i2c-stemma-qt-adapter.md)
- [DeviceScript, TypeScript for Microcontrollers](https://learn.adafruit.com/devicescript.md)
- [3D Printed Daft Punk Helmet with Bluetooth ](https://learn.adafruit.com/3d-printed-daft-punk-helmet-with-bluetooth.md)
- [Adafruit DS3502 I2C Digital Potentiometer](https://learn.adafruit.com/ds3502-i2c-potentiometer.md)
- [Program RP2040 in Arduino](https://learn.adafruit.com/rp2040-arduino-with-the-earlephilhower-core.md)
- [CurieBot: Arduino 101 Mini Robot Rover](https://learn.adafruit.com/curiebot-arduino-101-mini-robot-rover.md)
- [NeoPixels on Raspberry Pi](https://learn.adafruit.com/neopixels-on-raspberry-pi.md)
- [Your Pulse Displayed with NeoPixels](https://learn.adafruit.com/pulse-sensor-displayed-with-neopixels.md)
- [BLE Feather Lamp](https://learn.adafruit.com/ble-feather-lamp.md)
- [An Introduction to RP2040 PIO with CircuitPython](https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython.md)
- [Driving TM1814 addressable LEDs](https://learn.adafruit.com/driving-tm1814-addressable-leds.md)
- [Digital Clock with CircuitPython](https://learn.adafruit.com/digital-clock-with-circuitpython.md)
- [Touch Tone Phone Dial-a-Song](https://learn.adafruit.com/touch-tone-phone-dial-a-song.md)
- [Numpad 4000 Mechanical Keyswitch Data Entry Device](https://learn.adafruit.com/numpad-4000-mechanical-keyswitch-data-entry-device.md)
- [NeoTrellis MIDI Feedback Controller](https://learn.adafruit.com/neotrellis-midi-feedback-controller.md)
- [Motorized POV LED Display](https://learn.adafruit.com/motorized-pov-led-display.md)
