# ANO Directional Navigation and Scroll Wheel Rotary Encoder and Breakout

## Overview

Info: There are two versions of the breakout: [one that is fully assembled](https://www.adafruit.com/product/6311) and [one that is just the breakout](https://www.adafruit.com/product/5221), no ANO encoder included.

![](https://cdn-learn.adafruit.com/assets/assets/000/104/891/medium800/circuitpython_ANO_top.jpg?1632860297)

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 - everyone knows how to use this kind of rotary encoder to scroll and select.

![](https://cdn-learn.adafruit.com/assets/assets/000/104/892/medium800/circuitpython_ANO_back.jpg?1632860323)

This product is _just_ the encoder/button wheel element. The pin-out is a little odd, but, you could solder to the pins if you like.

![](https://cdn-learn.adafruit.com/assets/assets/000/104/893/medium800thumb/circuitpython_ANOb_hooked_up.jpg?1632860345)

There are 5 buttons (up down left right center) and a rotary encoder wheel in the center. Use with any microcontroller that can read pulse-code rotary encoders!

![](https://cdn-learn.adafruit.com/assets/assets/000/104/894/medium800/circuitpython_ANOb_top.jpg?1632860360)

To deal with the odd pinout we made a handy breakout board that converts the funky pin set into a straightforward, breadboard-friendly header strip.

![](https://cdn-learn.adafruit.com/assets/assets/000/104/895/medium800/circuitpython_ANOb_back.jpg?1632860371)

There's no pull-up or pull-down resistors on this PCB, and of course you'll need to solder the encoder onto the breakout. Then use your microcontroller's button and rotary encoder library/hardware support to interface with the pins.

![](https://cdn-learn.adafruit.com/assets/assets/000/104/896/medium800/circuitpython_ANOb_top_header.jpg?1632860385)

You'll need 7 GPIO total: 5 buttons and 2 rotary encoder pins. There's also two COMmon pins, which you can set to ground or VCC - usually ground so that you can use the microcontroller internal pull-ups for the button/encoders. Note: to make our wiring simple, our example code uses GPIO to the COM's and then sets then to outputs, but you can just wire them directly.

# ANO Directional Navigation and Scroll Wheel Rotary Encoder and Breakout

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/104/897/medium800/circuitpython_ANOb_pinouts.jpg?1632863128)

The ANO Rotary Navigation Encoder breakout has 9 pins. Here are the details.

- **ENCA** - This is the rotary encoder A pin.
- **ENCB** - This is the rotary encoder B pin.
- **SW1** - This pin is the center button.
- **SW2** - This pin is the down button.
- **SW3** - This pin is the right button.
- **SW4** - This pin is the up button.
- **SW5** - This pin is the left button.
- **COMA** - Common pin A for **SW1** , **ENCA** , and **ENCB**. Set to ground or VCC - usually ground - so that you can use the microcontroller internal pull-ups for the button/encoders. You can also use a GPIO pin and pull it low.
- **COMB** - Common pin B for **SW2** , **SW3** , **SW4** , **SW5**. Set to ground or VCC - usually ground - so that you can use the microcontroller internal pull-ups for the button/encoders. You can also use a GPIO pin and pull it low.

## COMA vs COMB

There are two separate common pins: **COMA** and **COMB**. These are "common" to two different sets of pins (see above). The Adafruit Rotary Navigation Encoder Breakout does **not** tie the two common pins together. So be careful when wiring things up to not miss or incorrectly wire **COMA** or **COMB** with respect to the other pins.

The diagram from the [info sheet](https://cdn-shop.adafruit.com/product-files/5001/ANO+Encoder.jpg) shows this more clearly. The missing connection for CH.B to COM.A is probably a mistake.

![](https://cdn-learn.adafruit.com/assets/assets/000/133/947/medium800/arduino_compatibles_enc_pins.png?1733413797)

# ANO Directional Navigation and Scroll Wheel Rotary Encoder and Breakout

## Python & CircuitPython

The ANO Directional Navigation and Scroll Wheel Rotary Encoder is made up of 5 buttons and a two-direction rotary encoder. CircuitPython has two built in modules - `digitalio` and `rotaryio` - designed to work with buttons and rotary encoders, making it super simple to get started with this encoder! These modules make it easy to write Python code that allows you to read button presses and encoder rotation from the encoder.

This example uses a 12-pixel NeoPixel ring, along with the rotary encoder, to use the encoder to light up various pixels.

## Additional Necessary Hardware
Featured
### NeoPixel Ring - 12 x 5050 RGB LED with Integrated Drivers

[NeoPixel Ring - 12 x 5050 RGB LED with Integrated Drivers](https://www.adafruit.com/product/1643)
Round and round and round they go! 12 ultra bright smart LED NeoPixels are arranged in a circle with 1.5" (37mm) 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/1643)
[Related Guides to the Product](https://learn.adafruit.com/products/1643/guides)
![Hand holding NeoPixel Ring with 12  x 5050 RGB LED, lit up rainbow](https://cdn-shop.adafruit.com/640x480/1643-00.jpg)

Featured
### Hook-up Wire Spool Set - 22AWG Solid Core - 6 x 25 ft

[Hook-up Wire Spool Set - 22AWG Solid Core - 6 x 25 ft](https://www.adafruit.com/product/1311)
Perfect for bread-boarding, free wiring, etc. This box contains 6 spools of solid-core wire. The wire is easy to solder to and when bent it keeps its shape pretty well. We like to have a few spools of this stuff around which is why this set is quite nice! We suggest picking up wire strippers...

In Stock
[Buy Now](https://www.adafruit.com/product/1311)
[Related Guides to the Product](https://learn.adafruit.com/products/1311/guides)
![Hook-up Wire Spool Set in box with 6 colorful wires coming out](https://cdn-shop.adafruit.com/640x480/1311-04.jpg)

## CircuitPython Microcontroller Wiring

Solder up the encoder to the breakout, and wire up the NeoPixel ring. Then, wire up the breakout and ring as shown below. This is an example of wiring the rotary encoder breakout and a NeoPixel ring to a Feather M4 Express.

Info: 

- **NeoPixel ring data in** to **Feather A0**
- **NeoPixel ring ground** to **Feather GND**
- **NeoPixel ring power** to **Feather 3.3v**
- **Breakout ENCA** to **Feather D13**
- **Breakout ENCB** to **Feather D12**
- **Breakout COMA** to **Feather D11**
- **Breakout SW1** to **Feather D10**
- **Breakout SW2** to **Feather D9**
- **Breakout SW3** to **Feather D6**
- **Breakout SW4** to **Feather D5**
- **Breakout SW5** to **Feather SCL**
- **Breakout COMB** to **Feather SDA**

![circuitpython_ANO_encoder_NeoPixel_ring_Feather_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/104/932/medium640/circuitpython_ANO_encoder_NeoPixel_ring_Feather_bb.jpg?1633030965)

**The wiring shown here ties COMA/B to digital outputs set LOW in code (instead of connected to GND) to allow for the direct-to-Feather connection.**

## Encoder and NeoPixel Example

To use with CircuitPython, you need to first install the NeoPixel library, into the **lib** folder on your **CIRCUITPY** drive. Then you need to update **code.py** with the example script.

Thankfully, you can do this in one go. In the example below, click the **Download Project Bundle** button below to download the necessary libraries and the **code.py** file in a zip file. Extract the contents of the zip file, and copy the **entire**  **lib**  **folder** and the **code.py** file to your **CIRCUITPY** drive.

Your **CIRCUITPY/lib** folder should contain the following folder and file:

- **neopixel.mpy**

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/ANO_Rotary_Encoder/ANO_Rotary_Encoder_NeoPixel_CircuitPython_Example/code.py

Rotate the encoder to see the green NeoPixel move around the NeoPixel ring. Press the outer directional buttons to see a red LED light up in a corresponding location on the ring. Finally, click the center button to see the entire ring light up white.

First you import the necessary modules and library.

Next, you provide the pin assignments. The variables are in order of the breakout, left to right, to make it easier to provide the pins you used to connect the breakout to your microcontroller. Update this if you connected the breakout in a different way than the wiring diagram above. Remember, the COMA and COMB pins are not needed in the code, if you connected them to ground.

Then, you setup the hardware. First up, you setup the rotary encoder, and create the `last_position` variable and set it to `False`. Second, you create the `num_pixels` variable and set it to the number of pixels on whatever NeoPixel hardware you're using. In the case of this ring, there are `12` pixels. Then you setup the NeoPixel ring, and set `auto_write=False` so that you must call `show()` to send any updates to the pixels. This eliminates flickering that occurs when updates are otherwise spammed throughout the loop.

Next, you setup the two COM pins as outputs and set them low by making them `False`.

Then, you setup the buttons. There are 5 buttons, and setup for all of them is the same. So, instead of doing all of them individually, you do them all at the same time. First, you create a Python tuple of the button pins. Then you create an empty list to hold your setup buttons. Finally, you setup each button, and append it to the list until all setup has been completed. Now, `buttons` contains a list of button objects available for you to use in your code.

Inside the loop, you first create the `position` variable and set it equal to the initial encoder position. Then, you check it against the `last_position`, and if it's changed, print the position to the serial console.

Next, you clear the pixels so the rest of the pixel updates show up as expected with encoder rotation and button presses.

Then, you turn on one pixel green, that is equal to the rotary encoder position, mapped out to the possible values of 0 to 11 (12 total values, 12 total pixels). This means as you rotate the encoder past 12 or -12, the pixel continues to loop around the ring.

Next, you check the button states. First, you check to see if the center button is pressed, and if so, light up the LEDs white, and print to the serial console. Then you check each of the outside buttons, light up a red LED on the ring that corresponds to the location of the button, and print to the serial console.

Finally, you call `pixels.show()` to update the NeoPixels.

That's all there is to using the ANO rotary encoder with a NeoPixel ring using CircuitPython!

![](https://cdn-learn.adafruit.com/assets/assets/000/104/940/medium800thumb/circuitpython_ANOb_hooked_up.jpg?1633104753)

# ANO Directional Navigation and Scroll Wheel Rotary Encoder and Breakout

## Arduino

Using the ANO Directional Navigation and Scroll Wheel Rotary Encoder with Arduino involves wiring it up, installing the necessary libraries, and running the example code. This example also uses a NeoPixel ring. Therefore, you'll need to install the RotaryEncoder and Adafruit NeoPixel libraries.

## Additional Necessary Hardware
Featured
### NeoPixel Ring - 12 x 5050 RGB LED with Integrated Drivers

[NeoPixel Ring - 12 x 5050 RGB LED with Integrated Drivers](https://www.adafruit.com/product/1643)
Round and round and round they go! 12 ultra bright smart LED NeoPixels are arranged in a circle with 1.5" (37mm) 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/1643)
[Related Guides to the Product](https://learn.adafruit.com/products/1643/guides)
![Hand holding NeoPixel Ring with 12  x 5050 RGB LED, lit up rainbow](https://cdn-shop.adafruit.com/640x480/1643-00.jpg)

Featured
### Hook-up Wire Spool Set - 22AWG Solid Core - 6 x 25 ft

[Hook-up Wire Spool Set - 22AWG Solid Core - 6 x 25 ft](https://www.adafruit.com/product/1311)
Perfect for bread-boarding, free wiring, etc. This box contains 6 spools of solid-core wire. The wire is easy to solder to and when bent it keeps its shape pretty well. We like to have a few spools of this stuff around which is why this set is quite nice! We suggest picking up wire strippers...

In Stock
[Buy Now](https://www.adafruit.com/product/1311)
[Related Guides to the Product](https://learn.adafruit.com/products/1311/guides)
![Hook-up Wire Spool Set in box with 6 colorful wires coming out](https://cdn-shop.adafruit.com/640x480/1311-04.jpg)

## Wiring

First, solder the rotary encode to the breakout, and wires to the NeoPixel ring. Then, follow the example below to connect both to a Feather M4.

Info: 

- **NeoPixel ring data in** to **Feather A0**
- **NeoPixel ring ground** to **Feather GND**
- **NeoPixel ring power** to **Feather 3.3v**
- **Breakout ENCA** to **Feather D13**
- **Breakout ENCB** to **Feather D12**
- **Breakout COMA** to **Feather D11**
- **Breakout SW1** to **Feather D10**
- **Breakout SW2** to **Feather D9**
- **Breakout SW3** to **Feather D6**
- **Breakout SW4** to **Feather D5**
- **Breakout SW5** to **Feather SCL**
- **Breakout COMB** to **Feather SDA**

![circuitpython_ANO_encoder_NeoPixel_ring_Feather_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/104/933/medium640/circuitpython_ANO_encoder_NeoPixel_ring_Feather_bb.jpg?1633035773)

**The wiring shown here ties COMA/B to digital outputs set LOW in code (instead of connected to GND) to allow for the direct-to-Feather connection.**

## Library Installation

You can install the **RotaryEncoder** and **NeoPixel** libraries for Arduino using the Library Manager in the Arduino IDE.

![](https://cdn-learn.adafruit.com/assets/assets/000/104/934/medium800/circuitpython_Arduino_Open_Library_Manager.png?1633036049)

Click the&nbsp; **Manage Libraries ...** menu item, search for **RotaryEncoder** ,&nbsp;and select the **RotaryEncoder** library (by Matthias Hertel):

![](https://cdn-learn.adafruit.com/assets/assets/000/104/935/medium800/circuitpython_ANO_RotaryEncoder_Arduino_library_install.png?1633036108)

Then search for **NeoPixel** and select the **Adafruit NeoPixel** library:

![](https://cdn-learn.adafruit.com/assets/assets/000/104/936/medium800/circuitpython_ProxT_NeoPixel_Arduino_Library_install.png?1633036174)

## Load Example

Click **Download Project Bundle** to download the example to your computer. Open the **ANO\_Rotary\_Encoder\_NeoPixel\_Arduino\_Example.ino** file in the Arduino IDE.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/ANO_Rotary_Encoder/ANO_Rotary_Encoder_NeoPixel_Arduino_Example/ANO_Rotary_Encoder_NeoPixel_Arduino_Example.ino

After opening the demo file, upload to your Arduino wired up to the encoder. Once you upload the code, you will see the rotary encoder values when you rotate it being printed when you open the Serial Monitor ( **Tools-\>Serial Monitor** ) at **115200 baud** , similar to this:

![](https://cdn-learn.adafruit.com/assets/assets/000/104/941/medium800/circuitpython_ANO_Arduino_Serial_output.png?1633105051)

Rotate the encoder to see the green NeoPixel move around the NeoPixel ring. Press the outer directional buttons to see a red LED light up in a corresponding location on the ring. Finally, click the center button to see the entire ring light up white.

![](https://cdn-learn.adafruit.com/assets/assets/000/104/943/medium800thumb/circuitpython_ANOb_hooked_up.jpg?1633105280)

# ANO Directional Navigation and Scroll Wheel Rotary Encoder and Breakout

## Downloads

## Files

- [Rotary Encoder Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/104/942/original/tsw.pdf?1633105183)
- [Rotary Encoder Breakout Fritzing Object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20ANO%20Rotary%20Navigation%20Encoder%20Breakout.fzpz)
- [Rotary Encoder Breakout EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-ANO-Rotary-Navigation-Encoder-Breakout-PCB)
- [3D Models on GitHub](https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/5221%20ANO%20Rotary%20Encoder)

# Schematic and Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/104/944/medium800/circuitpython_ANO_sch.png?1633106320)

![](https://cdn-learn.adafruit.com/assets/assets/000/104/945/medium800/circuitpython_ANO_fab_print.png?1633106332)


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

Out of 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 Breakout PCB

[Adafruit ANO Rotary Navigation Encoder Breakout PCB](https://www.adafruit.com/product/5221)
The ANO rotary encoder wheel is a 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 nifty kit, but the pin-out is a little...

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

[Adafruit ANO Rotary Navigation Encoder Breakout](https://www.adafruit.com/product/6311)
The ANO rotary encoder wheel is a 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 nifty kit, but the pin-out is a little...

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

## Guide Products

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

[NeoPixel Ring - 12 x 5050 RGB LED with Integrated Drivers](https://www.adafruit.com/product/1643)
Round and round and round they go! 12 ultra bright smart LED NeoPixels are arranged in a circle with 1.5" (37mm) 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/1643)
[Related Guides to the Product](https://learn.adafruit.com/products/1643/guides)
### Hook-up Wire Spool Set - 22AWG Solid Core - 6 x 25 ft

[Hook-up Wire Spool Set - 22AWG Solid Core - 6 x 25 ft](https://www.adafruit.com/product/1311)
Perfect for bread-boarding, free wiring, etc. This box contains 6 spools of solid-core wire. The wire is easy to solder to and when bent it keeps its shape pretty well. We like to have a few spools of this stuff around which is why this set is quite nice! We suggest picking up wire strippers...

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

## Related Guides

- [Tiny Pod - BLE Rotary Encoder for iWatch](https://learn.adafruit.com/ano-pod.md)
- [NeoPixel Novelty Cufflinks with Scrolling Text](https://learn.adafruit.com/neopixel-novelty-cufflinks-with-scrolling-text.md)
- [No-Code Room Occupancy Status ](https://learn.adafruit.com/no-code-room-occupancy-status.md)
- [Blahaj Alarm and Lamp](https://learn.adafruit.com/blahaj-alarm.md)
- [Yoga Pose Chime](https://learn.adafruit.com/yoga-pose-chime.md)
- [Data Logging with Feather and CircuitPython](https://learn.adafruit.com/data-logging-with-feather-and-circuitpython.md)
- [Neopixel Jewel 10 Minute Necklace](https://learn.adafruit.com/10-minute-neopixel-necklace.md)
- [Reindeer Mask with Animated Eyes](https://learn.adafruit.com/reindeer-mask-with-animated-eyes.md)
- [NeoPixel Rotary Fidget](https://learn.adafruit.com/neopixel-rotary-fidget.md)
- [Fog Machine with Motion Sensor and Adafruit IO](https://learn.adafruit.com/fog-machine-remote-trigger.md)
- [Burning Fire Wizard Staff](https://learn.adafruit.com/burning-fire-wizard-staff.md)
- [Robotic Xylophone with Adafruit Grand Central](https://learn.adafruit.com/robotic-xylophone-with-circuit-python.md)
- [Bluefruit Luminary Lanterns with Capacitive Touch](https://learn.adafruit.com/bluefruit-luminary-lanterns-with-capacitive-touch.md)
- [reef-pi Guide 3: Temperature Controller](https://learn.adafruit.com/reef-pi-guide-3-temperature-controller.md)
- [What is Web MIDI & BLE MIDI?](https://learn.adafruit.com/web-ble-midi.md)
