# Adafruit NeoKey 5x6 Ortho Snap-Apart

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/103/399/medium800/adafruit_products_NKOSA_back.jpg?1626293985)

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 (that's a fancy word for gridded) key matrices. Instead of hand soldering together a custom matrix of NeoKey socket breakouts, the **Adafruit** &nbsp; **NeoKey 5x6 Ortho Snap-Apart Mechanical Key Switches with&nbsp;NeoPixel** has 30 key switches that can be snapped apart to make any size grid.

That's right! Even though it comes as 5x6, you can turn it into 2x3, 1x6, 4x3...whatever you wish, and it will work just the way you expect. The little break-apart tabs have traces running through them that pass the power, NeoPixel, and keymatrix lines up and down.

![](https://cdn-learn.adafruit.com/assets/assets/000/103/400/medium800/adafruit_products_NKOSA_top.jpg?1626293996)

Each 'sub-key' is the same - with a column and row line that is diode protected. For whatever grid size you eventually choose, connect a digital IO pin from your microcontroller to each of the outer rows and columns. With the diode, you don't have to worry about key ghosting.

If you want to add glowy goodness, that's even easier. Each key also has a single reverse-mount NeoPixel pointing up through the spot where many switches would have an LED to shine through. Connect 3 to 5V power to any of the + and - pins on the grid, and connect a single digital IO line to the beginning of the 'NeoPixel snake' that winds its way through the matrix. A weak 2.2K pass-through resistor will shunt data through at the end of each row, so you don't have to do any jumpering unless the matrix is not-rectangular.

![](https://cdn-learn.adafruit.com/assets/assets/000/103/401/medium800/adafruit_products_NKOSA_top_angle.jpg?1626294006)

Every breakout has a Kailh socket, which means you can plug in any MX-compatible switch instead of soldering it in. You may need a little glue to keep the switch in place: hot glue or a dot of epoxy worked fine for us. The sub-keys are spaced 0.75" apart for compact keebing. There's large 0.125" mounting holes at the corners of each key for easy mounting to a backplane.

**Please note,** &nbsp; **each order comes with one sheet of assembled PCBs that can be broken apart - we include top and bottom railing bits to help keep it nice and flat during shipment.** Once the grid is broken, you _could_ jumper the breakout pads together to re-connect but it won't be very fun. Mechanical switches and keycaps are&nbsp;not included! Use any MX-compatible switch: Kailh, Gateron, etc all work!

**Note: The Kailh Low Profile switches will not work! They have a different footprint.**

# Adafruit NeoKey 5x6 Ortho Snap-Apart

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/103/432/medium800/adafruit_products_NKOSA_pinouts_back_full.jpg?1626369742)

![](https://cdn-learn.adafruit.com/assets/assets/000/103/433/medium800/adafruit_products_NKOSA_pinouts_full.jpg?1626369770)

Each of the keys on the NeoKey 5x6 Snap-Apart are the same. The board can be snapped apart to make a matrix of any size 5x6 or smaller. The traces run through the snap-apart bits and pass the power, NeoPixel, and keymatrix lines up and down. Below are the pinouts and features of each individual key.

## Key Sockets
Each key has a **Cherry**  **MX or compatible key switch socket**. Simply press any compatible key switch into the socket from the top of the board. You can add a dab of glue to keep the switch in place; hot glue or a dot of epoxy will work.

![adafruit_products_NKOSA_pinouts_top_key_sockets.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/438/medium640/adafruit_products_NKOSA_pinouts_top_key_sockets.jpg?1626371507)

![adafruit_products_NKOSA_pinouts_key_sockets.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/439/medium640/adafruit_products_NKOSA_pinouts_key_sockets.jpg?1626371529)

## NeoPixel LEDs
At the bottom of each key is a **NeoPixel LED**. These LEDs are r[everse mount,](http://www.adafruit.com/product/4960) meaning they're mounted on the back of the board to shine through to the top. This allows for the key switches to sit flat while still providing rainbow goodness! The pins labeled I or IN are for sending the NeoPixels data. The pins labeled O or OUT are for wiring to another IN pin (to connect a separated matrix, or a second 5x6 sheet).

![adafruit_products_NKOSA_pinouts_NeoPixel.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/441/medium640/adafruit_products_NKOSA_pinouts_NeoPixel.jpg?1626378627)

![adafruit_products_NKOSA_pinouts_top_NeoPixel.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/442/medium640/adafruit_products_NKOSA_pinouts_top_NeoPixel.jpg?1626378646)

The NeoPixel LEDs are in a zigzag order across the board, beginning at the upper left corner and ending in the lower right corner. If using the full sheet, the "strip" follows the arrows in the image below.

![](https://cdn-learn.adafruit.com/assets/assets/000/103/584/medium800/adafruit_products_NKOSA_NeoPixel_order.jpg?1627060781)

## Pins
On the top and bottom of each key are the **COL (****column) **** pins**.

![adafruit_products_NKOSA_pinouts_col_pins.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/559/medium640/adafruit_products_NKOSA_pinouts_col_pins.jpg?1626906168)

![adafruit_products_NKOSA_pinouts_top_col_pins.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/560/medium640/adafruit_products_NKOSA_pinouts_top_col_pins.jpg?1626906194)

On the left and right of each key are the **ROW (r****ow) pins**.

![adafruit_products_NKOSA_pinouts_row_pins.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/561/medium640/adafruit_products_NKOSA_pinouts_row_pins.jpg?1626906224)

![adafruit_products_NKOSA_pinouts_top_row_pins.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/562/medium640/adafruit_products_NKOSA_pinouts_top_row_pins.jpg?1626906261)

The **I** and **IN** pins are the **NeoPixel data in** pins for sending data to the NeoPixels from a microcontroller, etc.

![adafruit_products_NKOSA_pinouts_NeoPixel_IN.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/563/medium640/adafruit_products_NKOSA_pinouts_NeoPixel_IN.jpg?1626906294)

![adafruit_products_NKOSA_pinouts_top_NeoPixel_IN.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/564/medium640/adafruit_products_NKOSA_pinouts_top_NeoPixel_IN.jpg?1626906311)

The **O** and **OUT** pins are the **NeoPixel data out** pins, for connecting to the data in pin on another set of NeoPixels.

![adafruit_products_NKOSA_pinouts_NeoPixel_OUT.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/565/medium640/adafruit_products_NKOSA_pinouts_NeoPixel_OUT.jpg?1626906382)

![adafruit_products_NKOSA_pinouts_top_NeoPixel_OUT.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/566/medium640/adafruit_products_NKOSA_pinouts_top_NeoPixel_OUT.jpg?1626906409)

On the top and bottom of each key are the **VIN** **(power) pins**.

![adafruit_products_NKOSA_pinouts_power_pins.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/567/medium640/adafruit_products_NKOSA_pinouts_power_pins.jpg?1626906527)

![adafruit_products_NKOSA_pinouts_top_power_pins.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/568/medium640/adafruit_products_NKOSA_pinouts_top_power_pins.jpg?1626906557)

The bottom pin on each side of the key are the **GND** **(ground) pins**.

![adafruit_products_NKOSA_pinouts_ground_pins.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/569/medium640/adafruit_products_NKOSA_pinouts_ground_pins.jpg?1626906609)

![adafruit_products_NKOSA_pinouts_top_ground_pins.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/571/medium640/adafruit_products_NKOSA_pinouts_top_ground_pins.jpg?1626906670)

# Adafruit NeoKey 5x6 Ortho Snap-Apart

## CircuitPython

The `keypad` module makes using the NeoKey 5x6 Ortho Snap-Apart with CircuitPython super simple. Combined with the [Adafruit CircuitPython NeoPixel](https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel) library, you can easily write Python code to read key presses and light up the NeoPixel LEDs.

The following example is written for the Adafruit Feather, but you can use the NeoKey Snap with any CircuitPython compatible microcontroller as long as it has enough pins available. Depending on the configuration you choose, you'll need a maximum of twelve IO pins (eleven pins for the keys and one pin for the NeoPixels), a ground pin, and a power pin.

## CircuitPython Wiring

The pins are explained on the Pinouts page, but here is a quick summary. The **COL** pins across the tops of the keys are the column pins. The **ROW** pins across the sides of the keys are the row pins. The **I** or **IN** pins are input for the NeoPixels. The **O** or **OUT** pins are NeoPIxel output (for connecting to the input on another set of NeoPixels).

You'll want to solder wires (leave them long enough to connect to a breadboard or solder to a microcontroller directly!) to the following pins, **viewing the board from the front** : all of the **COL** pins along the top, all of the&nbsp; **ROW** pins along the left side, the **I** pin in the top left, and any **VIN** and **GND**.

Connect the NeoKey 5x6 Ortho Snap-Apart sheet to your board exactly as follows. The following shows it wired to a Feather RP2040, but this exact setup will work with any Adafruit Feather. For the purposes of this diagram, references to column pin numbers are 1 to 6, left to right, and references to row pin numbers are 1 to 5, top to bottom.

**The diagram shows the NeoKey Snap from the front, e.g. the side to which the keys are socketed.** The pin labels are on the back of the NeoKey Snap sheet.

- **Board 3V** to **NeoKey Snap VIN**
- **Board GND** to **NeoKey Snap GND**
- **Board D5** to **NeoKey Snap IN (I) top left**
- **Board D13** to **NeoKey Snap COL 1**
- **Board D12** to **NeoKey Snap COL 2**
- **Board D11** to **NeoKey Snap COL 3**
- **Board D10** to **NeoKey Snap COL 4**
- **Board D9** to **NeoKey Snap COL 5**
- **Board D6** to **NeoKey Snap COL 6**
- **Board D4** to **NeoKey Snap ROW 1**
- **Board A3** to **NeoKey Snap ROW 2**
- **Board A2** to **NeoKey Snap ROW 3**
- **Board A1** to **NeoKey Snap ROW 4**
- **Board A0** to **NeoKey Snap ROW 5**

![adafruit_products_NKOSA_full_sheet_Feather_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/558/medium640/adafruit_products_NKOSA_full_sheet_Feather_bb.jpg?1626901919)

The number of available GPIO pins on your microcontroller determines how many keys you can support. The RP2040 has 23 GPIO pins, so in theory, the biggest key matrix it could support would be an 11x11 matrix and still utilise the NeoPixels. That's 121 keys in an 11x11 matrix, in which you would need 22 GPIO pins to handle 11 rows and 11 columns.

## CircuitPython Usage

To demonstrate using NeoKey 5x6 Ortho Snap-Apart sheet with CircuitPython, you'll install the necessary library, update your code, and then optionally [connect to the serial console](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console) to see information printed out.

To use a&nbsp; 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**.

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.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/NeoKey_5x6_Ortho_Snap-Apart/Full_sheet_NeoPixel_demo/code.py

Now, press a key to see the associated LED light up! If you connect to the serial console, you'll see the key event printed out when you press or release a key.

After importing the necessary library and modules, you configure the number of columns and rows. For the full sheet, there are 6 columns and 5 rows.

Then, you setup the NeoPixels and the keys. There are 30 NeoPixels, and the brightness is set to 30%. The keys use the `KeyMatrix` feature of the `keypad` module. `KeyMatrix` expects a tuple of `row_pins`, and a tuple of `column_pins`. For the NeoKey Snap, you'll also want to set `columns_to_anodes=False`.

Next, is a helper function to map the NeoPixels to the keys. The key numbers read from left to right across each row from top to bottom. The NeoPixels begin in the upper left, and then alternate direction across each row. Simply using the raw NeoPixel number won't match the key number! Therefore, you include a helper function to map the NeoPixels to the appropriate key.

Before the loop, you turn off the NeoPixels by setting them to `(0, 0, 0)` so the program begins with the NeoPixels off.

Inside the loop, we begin by getting the key events. Next, we check to see if there has been a key event, e.g. a key has been pressed or released. If so, we print the key event to the serial console, and then check to see if the key event is a key press event. If it is a press event, you light up the associated pixel red using the helper function to identify the pixel number based on key number. Otherwise, you turn all the pixels off.

That's all there is to reading key events and lighting up the associated NeoPixel LED using CircuitPython!

## Snap it!

The clever design of the NeoKey Snap is that it is made to be snapped apart! This example shows you how to make a 2x4 keypad. The wiring is essentially the same, except with less wires. Carefully break off the top and bottom bar of PCB (the bits with the product name and "Sold As Single Sheet" written on them). Then, snap off a full row. Finally, snap off two columns. Ta-da! 2x4 keypad.

Wire it up as follows.

- **Board 3V** to **NeoKey Snap VIN**
- **Board GND** to **NeoKey Snap GND**
- **Board D5** to **NeoKey Snap IN (I) top left**
- **Board D13** to **NeoKey Snap COL 1**
- **Board D12** to **NeoKey Snap COL 2**
- **Board D4** to **NeoKey Snap ROW 1**
- **Board A3** to **NeoKey Snap ROW 2**
- **Board A2** to **NeoKey Snap ROW 3**
- **Board A1** to **NeoKey Snap ROW 4**

![adafruit_products_NKOSA_2x4_Feather_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/573/medium640/adafruit_products_NKOSA_2x4_Feather_bb.jpg?1626986567)

Then, simply change the number of `COLUMNS` and `ROWS` at the top of the file so `COLUMNS = 2` and `ROWS = 4`.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/NeoKey_5x6_Ortho_Snap-Apart/2x4_NeoPixel_demo/code.py

Now, press a key to see the associated LED light up! If you connect to the serial console, you'll see the key event printed out when you press or release a key.

That's all there is to customising the size of your NeoKey Ortho Snap-Apart key matrix!

# Adafruit NeoKey 5x6 Ortho Snap-Apart

## keypad docs

# Adafruit NeoKey 5x6 Ortho Snap-Apart

## NeoPixel Docs

# Adafruit NeoKey 5x6 Ortho Snap-Apart

## Arduino

Using the Adafruit NeoKey 5x6 Ortho Snap-Apart with Arduino requires the Adafruit Keypad library and the Adafruit NeoPixel library.

First, you'll need to wire it up to your Arduino-compatible microcontroller.

## Wiring

The following example uses the Adafruit Feather RP2040, but you can use any Arduino-compatible microcontroller. Simply update the pins in the example to match your wiring. Pins below are listed to both match the Feather top silk and the Arduino pin numbering.

- **Feather 3V** to **NeoKey Snap**  **VIN**. You should connect VIN to the **Arduino 5V** &nbsp;if you are running a **5V** board (Arduino Uno, etc.)
- **Feather GND** to **NeoKey Snap GND**
- **Feather D5 (GP7)** to **NeoKey Snap IN (I) top left**
- **Feather D13 (GP13)** to **NeoKey Snap COL 1**
- **Feather D12 (GP12)** to **NeoKey Snap COL 2**
- **Feather D11 (GP11)** to **NeoKey Snap COL 3**
- **Feather D10 (GP10)** to **NeoKey Snap COL 4**
- **Feather D9 (GP9)** to **NeoKey Snap COL 5**
- **Feather D6 (GP8)** to **NeoKey Snap COL 6**
- **Feather D4 (GP6)** to **NeoKey Snap ROW 1**
- **Feather A3 (GP29)** to **NeoKey Snap ROW 2**
- **Feather A2 (GP28)** to **NeoKey Snap ROW 3**
- **Feather A1 (GP27)** to **NeoKey Snap ROW 4**
- **Feather A0 (GP26)** to **NeoKey Snap ROW 5**

![adafruit_products_NKOSA_full_sheet_Feather_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/103/574/medium640/adafruit_products_NKOSA_full_sheet_Feather_bb.jpg?1626987094)

## Library Installation
You can install the Adafruit Keypad and NeoPixel libraries for Arduino using the Library Manager in the Arduino IDE.

![](https://cdn-learn.adafruit.com/assets/assets/000/103/575/medium800/adafruit_products_Arduino_Open_Library_Manager.png?1626987372)

Click the&nbsp; **Manage Libraries ...** menu item, search for&nbsp; **Adafruit Keypad** ,&nbsp;and select the&nbsp; **Adafruit**  **Keypasd** library:

![](https://cdn-learn.adafruit.com/assets/assets/000/103/576/medium800/adafruit_products_Adafruit_Keypad_Arduino_Library_Install.png?1626987424)

Search for **Adafruit NeoPixel** ,&nbsp;and select the&nbsp; **Adafruit**  **NeoPixel** library:

![](https://cdn-learn.adafruit.com/assets/assets/000/103/577/medium800/adafruit_products_Arduino_install_NeoPixel.png?1626987458)

## Example Code

Save the following file to your computer, then upload it to your Arduino wired to your NeoKey Snap.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/NeoKey_5x6_Ortho_Snap-Apart/Ortho5x6Demo/Ortho5x6Demo.ino

Press any key to see the associated NeoPixel LED light up in a rainbow swirl!

Open the **Serial Monitor** at **115200 baud**. Press the keys to see information printed for each key press.

![](https://cdn-learn.adafruit.com/assets/assets/000/103/578/medium800/adafruit_products_NKOSA_Arduino_Serial_output.png?1626988040)

That's all there is to using the NeyKeEy 5x6 Ortho Snap-Apart with Arduino!

# Adafruit NeoKey 5x6 Ortho Snap-Apart

## Keypad Docs

# Adafruit NeoKey 5x6 Ortho Snap-Apart

## NeoPixel Docs

# Adafruit NeoKey 5x6 Ortho Snap-Apart

## Downloads

## Files

- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-NeoKey-Snap-Apart-PCB)

# Schematic
![](https://cdn-learn.adafruit.com/assets/assets/000/103/427/medium800/adafruit_products_NKOSA_sch.png?1626365765)

## Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/103/657/medium800/adafruit_products_NKOSA_fab_print.png?1627419405)

![](https://cdn-learn.adafruit.com/assets/assets/000/103/553/medium800/adafruit_products_NKOSA_top_high_res.jpg?1626888329)

![](https://cdn-learn.adafruit.com/assets/assets/000/103/554/medium800/adafruit_products_NKOSA_back_high_res.jpg?1626888340)


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

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

## Featured Products

### Kailh Mechanical Key Switches - 10 packs - Cherry MX Compatible

[Kailh Mechanical Key Switches - 10 packs - Cherry MX Compatible](https://www.adafruit.com/product/4996)
For crafting your very own custom keyboard, these **&nbsp;Kailh mechanical key switches** &nbsp;are deeee-luxe!

Come&nbsp;in a pack of 10 switches, plenty to make a small keyboard, or grab a few packs to build a full keyboard.

- Use these with our&nbsp;<a...></a...>

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

## Related Guides

- [DIY Decorative Resin Keycaps](https://learn.adafruit.com/diy-decorative-resin-keycaps.md)
- [Deluxe 4x4 NeoPixel Keypad](https://learn.adafruit.com/deluxe-4x4-neopixel-neokey-keypad.md)
- [Split Ortho Keyboard with TCA8418 Matrix Expanders](https://learn.adafruit.com/split-ortho-keyboard.md)
- [Numpad 4000 Mechanical Keyswitch Data Entry Device](https://learn.adafruit.com/numpad-4000-mechanical-keyswitch-data-entry-device.md)
- [4x12 Ortho Mechanical Keyboard](https://learn.adafruit.com/4x12-ortho-mechanical-keyboard.md)
- [CNC Rotary Macropad](https://learn.adafruit.com/cnc-rotary-macropad.md)
- [Adafruit USB Host BFF](https://learn.adafruit.com/adafruit-usb-host-bff.md)
- [Adafruit LPS28 Pressure Sensor](https://learn.adafruit.com/adafruit-lps28-pressure-sensor.md)
- [NeoKey Socket Breakout with NeoPixel for MX and CHOC Key Switches](https://learn.adafruit.com/neokey-breakout.md)
- [Adafruit 2.0" 320x240 Color IPS TFT Display](https://learn.adafruit.com/2-0-inch-320-x-240-color-ips-tft-display.md)
- [DC & USB Boarduino Kits](https://learn.adafruit.com/boarduino-kits.md)
- [Adafruit 16-channel PWM/Servo Shield](https://learn.adafruit.com/adafruit-16-channel-pwm-slash-servo-shield.md)
- [Adafruit TSMP96000 IR Receiver Breakout](https://learn.adafruit.com/adafruit-tsmp96000-ir-receiver-breakout.md)
- [Adafruit WebIDE](https://learn.adafruit.com/webide.md)
- [Adafruit I2S Amplifier BFF](https://learn.adafruit.com/i2s-amplifier-bff.md)
