# NeoPixel Badge Lanyard with Bluetooth LE

## Overview

https://youtu.be/Rm5B6ggfAko

Get noticed and stand out at the convention with this DIY light-up badge lanyard. Control the color and brightness with your phone over Bluetooth (BLE) with the Adafruit BlueFruit app. This is a great conversation starter on its own. Pair it with a [PyBadge](https://www.adafruit.com/product/4200) for extra geek points, or make a lanyard for everyone on your team and control ALL the colors. Make it red when you're running late, green when you're ready to network, and indigo when it's time to relax with a cold drink.&nbsp;&nbsp;

This is an easy-to-assemble project that requires a little light soldering and some drag-and-drop code. Most of the work is already done for you!

This is the easiest time I've ever had setting up a Bluetooth-to-microcontroller connection. Get the software installed and .. it just works.&nbsp; Hooray!

![](https://cdn-learn.adafruit.com/assets/assets/000/078/842/medium800/wearables_led_lanyard2.jpg?1564522052)

## Parts
Featured
### Adafruit Feather nRF52840 Express

[Adafruit Feather nRF52840 Express](https://www.adafruit.com/product/4062)
The **Adafruit Feather nRF52840 Express** is the new Feather family member with Bluetooth® Low Energy and _native USB support_ featuring the nRF52840!&nbsp; It's our take on an 'all-in-one' Arduino-compatible + Bluetooth® Low Energy with built-in USB...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4062)
[Related Guides to the Product](https://learn.adafruit.com/products/4062/guides)
![Angled shot of a Adafruit Feather nRF52840 Express. ](https://cdn-shop.adafruit.com/640x480/4062-02.jpg)

Featured
### Adafruit Mini Skinny NeoPixel Digital RGB LED Strip - 60 LED/m

[Adafruit Mini Skinny NeoPixel Digital RGB LED Strip - 60 LED/m](https://www.adafruit.com/product/2959)
So thin. So mini. So teeeeeeny-tiny. It's the 'skinny' version of our classic NeoPixel strips!

These NeoPixel strips have 60 digitally-addressable pixel Mini LEDs per meter and are very affordable and are only 7.5 mm wide, 5 mm if you remove the strip from the...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2959)
[Related Guides to the Product](https://learn.adafruit.com/products/2959/guides)
![Adafruit NeoPixel Digital RGB LED Strip with all the LEDs lighting in a rainbow pattern.](https://cdn-shop.adafruit.com/product-videos/640x480/2959-05.jpg)

Featured
### Lithium Ion Polymer Battery Ideal For Feathers - 3.7V 400mAh

[Lithium Ion Polymer Battery Ideal For Feathers - 3.7V 400mAh](https://www.adafruit.com/product/3898)
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 **400mAh** for a total of about 1.9 Wh. If you need a larger (or smaller!)...

In Stock
[Buy Now](https://www.adafruit.com/product/3898)
[Related Guides to the Product](https://learn.adafruit.com/products/3898/guides)
![Slim Lithium Ion Polymer Battery 3.7v 400mAh with JST 2-PH connector and short cable](https://cdn-shop.adafruit.com/640x480/3898-05.jpg)

Featured
### Silicone Cover Stranded-Core Ribbon Cable - 4 Wires 1 Meter Long

[Silicone Cover Stranded-Core Ribbon Cable - 4 Wires 1 Meter Long](https://www.adafruit.com/product/3892)
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/3892)
[Related Guides to the Product](https://learn.adafruit.com/products/3892/guides)
![Coiled bundle of black, silicone covered, stranded-core ribbon cable.](https://cdn-shop.adafruit.com/640x480/3892-01.jpg)

Featured
### USB cable - USB A to Micro-B

[USB cable - USB A to Micro-B](https://www.adafruit.com/product/592)
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or microcontroller

Approximately 3 feet / 1 meter long

Out of Stock
[Buy Now](https://www.adafruit.com/product/592)
[Related Guides to the Product](https://learn.adafruit.com/products/592/guides)
![USB cable - USB A to Micro-B - 3 foot long](https://cdn-shop.adafruit.com/640x480/592-01.jpg)

### Additional Materials Needed

- 1" tubular webbing -- about a meter long in your preferred color
- Swivel hook for holding the badge
- Hot glue gun
- Soldering iron & accessories
- Needle & thread

You'll also need a smart phone that's capable of running the free Adafruit BlueFruit app.

# NeoPixel Badge Lanyard with Bluetooth LE

## Wiring Diagram

![](https://cdn-learn.adafruit.com/assets/assets/000/078/618/medium800/wearables_lanyard_wiring_bb.jpg?1564087141)

Solder three wires to the NeoPixel strip as follows:

- NeoPixel - to Feather&nbsp; **G**
- NeoPixel **DIN** to Feather **13**
- NeoPixel **+** to Feather **BAT**

We're soldering to the **BAT** pin because this is a 3v logic board, but the NeoPixels prefer a bit more voltage than that. This pin will take voltage directly from the battery without level-shifting -- meaning your pixels will be a bit brighter.&nbsp;&nbsp;

# NeoPixel Badge Lanyard with Bluetooth LE

## Assembly

Decide how long you'd like your lanyard. I found 1m to be just about perfect - long enough to fit over my head comfortably and dangle my badge at an appropriate level. Cut a strip of webbing about 3 inches longer than you'd like -- you can always trim it down later.

Carefully cut your NeoPixels to the same length, cutting through the copper pads. Also cut off the connectors on both ends as we won't be using them this time.

Cut a short piece of ribbon cable -- you only need a few inches. Find the striped wire -- this will be our power wire. We only need three wires for this project so pull off the fourth wire (opposite the striped wire) and save it for another project.

![wearables_09_ribboncable.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/591/medium640/wearables_09_ribboncable.jpg?1564004240)

Solder the ribbon cable to your NeoPixels. The striped wire will go to **+** , the middle wire to **IN** and the remaining wire goes to **-**.

These pads are teeny tiny and close together, so this can be a bit tricky. Breathe and take your time with this.

![wearables_00_solder.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/590/medium640/wearables_00_solder.jpg?1564004011)

Solder the other end of the wires to the Feather:

- Striped wire to **BAT**
- Middle wire to **13**
- Remaining wire to **GND**

![wearables_02_solderfeather.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/592/medium640/wearables_02_solderfeather.jpg?1564004331)

That's all our connections! Before we seal everything up and make it suitcase-proof, let's load up the software and be sure it all works.

# NeoPixel Badge Lanyard with Bluetooth LE

## Software

This code uses the Adafruit BlueFruit app's Control Pad and Color Picker features. The Color Picker will send a solid color to the lanyard, and the Control Pad will allow you to choose between four different customizable color gradient animations. You can also speed up and slow down the animations to get just the look you want.

We need to do a bit of setup to get the Feather working with CircuitPython. Here's what's on this page:

1. Install the latest version of CircuitPython on the board
2. Install the necessary CircuitPython libraries
3. Copy and update the Python code
4. Save the code to your Feather

Ready to start? Here we go!

### Install CircuitPython

This guide tells you all you need to know about CircuitPython:

[https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython)

For now, I'll just cherry-pick the necessaries, but be sure to read through the guide to get all the nitty gritty details and troubleshooting tips.

[Download CircuitPython from Circutpython.org](https://circuitpython.org/downloads)
Scroll down until you find the Feather nRF52840 board and click on it. Then click **Download** for the latest release. A file will download to your computer with a file extension of uf2.

![wearables_download_cpy.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/597/medium640/wearables_download_cpy.jpg?1564004914)

Plug your Feather into your computer with a known good data+power USB cable.&nbsp;

Double-click the Reset button next to the USB connector on your board (green arrow), and you will see the NeoPixel RGB LED turn green (identified by the red arrow in the image). If the LED turns red, check the USB cable, try another USB port, etc. Note: The little red LED next to the USB connector will pulse red. That's ok!

If double-clicking doesn't work the first time, try again. Sometimes it can take a few tries to get the rhythm right!

![wearables_one_one_one.png](https://cdn-learn.adafruit.com/assets/assets/000/125/969/medium640/wearables_one_one_one.png?1699474232)

When it happens correctly, you will see a new disk drive appear called FTHR840BOOT.

Drag the file you just downloaded onto this drive to install CircuitPython. The disk drive name **FTHR840BOOT** will magically change to read **CIRCUITPY**.

 **Note:** if you don't see **FTHR840BOOT** , but instead see a drive called **CIRCUITPY** , that means CircuitPython is already installed. You probably want to follow the instructions to update CircuitPython to the latest version - this project requires at least version 5.0.0-beta.0 or higher.

## Install Libraries

Now we need to install a few libraries onto our board as well. Here's a guide that tells you all you'll ever want to know about installing libraries:

[https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries](https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries)

I'll just hit the highlights again to get you up and running.

[Download Circuit Python Library Bundle](https://circuitpython.org/libraries)
The above button takes you to a page where you can download the latest library release. Click the big purple button to do so.

![wearables_libraries_jpb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/602/medium640/wearables_libraries_jpb.jpg?1564005388)

Now go to your **CIRCUITPY** drive and create a new folder called **lib**. Unzip the Library bundle and find:

- **adafruit\_ble**
- **adafruit\_bluefruit\_connect**
- **adafruit\_fancyled**
- **neopixel.mpy**

Drag these three folders/files into your brand new **lib** folder.

![wearables_circuitpy_drive.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/839/medium640/wearables_circuitpy_drive.jpg?1564519274)

### Upload the Code

The last thing we need to add is a file called **code.py** on the **CIRCUITPY** drive. This is where the Feather will look for actual instructions on what to do. Copy the code below into a text or code editor -- we recommend the [Mu editor which can be downloaded here](https://codewith.mu/).

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

Once you've got the code in your editor, look near the top and find this line:

```auto
pixel = neopixel.NeoPixel(board.D13, 60)
```

If you soldered to a pin other than pin **13** , change **D13** to reflect the correct pin. The last number (60) tells the board how many NeoPixels we have. If you have more or less than 60, change this number to reflect your actual setup.

### Customizing Palettes

I've added four different color palettes for the animations accessed from the Control Pad: a rainbow, a purple gradient, a "fire" and a "water" palette. You can customize these fairly easily in the code. The power of the FancyLED library allows you so much control when it comes to choosing custom colors and animating them smoothly.

Find the palette definitions in the code:

```auto
# Declare a 6-element RGB rainbow palette
PALETTE_RAINBOW = [fancy.CRGB(1.0, 0.0, 0.0), # Red
           fancy.CRGB(0.5, 0.5, 0.0), # Yellow
           fancy.CRGB(0.0, 1.0, 0.0), # Green
           fancy.CRGB(0.0, 0.5, 0.5), # Cyan
           fancy.CRGB(0.0, 0.0, 1.0), # Blue
           fancy.CRGB(0.5, 0.0, 0.5)] # Magenta

# Declare a Purple Gradient palette
PALETTE_GRADIENT = [fancy.CRGB(160, 0, 141), # Purples
           fancy.CRGB(77, 0, 160),
           fancy.CRGB(124, 0, 255),
           fancy.CRGB(0, 68, 214)]

# Declare a FIRE palette
PALETTE_FIRE = [fancy.CRGB(0, 0, 0),       # Black
              fancy.CHSV(1.0),           # Red
              fancy.CRGB(1.0, 1.0, 0.0), # Yellow
              0xFFFFFF]                  # White

# Declare a Water Colors palette
PALETTE_WATER = [fancy.CRGB(0, 214, 214), # blues and cyans
           fancy.CRGB(0, 92, 160),
           fancy.CRGB(0, 123, 255),
           fancy.CRGB(0, 68, 214)]
```

You can use CRGB values or CHSV values to choose colors, or use them both at the same time. There are also multiple ways to declare values and a lot of control over how spread out the gradients can be.

This is explained in detail in the [FancyLED guide](https://learn.adafruit.com/fancyled-library-for-circuitpython/colors)&nbsp;so take a look to find out all you need to know about creating your own custom color palettes.

Save the code on your **CIRCUITPY** drive, called **code.py**

That's it! You're ready to start controlling your lights with Bluetooth.

![wearables_upload_codepy.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/605/medium640/wearables_upload_codepy.jpg?1564005914)

# NeoPixel Badge Lanyard with Bluetooth LE

## Use It

### Adafruit BlueFruit App

Go to the app store and find and install the Adafruit BlueFruit app on your smart phone.

Launch the app. Make sure you're in "Central Mode" and that your Feather is powered up. You should see the CIRCUITPY drive appear on the main screen. If it's not there, try pulling down to refresh or restarting the app.

![wearables_screen1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/620/medium640/wearables_screen1.jpg?1564088092)

If you still don't see it, try re-uploading your code, making sure you have all the libraries installed. It won't work without all the libraries! Circuit Python still lets you save the file without throwing an error, so double check you've got everything you need.

![](https://cdn-learn.adafruit.com/assets/assets/000/078/621/medium800/wearables_screens.jpg?1564088231)

Click Connect, then Controller \> Color Picker. Choose a color and press the "Send selected color" button. Your lanyard will update with the new color. Like magic!

Now go back to the Control Pad. You'll see four buttons and four arrows. The number buttons will select between the four color palettes you made, and the up and down arrows will speed up or slow down the animation of the gradient.

![](https://cdn-learn.adafruit.com/assets/assets/000/078/840/medium800/wearables_controlpad.jpg?1574883696)

### Finishing
Slide a piece of clear 3/8" heat shrink over your solder connections.&nbsp; Squirt a little hot glue inside and then shrink it down with a heat gun while the glue is still wet. This will make a rock-solid, unbreakable plastic casing for your delicate solder connections.

![wearables_03_heatshrink.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/595/medium640/wearables_03_heatshrink.jpg?1564004585)

![wearables_04_heatshrunk.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/596/medium640/wearables_04_heatshrunk.jpg?1564004602)

Slide the lights inside the webbing so they're centered, with an inch or two at either end for overlap. You can finish the cut edges of nylon webbing with a soldering iron (use a tip you don't care about) or a lighter.&nbsp;

![wearables_05_sealentds.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/612/medium640/wearables_05_sealentds.jpg?1564086362)

Add some hot glue or a rubber band to attach the battery to the back of the Feather.

![wearables_04_gluebattery.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/613/medium640/wearables_04_gluebattery.jpg?1564086430)

Fold the lanyard ends over one another and sew or glue them down to make a secure loop. Attach your lanyard swivel hook to the point at the very bottom.

![wearables_07_sewswivel.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/614/medium640/wearables_07_sewswivel.jpg?1564086463)

You can either tuck the Feather and battery into the back of your badge, or use the mounting holes to sew it to the back of the lanyard. A 1" lanyard will cover the board and battery completely so it doesn't show from the other side.

![wearables_06_sewfeather.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/615/medium640/wearables_06_sewfeather.jpg?1564086529)

You can turn the LEDs "off" with the app by sending the color black. However, this will still drain your battery since the Feather is constantly checking for updates. The best way to turn it off completely is to unplug the battery JST connector.&nbsp;

The Feather has onboard battery charging, so to charge your battery back up, just plug in a USB cable while the battery is plugged into the JST connector.&nbsp;


## Guide Products

### Adafruit Feather nRF52840 Express

[Adafruit Feather nRF52840 Express](https://www.adafruit.com/product/4062)
The **Adafruit Feather nRF52840 Express** is the new Feather family member with Bluetooth® Low Energy and _native USB support_ featuring the nRF52840!&nbsp; It's our take on an 'all-in-one' Arduino-compatible + Bluetooth® Low Energy with built-in USB...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4062)
[Related Guides to the Product](https://learn.adafruit.com/products/4062/guides)
### Adafruit Mini Skinny NeoPixel Digital RGB LED Strip - 60 LED/m

[Adafruit Mini Skinny NeoPixel Digital RGB LED Strip - 60 LED/m](https://www.adafruit.com/product/2959)
So thin. So mini. So teeeeeeny-tiny. It's the 'skinny' version of our classic NeoPixel strips!

These NeoPixel strips have 60 digitally-addressable pixel Mini LEDs per meter and are very affordable and are only 7.5 mm wide, 5 mm if you remove the strip from the...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2959)
[Related Guides to the Product](https://learn.adafruit.com/products/2959/guides)
### Lithium Ion Polymer Battery Ideal For Feathers - 3.7V 400mAh

[Lithium Ion Polymer Battery Ideal For Feathers - 3.7V 400mAh](https://www.adafruit.com/product/3898)
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 **400mAh** for a total of about 1.9 Wh. If you need a larger (or smaller!)...

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

[Silicone Cover Stranded-Core Ribbon Cable - 4 Wires 1 Meter Long](https://www.adafruit.com/product/3892)
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/3892)
[Related Guides to the Product](https://learn.adafruit.com/products/3892/guides)
### USB cable - USB A to Micro-B

[USB cable - USB A to Micro-B](https://www.adafruit.com/product/592)
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or microcontroller

Approximately 3 feet / 1 meter long

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

## Related Guides

- [Introducing the Adafruit nRF52840 Feather](https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather.md)
- [Using Adafruit IO Actions to Make an IoT Door Detector](https://learn.adafruit.com/using-adafruit-io-actions-to-make-an-iot-door-detector.md)
- [CircuitPython OLED Watch Clock](https://learn.adafruit.com/circuitpython-oled-watch.md)
- [Make It Shake, Rattle, and Roll: Accelerometer Use](https://learn.adafruit.com/make-it-shake-rattle-and-roll.md)
- [Paper Craft Zoetrope with Crickit](https://learn.adafruit.com/paper-craft-zoetrope-with-circuit-python.md)
- [Quickstart - Raspberry Pi RP2040 with BLE and CircuitPython](https://learn.adafruit.com/quickstart-raspberry-pi-rp2040-with-ble-and-circuitpython.md)
- [DIY Darksaber Build - 3D Print with PropMaker FeatherWing and BLE](https://learn.adafruit.com/ble-darksaber-propmaker.md)
- [Watchmen's Sister Night NeoPixel Goggles](https://learn.adafruit.com/watchmen-sister-night-circuitpython-neopixel-goggles.md)
- [Piper Make With the Raspberry Pi Pico](https://learn.adafruit.com/piper-make-with-the-raspberry-pi-pico.md)
- [BLE Sniffer with nRF52840](https://learn.adafruit.com/ble-sniffer-with-nrf52840.md)
- [Introducing Adafruit Feather](https://learn.adafruit.com/adafruit-feather.md)
- [Trash-Built Robotic Fish](https://learn.adafruit.com/trash-robo-fish.md)
- [Halloween Monsters with CRICKIT and Circuit Playground Express](https://learn.adafruit.com/halloween-monsters-with-crickit.md)
- [NeoTrellis Feather Case Assembly](https://learn.adafruit.com/neotrellis-feather-case-assembly.md)
- [Crickit Powered Maker Ice Cream Truck!](https://learn.adafruit.com/crickit-maker-ice-cream-truck.md)
- [No-Solder LED Disco Tie with Bluetooth](https://learn.adafruit.com/no-solder-circuit-playground-bluetooth-disco-tie.md)
