# Adafruit NeoKey BFF

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/118/502/medium800thumb/adafruit_products_5695-00_1.jpg?1676402068)

Our QT Py boards are a great way to make very small microcontroller projects that pack a ton of power - and now we have a way for you to quickly add a nice mechanical key that also can glow any color of the rainbow.

We call this the **Adafruit NeoKey BFF** - a "Best Friend Forever". When you were a kid you may have learned about the "buddy" system, well this product is kinda like that! A board that will watch your QT Py's back and give it more capabilities.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/271/medium800/components_5695-05.jpg?1691029177)

This PCB is designed to fit onto the back of any QT Py or Xiao board; it can be soldered into place or use pin and socket headers to make it removable. Onboard is 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 board also comes with a single reverse-mount NeoPixel pointing up through the spot where many switches would have an LED to shine through.

![](https://cdn-learn.adafruit.com/assets/assets/000/118/547/medium800/components_edited_P1400026.jpg?1676478176)

We include some header that you can solder to your QT Py. [You can also pick up an ItsyBitsy short female header kit to make it removable but compact](https://www.adafruit.com/product/4174); you'll just need to trim down the headers to 7 pins long.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/272/medium800/components_5695-03.jpg?1691029147)

The key-switch is default connected to **A2** and the NeoPixel to **A3** &nbsp;but there are onboard jumpers you can cut to re-configure if you desire.

**QT Py is not included**.

**Please note, each order comes with one assembled PCB and break-off header**. A mechanical switch and key cap are not included! Use any MX-compatible switch: Kailh, Gateron, etc all work!

# Adafruit NeoKey BFF

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/118/503/medium800/adafruit_products_double.jpg?1676403727)

- The default switch pin is **A2**
- The default NeoPixel pin is **A3**

## NeoPixel Jumper

- **A3** - This jumper is located on the back of the board, below the NeoPixel LED, and is labeled **A3**. If you cut this jumper, it disconnects the NeoPixel data input pin from pin **A3** and you can then connect the NeoPixel to another available pin by soldering a wire.

## NeoPixel Pad

- **Neo** - This solder pad is located at the bottom of the board, to the right of the **BFF NeoKey** &nbsp;silk text and the NeoPixel Jumper. It is labeled **Neo**. This pad is attached to the NeoPixel data input pin and can be used to wire the NeoPixel to a different pin if the NeoPixel jumper is cut to disconnect it from pin **A3**.

## MX Key Jumper

- **A2** - This jumper is located on the back of the board, next to the key socket and is labeled **A2**. If you cut this jumper, it disconnects the switch output from pin **A2** and you can then connect the NeoPixel to another available pin by soldering a wire.

## MX Key Pad

- **Sw** - This solder pad is located at the bottom of the board between the **Sw** silk text and **BFF NeoKey** silk text. It is labeled **Sw**. This pad is attached to the key output pin and can be used to wire the key to a different pin if the MX key jumper is cut to disconnect it from pin **A2**.

# Adafruit NeoKey BFF

## CircuitPython

It's easy to use the **NeoKey BFF** with CircuitPython and the[Adafruit\_CircuitPython\_NeoPixel](https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel) module. This module allows you to easily write Python code that lets you control NeoPixels. A second example will use the[Adafruit\_CircuitPython\_HID](https://github.com/adafruit/Adafruit_CircuitPython_HID) module to let you write Python code to build HID devices, like keyboards.

## CircuitPython Microcontroller Wiring

Plug a NeoKey BFF into your QT Py or Xiao form factor board exactly as shown below. Here's an example of connecting a QT Py RP2040 to the BFF.

Connect the QT Py RP2040 with pin headers into the NeoKey BFF with socket headers. They should be plugged in with the backs of the boards facing each other.

For more information on soldering socket headers, [check out this Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers).

![adafruit_products_edited_P1400025.jpg](https://cdn-learn.adafruit.com/assets/assets/000/118/541/medium640/adafruit_products_edited_P1400025.jpg?1676411731)

Then, plug an MX compatible key into the Kailh socket. You can add a keycap for extra flair.

![adafruit_products_edited_P1400026.jpg](https://cdn-learn.adafruit.com/assets/assets/000/118/542/medium640/adafruit_products_edited_P1400026.jpg?1676411839)

## CircuitPython Usage

Connect your QT Py to your computer via a known good USB data+power cable. The board should show up in your File Explorer/Finder (depending on your operating system) as a thumb drive named **CIRCUITPY**.

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

Thankfully, we 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 folders and files:

- **/adafruit\_hid**
- **neopixel.mpy**

## Simple Example
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/IoT_Button_BFF_Examples/CircuitPython_Basic_Example/code.py

Once everything is saved to the&nbsp; **CIRCUITPY** &nbsp;drive, you can press and hold the MX key on the BFF to make the rainbow animation show on the NeoPixel. If you release the key, the NeoPixel will stop showing the animation.

![](https://cdn-learn.adafruit.com/assets/assets/000/118/507/medium800thumb/adafruit_products_5695-00_1.jpg?1676406298)

## One Key Keyboard Example
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/NeoKey_BFF_Examples/CP_Keyboard_Example/code.py

In this example, the MX key sends the computer shortcut for Find in a browser (Ctrl + F) every time its pressed. You can change the shortcut by editing the `key` and `modifier_key` variables. The NeoPixel lights up green every time you press the key. When you release the key, the NeoPixel turns off. You can change the NeoPixel color by updating the `pixel_color` RGB value.

# Adafruit NeoKey BFF

## Python Docs

# Adafruit NeoKey BFF

## Arduino

Using the NeoKey BFF with Arduino involves plugging the breakout into your Arduino-compatible QT Py or Xiao form factor board, installing the&nbsp;[Adafruit\_NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel) library, and running the provided example code.

Warning: 

## Wiring

Plug a NeoKey BFF into your QT Py or Xiao form factor board exactly as shown below. Here's an example of connecting a QT Py RP2040 to the BFF.

Connect the QT Py RP2040 with pin headers into the NeoKey BFF with socket headers. They should be plugged in with the backs of the boards facing each other.

For more information on soldering socket headers, [check out this Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers).

![adafruit_products_edited_P1400025.jpg](https://cdn-learn.adafruit.com/assets/assets/000/118/544/medium640/adafruit_products_edited_P1400025.jpg?1676411218)

Then, plug an MX compatible key into the Kailh socket.&nbsp;

![adafruit_products_edited_P1400026.jpg](https://cdn-learn.adafruit.com/assets/assets/000/118/545/medium640/adafruit_products_edited_P1400026.jpg?1676411423)

## Library Installation

You can install the&nbsp; **Adafruit NeoPixel** library&nbsp;for Arduino using the Library Manager in the Arduino IDE.

![](https://cdn-learn.adafruit.com/assets/assets/000/118/524/medium800/adafruit_products_Arduino_Open_Library_Manager.png?1676409085)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/118/525/medium800/adafruit_products_libManage.jpg?1676409124)

Info: 

## Example Keyboard Code
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/NeoKey_BFF_Examples/Arduino_NeoKey_Example/Arduino_NeoKey_Example.ino

Upload the sketch to your board. When you press the MX key, the text "Hello World!" will be typed. Additionally, the NeoPixel will light-up red. When the key is released, the NeoPixel will turn off.

# Adafruit NeoKey BFF

## Arduino Keyboard Docs

# Adafruit NeoKey BFF

## Downloads

## Files

- [NeoPixel Datasheet](https://cdn-shop.adafruit.com/product-files/5666/5666_neopixel_datasheet.pdf)
- [Kailh Socket Datasheet](https://cdn-shop.adafruit.com/product-files/4958/Datasheet.jpeg)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-NeoKey-BFF-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20NeoKey%20BFF.fzpz)

## Schematic and Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/118/504/medium800/adafruit_products_schem.png?1676404919)

![](https://cdn-learn.adafruit.com/assets/assets/000/118/505/medium800/adafruit_products_fab.png?1676404926)


## Primary Products

### Adafruit NeoKey BFF for Mechanical Key Add-On for QT Py and Xiao

[Adafruit NeoKey BFF for Mechanical Key Add-On for QT Py and Xiao](https://www.adafruit.com/product/5695)
Our QT Py boards are a great way to make very small microcontroller projects that pack a ton of power - and now we have a way for you to quickly add a nice mechanical key that also can glow any color of the rainbow.&nbsp;

We call this the **Adafruit NeoKey&nbsp;BFF** - a...

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

## Related Guides

- [One Key: Single Button Bluetooth Keyboard](https://learn.adafruit.com/onekey.md)
- [MagicLight Bulb Color Mixer with Circuit Playground Bluefruit](https://learn.adafruit.com/magiclight-bulb-mixer.md)
- [Adafruit bq25185 USB / DC / Solar Lithium Ion/Polymer Charger](https://learn.adafruit.com/adafruit-bq25185-usb-dc-solar-lithium-ion-polymer-charger.md)
- [Adafruit 2.13" Monochrome E-Ink Bonnet for Raspberry Pi](https://learn.adafruit.com/2-13-in-e-ink-bonnet.md)
- [Adafruit VEML7700 Ambient Light Sensor](https://learn.adafruit.com/adafruit-veml7700.md)
- [Adafruit STEMMA Non-Latching Mini Relay](https://learn.adafruit.com/adafruit-stemma-non-latching-mini-relay.md)
- [Adafruit SEN6x Breakout](https://learn.adafruit.com/adafruit-sen6x-breakout.md)
- [Adafruit Feather RP2350 with HSTX](https://learn.adafruit.com/adafruit-feather-rp2350.md)
- [LED Glasses Custom Animated Graphics with Sprites](https://learn.adafruit.com/led-glasses-custom-animated-graphics-with-sprites.md)
- [Adafruit 2.13" 250x122 Quad-Color eInk](https://learn.adafruit.com/adafruit-2-13-250x122-quad-color-eink.md)
- [Adafruit INA3221 Breakout](https://learn.adafruit.com/adafruit-ina3221-breakout.md)
- [CircuitPython BLE Multi-Temperature Monitoring](https://learn.adafruit.com/circuitpython-multi-temperature-ble-monitoring.md)
- [Adafruit ANO Rotary Encoder to I2C Adapter](https://learn.adafruit.com/adafruit-ano-rotary-navigation-encoder-to-i2c-stemma-qt-adapter.md)
- [Adafruit Metro M7 1011 with AirLift](https://learn.adafruit.com/adafruit-metro-m7-with-airlift.md)
- [Bluetooth Remote Control for the Lego Droid Developer Kit](https://learn.adafruit.com/bluetooth-remote-for-lego-droid.md)
