# Adafruit IoT Button with NeoPixel BFF

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/117/538/medium800thumb/components_5666-04_1.jpg?1673552622)

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 chunky 12mm tactile button with a NeoPixel. It's an excellent way to create simple 'IoT Button' type projects with basic interactivity.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/257/medium800/adafruit_products_5666-03.jpg?1690987256)

We call this the **Adafruit IoT Button with NeoPixel 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/260/medium800/adafruit_products_5666-02.jpg?1690987509)

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 12mm tactile button with a nice large actuator, above is a 3.5mm RGB NeoPixel.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/264/medium800/adafruit_products_5666-01.jpg?1690987607)

We include some header that you can solder to your QT Py. [You can also pick up an Itsy Bitsy 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.

- Comes as an assembled and tested PCB
- For any QT Py or Xiao boards
- Tactile switch momentarily connects **A2** to ground when pressed - can cut/re-wire an onboard jumper to change pins if desired. Don't forget to enable an internal pull-up resistor on A2 or whatever pin you use.,
- Single NeoPixel on GPIO **A3** - can cut/re-wire an onboard jumper to change pins if desired.

**QT Py is not included**.

# Adafruit IoT Button with NeoPixel BFF

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/117/541/medium800/components_double.jpg?1673554444)

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

## NeoPixel Jumper

- **NP** - This jumper is located on the front of the board to the left of the NeoPixel LED and is labeled **NP**. If you cut this jumper, it disconnects the NeoPixel data input pin from pin **A3**.

## NeoPixel Pad

- **NP** - This solder pad is located at the top of the board between the 5V silk text and the NeoPixel LED. It is labeled **NP**. 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**.

## Tactile Switch Jumper

- **Sw** - This jumper is located on the front of the board to the right of the NeoPixel LED and is labeled **Sw**. If you cut this jumper, it disconnects the button output from pin **A2**.

## Tactile Switch Pad

- **Sw** - This solder pad is located at the top of the board between the **A0** silk text and the NeoPixel LED. It is labeled **Sw**. This pad is attached to the button output pin and can be used to wire the button to a different pin if the tactile switch jumper is cut to disconnect it from pin **A2**.

# Adafruit IoT Button with NeoPixel BFF

## CircuitPython

It's easy to use the **IoT Button with NeoPixel 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\_AdafruitIO](https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO) module to let you write Python code to communicate with Adafruit IO, Adafruit's IoT platform.

## CircuitPython Microcontroller Wiring

Plug an IoT Button with NeoPixel BFF into your QT Py or Xiao form factor board exactly as shown below. Here's an example of connecting a QT Py ESP32-S2 to the BFF.

Connect the QT Py ESP32-S2 with pin headers into the IoT Button with NeoPixel 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).

![components_edited_P1390422.jpg](https://cdn-learn.adafruit.com/assets/assets/000/117/557/medium640/components_edited_P1390422.jpg?1673883542)

[How to Solder Headers Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers)
## CircuitPython Usage

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** &nbsp;and the **code.py** file to your **CIRCUITPY** drive.

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

- **/adafruit\_io**
- **/adafruit\_minimqtt**
- **adafruit\_pixelbuf.mpy**
- **adafruit\_requests.mpy**
- **neopixel.mpy**

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

## 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 button on the BFF to make the rainbow animation show on the NeoPixel. If you release the button, the NeoPixel will stop showing the animation.

![](https://cdn-learn.adafruit.com/assets/assets/000/117/549/medium800thumb/components_5666-04_1.jpg?1673645135)

## Adafruit IO Example

To run this example for Adafruit IO, be sure to first review the [Welcome to Adafruit IO Learn Guide](https://learn.adafruit.com/welcome-to-adafruit-io) and read how to setup your [**settings.toml** file](https://learn.adafruit.com/pico-w-wifi-with-circuitpython/create-your-settings-toml-file) to store your WiFi and Adafruit IO credentials on your **CIRCUITPY** drive.

[Welcome to Adafruit IO Learn Guide](https://learn.adafruit.com/welcome-to-adafruit-io)
[Create Your settings.toml File](https://learn.adafruit.com/pico-w-wifi-with-circuitpython/create-your-settings-toml-file)
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/IoT_Button_BFF_Examples/CircuitPython_Simple_IO_Example/code.py

In the code, the value of the variable `count` is sent to Adafruit IO every time you press the button. The value increases by `1` with each button press. You can see this data in your Adafruit IO feed.

![](https://cdn-learn.adafruit.com/assets/assets/000/117/548/medium800/components_ioDash.jpg?1673644927)

The NeoPixel acts as an Adafruit IO status light. If your board is connected, the NeoPixel is green. If your board is actively uploading data to Adafruit IO, the NeoPixel is blue. If there is an error or connection problem, the NeoPixel is red.

# Adafruit IoT Button with NeoPixel BFF

## NeoPixel Python Docs

# Adafruit IoT Button with NeoPixel BFF

## Adafruit IO Python Docs

# Adafruit IoT Button with NeoPixel BFF

## Arduino

Using the IoT Button with NeoPixel 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) and [Adafruit\_IO\_Arduino](https://github.com/adafruit/Adafruit_IO_Arduino) libraries, and running the provided example code.

## Wiring

Plug an IoT Button with NeoPixel BFF into your QT Py or Xiao form factor board exactly as shown below. Here's an example of connecting a QT Py ESP32-S2 to the BFF.

Connect the QT Py ESP32-S2 with pin headers into the IoT Button with NeoPixel 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).

![components_edited_P1390422.jpg](https://cdn-learn.adafruit.com/assets/assets/000/117/558/medium640/components_edited_P1390422.jpg?1673883579)

[How to Solder Headers Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers)
## Library Installation

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

![](https://cdn-learn.adafruit.com/assets/assets/000/117/542/medium800/components_Arduino_Open_Library_Manager.png?1673621922)

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/117/543/medium800/components_libManage.jpg?1673621958)

Then, search for the **Adafruit IO Arduino** library:

![](https://cdn-learn.adafruit.com/assets/assets/000/117/552/medium800/components_ioInstall_arduino.jpg?1673645267)

If asked about dependencies for any of the libraries, click "Install all".

![](https://cdn-learn.adafruit.com/assets/assets/000/117/553/medium800/components_ioDepends.jpg?1673645276)

If the "Dependencies" window does not come up, then you already have the dependencies installed.&nbsp;

Warning: 

## Basic Example
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/IoT_Button_BFF_Examples/basic_IoTButtonExample/basic_IoTButtonExample.ino

Upload the sketch to your board. Press the button and you will see the NeoPixel light up red.

## Adafruit IO Example
Before running this code, be sure to review the [Welcome to Adafruit IO Learn Guide](https://learn.adafruit.com/welcome-to-adafruit-io).

[Welcome to Adafruit IO Learn Guide](https://learn.adafruit.com/welcome-to-adafruit-io)
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/IoT_Button_BFF_Examples/adafruitIO_iotButtonNeoPixelBFF/adafruitIO_iotButtonNeoPixelBFF.ino

![](https://cdn-learn.adafruit.com/assets/assets/000/117/554/medium800/components_serialMonArdIO.jpg?1673645933)

Edit the included **config.h** file with your Adafruit IO username, Adafruit IO key, SSID name and SSID password. Save the file and then upload the sketch to your board and open up the Serial Monitor ( **Tools -\> Serial Monitor** ) at 115200 baud. While your board is connecting to Adafruit IO, you'll see "`Connecting to Adafruit IO...`" print in the Serial Monitor. After establishing a connection, "`Adafruit IO connected.`" will print.

When you press the button, a value of `0` or `1` will be sent to Adafruit IO and will print to the Serial Monitor. You'll be able to see this data in your feed on Adafruit IO.

![](https://cdn-learn.adafruit.com/assets/assets/000/117/555/medium800/components_feedArduino.jpg?1673646193)

The NeoPixel acts as an Adafruit IO status light. Before connecting to Adafruit IO, the NeoPixel is red. If your board is connected, the NeoPixel is green. If your board is actively uploading data to Adafruit IO, the NeoPixel is blue.&nbsp;

# Adafruit IoT Button with NeoPixel BFF

## NeoPixel Arduino Library Docs

# Adafruit IoT Button with NeoPixel BFF

## Adafruit IO Arduino Library Docs

# Adafruit IoT Button with NeoPixel BFF

## Downloads

## Files

- [NeoPixel Datasheet](https://cdn-shop.adafruit.com/product-files/5666/5666_neopixel_datasheet.pdf)
- [Tactile Switch Datasheet](https://cdn-shop.adafruit.com/product-files/5666/5666_tactile_switch_datasheet.pdf)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-IoT-Button-with-NeoPixel-BFF-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20IoT%20Button%20with%20NeoPixel%20BFF.fzpz)

## Schematic and Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/117/539/medium800/components_schem.png?1673553432)

![](https://cdn-learn.adafruit.com/assets/assets/000/117/540/medium800/components_fab.png?1673553440)


## Primary Products

### Adafruit IoT Button with NeoPixel BFF Add-On for QT Py and Xiao

[Adafruit IoT Button with NeoPixel BFF Add-On for QT Py and Xiao](https://www.adafruit.com/product/5666)
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 chunky 12mm tactile button&nbsp;with a NeoPixel. It's an excellent way to&nbsp;create simple 'IoT Button' type projects with basic...

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

## Featured Products

### Short Female Header Kit for ItsyBitsy

[Short Female Header Kit for ItsyBitsy](https://www.adafruit.com/product/4174)
These three **Short** &nbsp; **Female&nbsp;Headers** &nbsp;alone are, well, lonely. But pair them with any of our&nbsp;[ItsyBitsy](https://www.adafruit.com/?q=itsybitsy)&nbsp;boards, and you're in business!

These headers are particularly cute and...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4174)
[Related Guides to the Product](https://learn.adafruit.com/products/4174/guides)
### Short Male Header Kit for ItsyBitsy

[Short Male Header Kit for ItsyBitsy](https://www.adafruit.com/product/4173)
These three&nbsp; **Short** &nbsp; **Male&nbsp;Headers** &nbsp;alone are, well, lonely. But pair them with&nbsp;our [ItsyBitsy boards](https://www.adafruit.com/?q=itsybitsy), and you're in business!

These 2.54mm / 0.1" pitch headers are...

In Stock
[Buy Now](https://www.adafruit.com/product/4173)
[Related Guides to the Product](https://learn.adafruit.com/products/4173/guides)
### 20-pin 0.1" Female Headers - Rainbow Color Mix - 5 pack

[20-pin 0.1" Female Headers - Rainbow Color Mix - 5 pack](https://www.adafruit.com/product/4160)
Female header is like the duct tape of electronics. It's great for connecting things together, soldering to perf-boards, sockets for wires or break-away header, etc. We go through these real fast, and thought that given how handy they are, we'd offer them in a pack of five!

Each...

In Stock
[Buy Now](https://www.adafruit.com/product/4160)
[Related Guides to the Product](https://learn.adafruit.com/products/4160/guides)
### Break-away 0.1" 36-pin strip male header - Black - 10 pack

[Break-away 0.1" 36-pin strip male header - Black - 10 pack](https://www.adafruit.com/product/392)
Breakaway header is like the duct tape of electronics. It's great for connecting things together, soldering to perf-boards, fits into any breakout or breadboard, etc. We go through these guys real fast, and thought that given how handy they are, we'd offer them in a pack of ten!<br...></br...>

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

## Related Guides

- [Adafruit NeoSlider](https://learn.adafruit.com/adafruit-neoslider.md)
- [Adafruit LTC4316 I2C Address Translator](https://learn.adafruit.com/adafruit-ltc4316-i2c-address-translator.md)
- [RPi Stock Alert Alarm](https://learn.adafruit.com/rpi-stock-alert-alarm.md)
- [Video Nub Shank: ESP32 QT Py Composite Video Injector](https://learn.adafruit.com/video-nub-shank-esp32-qt-py-composite-video-injector.md)
- [NeoPixel Manicure](https://learn.adafruit.com/neopixel-manicure.md)
- [Facial Detection and Recognition with MEMENTO](https://learn.adafruit.com/facial-detection-and-recognition-with-memento.md)
- [Adafruit Wiz5500 Ethernet Co-Processor Breakout Board](https://learn.adafruit.com/adafruit-wiz5500-ethernet-co-processor-breakout-board.md)
- [Adafruit CAN Bus FeatherWing](https://learn.adafruit.com/adafruit-can-bus-featherwing.md)
- [FunHouse Motion Detecting Lights with LIFX Bulbs](https://learn.adafruit.com/funhouse-motion-detecting-lighting-for-lifx-bulbs.md)
- [Adafruit Chainable DS18B20 Extender Breakout](https://learn.adafruit.com/adafruit-chainable-ds18b20-extender-breakout.md)
- [Adafruit VL53L0X Time of Flight Micro-LIDAR Distance Sensor Breakout](https://learn.adafruit.com/adafruit-vl53l0x-micro-lidar-distance-sensor-breakout.md)
- [Infinite Text Adventure](https://learn.adafruit.com/infinite-text-adventure.md)
- [NeoPixel Sprite Weather Display](https://learn.adafruit.com/neopixel-sprite-weather-display.md)
- [PyPortal Voice Controlled Smart Switch and Time Display](https://learn.adafruit.com/pyportal-voice-controlled-smart-switch-and-time-display.md)
- [Adafruit AD5693R 16-Bit DAC Breakout Board](https://learn.adafruit.com/adafruit-ad5693r-16-bit-dac-breakout-board.md)
