# CircuitPython BLE Controlled NeoPixel Hat

## Overview

https://youtu.be/lesxfWmiSqU

## Custom NeoPixel Apparel&nbsp;

In this project, we’re making a light up hat with bluetooth controlled NeoPixels.&nbsp;We took this on our recent trip to Disney World and just floored the cast members and park goers.

This is a really fun project for folks just getting started with electronics.&nbsp;This guide will show you how to add a NeoPixel strip to a hat and wire up the&nbsp;electronics.

![led_strips_hero-hat.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/326/medium640/led_strips_hero-hat.jpg?1565718165)

## Bluetooth Controlled NeoPixels

The Adafruit Bluefruit nRF52840 has everything you need to add BLE to your projects. You can remotely control NeoPixels using the Bluefruit LE app for iOS or Android.&nbsp;

![led_strips_hero-bluefruit.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/328/medium640/led_strips_hero-bluefruit.jpg?1565718394)

## BLE Remote Control

In this project, we’ll use the color picker and the control pad to trigger different animations.&nbsp;You can also use an Apple Watch to remotely control the NeoPixels from your wrist.&nbsp;This can be really handy for those times you might not be able to pull out a mobile device.&nbsp;

![led_strips_hero-watch.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/327/medium640/led_strips_hero-watch.jpg?1565718278)

## Prerequisite Guides

Walk through these guides to get familiar with Circuit Python, Bluefruit and NeoPixels.

- [Introduction to Adafruit nRF52840 Feather](https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather)
- [Getting Started with CircuitPython and Bluetooth Low Energy](https://learn.adafruit.com/circuitpython-nrf52840)
- [Adafruit NeoPixel Guide](https://learn.adafruit.com/adafruit-neopixel-uberguide)
- [Guide to Excellent Soldering](https://learn.adafruit.com/adafruit-guide-excellent-soldering)

## Parts

- [Snapback Adjustable Hat – Black/Gray](https://www.lids.com/pop-culture-blank-hats/snapback-adjustable-hat-black/gray/o-32259395+t-76371387+p-143702109+z-9-1712332016)
- [Adafruit nRF52840 Feather](https://www.adafruit.com/product/4062)
- [500mAh Battery](https://www.adafruit.com/product/1578)
- [Mini Skinny NeoPixel Strip 60 per meter](https://www.adafruit.com/product/2964)
- [Flush diagonal cutters](https://www.adafruit.com/product/152)
- [Wire Strippers](https://www.adafruit.com/product/527)
- [Helping Third Hands](https://www.adafruit.com/product/291)
- [PCB Stickvise](https://www.adafruit.com/product/3197)
- [3-pin JST cable - Female](https://www.adafruit.com/product/4046)
- [3-pin JST cable - Male](https://www.adafruit.com/product/3893)
- [4 Wires Silicone Cover Stranded-Core Ribbon Cable](https://www.adafruit.com/product/3891)
- [Rainbow Crystals for NeoPixels](https://www.adafruit.com/product/4044)

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

In 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)

### Lithium Ion Polymer Battery - 3.7v 500mAh

[Lithium Ion Polymer Battery - 3.7v 500mAh](https://www.adafruit.com/product/1578)
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 500mAh for a total of about 1.9 Wh. If you need a larger (or smaller!) battery, <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/1578)
[Related Guides to the Product](https://learn.adafruit.com/products/1578/guides)
![Angled shot of a Lithium Ion Polymer Battery 3.7V 500mAh with JST-PH connector.](https://cdn-shop.adafruit.com/640x480/1578-03.jpg)

### 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/3891)
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/3891)
[Related Guides to the Product](https://learn.adafruit.com/products/3891/guides)
![4 wire Silicone Cover Stranded-Core Ribbon Cable](https://cdn-shop.adafruit.com/640x480/3891-01.jpg)

### Helping Third Hand Magnifier W/Magnifying Glass Tool

[Helping Third Hand Magnifier W/Magnifying Glass Tool](https://www.adafruit.com/product/291)
The classic 'third hand tool,' as seen on every desk! We have one next to our [Panavise jr](//www.adafruit.com/products/151), they complement each other well. This tool is good for holding small PCBs and wires for tinning or soldering to parts.

&nbsp;

- Every...

In Stock
[Buy Now](https://www.adafruit.com/product/291)
[Related Guides to the Product](https://learn.adafruit.com/products/291/guides)
![Third Hand Magnifier with two alligator grabbers and Magnifying Glass](https://cdn-shop.adafruit.com/640x480/291-01.jpg)

### Stickvise PCB Vise

[Stickvise PCB Vise](https://www.adafruit.com/product/3197)
Are you still looking for that perfect PCB holder?&nbsp;The low profile **PCB Stickvise&nbsp;** might be just the thing you need!

In&nbsp;performing the simple task of holding a PCB near table level, the Stickvise is&nbsp;great because your hands can rest directly on the...

In Stock
[Buy Now](https://www.adafruit.com/product/3197)
[Related Guides to the Product](https://learn.adafruit.com/products/3197/guides)
![Stickvise PCB Vise on table](https://cdn-shop.adafruit.com/640x480/3197-00.jpg)

### Flush diagonal cutters

[Flush diagonal cutters](https://www.adafruit.com/product/152)
These are the best diagonal cutters, large super-comfortable grip to use and have strong nippers for perfect trimming of wires and leads. I've used my pair every day for years.

In Stock
[Buy Now](https://www.adafruit.com/product/152)
[Related Guides to the Product](https://learn.adafruit.com/products/152/guides)
![Red and black diagonal flush cutters](https://cdn-shop.adafruit.com/640x480/152-02.jpg)

### Hakko Professional Quality 20-30 AWG Wire Strippers

[Hakko Professional Quality 20-30 AWG Wire Strippers](https://www.adafruit.com/product/527)
These are the finest wire strippers we have used, and if you have to do a lot of wiring, you will agree! They have soft rounded grips - very comfortable to use, and precision ground notches that do a perfect job every time. No more yanking or twisting to strip wires cleanly and quickly.<br...></br...>

In Stock
[Buy Now](https://www.adafruit.com/product/527)
[Related Guides to the Product](https://learn.adafruit.com/products/527/guides)
![Red and black multi-size wire stripplers, closed](https://cdn-shop.adafruit.com/640x480/527-02.jpg)

### STEMMA JST PH 2mm 3-Pin to Male Header Cable - 200mm

[STEMMA JST PH 2mm 3-Pin to Male Header Cable - 200mm](https://www.adafruit.com/product/3893)
This cable will let you turn a JST PH 3-pin cable port into 3 individual wires with high-quality 0.1" male header plugs on the end. We're carrying these to match up with our Hallowing, for extending and connecting sensors or LEDs - and the wires are even color coded!

<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/3893)
[Related Guides to the Product](https://learn.adafruit.com/products/3893/guides)
![Angled shot of STEMMA JST PH 3-Pin to Male Header Cable - 200mm.](https://cdn-shop.adafruit.com/640x480/3893-03.jpg)

### JST PH 2mm 3-Pin Socket to Color Coded Cable - 200mm

[JST PH 2mm 3-Pin Socket to Color Coded Cable - 200mm](https://www.adafruit.com/product/4046)
This cable will let you turn a JST PH 3-pin cable _socket_ into 3 individual tinned wires. These are great to match up with our JST 3-PH cables, for extending and connecting sensors or LEDs, and the wires are even color coded!

[We...](https://www.adafruit.com/product/3893)

In Stock
[Buy Now](https://www.adafruit.com/product/4046)
[Related Guides to the Product](https://learn.adafruit.com/products/4046/guides)
![Angled shot of JST PH 3-Pin Socket to Color Coded Cable - 200mm](https://cdn-shop.adafruit.com/640x480/4046-02.jpg)

### 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/2964)
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...

In Stock
[Buy Now](https://www.adafruit.com/product/2964)
[Related Guides to the Product](https://learn.adafruit.com/products/2964/guides)
![Video of an Adafruit NeoPixel Digital RGB LED Strip with all the LEDs illuminating various colors. ](https://cdn-shop.adafruit.com/product-videos/640x480/2964-06.jpg)

### Adafruit Mini Skinny NeoPixel Digital RGB LED Strip 1m

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

These NeoPixel strips have 30 digitally-addressable pixel Mini LEDs per meter and are very affordable and are...

In Stock
[Buy Now](https://www.adafruit.com/product/2953)
[Related Guides to the Product](https://learn.adafruit.com/products/2953/guides)
![Video of RGB LED Strip emitting rainbow gradient](https://cdn-shop.adafruit.com/product-videos/640x480/2953-04.jpg)

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

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

These NeoPixel strips have 144 digitally-addressable pixel Mini LEDs per meter and are very affordable and are only 7.5 mm wide (0.3")&nbsp;if you remove the strip from the...

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

![](https://cdn-learn.adafruit.com/assets/assets/000/079/338/medium800/led_strips_parts.jpg?1565719676)

# CircuitPython BLE Controlled NeoPixel Hat

## Circuit Diagram

## Circuit&nbsp;Diagram

This provides a visual reference for wiring of the components. They aren't true to scale, just meant to be used as reference. This diagrams was created using the&nbsp;[Fritzing software package](http://fritzing.org/download/).

[circuit_diagram.fzz](https://cdn-learn.adafruit.com/assets/assets/000/079/411/original/circuit_diagram.fzz?1565744125)
![](https://cdn-learn.adafruit.com/assets/assets/000/079/310/medium800/led_strips_circuit-diagram.jpg?1565652652)

## Wired Connections

The NeoPixel strip is wired to the nRF52840 Feather using 3-pin JST connectors. A slide switch is wired to the enable and ground.

## Powering

The Adafruit nRF52840 Feather can be powered via USB or JST using a 3.7v LiPo battery. In this project, a 500mAh LiPo battery is used. The battery is rechargeable via the USB port on the Adafruit Feather. The slide switch is wired to the&nbsp; **enable** &nbsp;and&nbsp; **ground** &nbsp;pins on the Adafruit nRF52840 Feather – This switches the 3V regulator on and off. The battery can still recharge while the 3V regulator is switched off.

## NeoPixel Strip Wiring

- **DATA IN** from NeoPixel to **Pin #6** &nbsp;on nRF52840 Feather
- **GND** from NeoPixel to **GND** on nRF52840 Feather
- **+5V PWR** from NeoPixel to **3V** on nRF52840 Feather

Be sure you use the end that says **Din** and not **Dout**.

# CircuitPython BLE Controlled NeoPixel Hat

## Software

## Install CircuitPython

The Adafruit nRF52840 Feather ships with CircuitPython but it's best to go ahead and update it to the latest version. This project needs version 5.0.0-beta.0 or higher. It's super easy with the **circuitpython.org** website, just click the link below to launch the page. There you can choose to install stable release or beta.&nbsp;

![led_strips_hero-circuitpyorg.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/332/medium640/led_strips_hero-circuitpyorg.jpg?1565718906)

## **Quick Start**

- Connect board to computer via a known good USB data cable and double press the reset button.
- Download the C **ircuitPython UF2** and upload to the&nbsp; **FTHR840BOOT** &nbsp;drive.
- Open **CIRCUITPY** drive and upload the required libraries (listed below) and **code.py**

[Install CircuitPython nRF52840 Feather](https://circuitpython.org/board/feather_nrf52840_express/)
## The Adafruit CircuitPython Libraries

Download the CircuitPython library bundle and unzip the folder. Create a new folder in the **CIRCUITPY** drive and name it " **lib**". The following libraries are required to run the code properly. Double check to ensure all of the files and folders are inside the **lib** folder on the **CIRCUITPY** drive.

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

![led_strips_libraries.jpg](https://cdn-learn.adafruit.com/assets/assets/000/084/829/medium640/led_strips_libraries.jpg?1574452592)

[Download Library Bundle for CircuitPython](https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/latest)
![](https://cdn-learn.adafruit.com/assets/assets/000/079/334/medium800/led_strips_hero-mu.jpg?1565718997)

## Mu Python Editor

Check out Mu, it's a simple Python editor that works with Adafruit CircuitPython hardware.&nbsp;It's written in Python and works on Windows, MacOS, Linux and Raspberry Pi. The serial console is built right in so you get immediate feedback from your board's serial output!

[Install Mu Editor Tutorial](https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor)
![](https://cdn-learn.adafruit.com/assets/assets/000/079/335/medium800/led_strips_hero-code-wide.jpg?1565719023)

## Upload code.py

Click the link below to download the project zip – this contains the code. Upload the **code.py file** to the **CIRCUITPY** drive.&nbsp;That's it! You're ready to start controlling your lights with the Bluefruit LE connect app. The rainbow animation is programmed to automatically play after boot.

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

## BLE Connect App

Use the Bluefruit LE app to control the NeoPixels. The color picker sends solid colors. The control pad features buttons for up to four different animations. Get started by installing the Bluefruit LE connect app for iOS or Android.&nbsp;

- Open the app and find the **CIRCUITPY** from the list of discoverable devices.
- Tap on the **connect** button to load the **Modules** page.
- Locate and tap on **Controller** from the list of modules.
- Tap on either **Control Pad** or **Color Picker** from the list of modules

![](https://cdn-learn.adafruit.com/assets/assets/000/079/400/medium800/led_strips_ios-screens.jpg?1565734254)

[Download Bluefruit LE Connect for iOS](https://apps.apple.com/us/app/adafruit-bluefruit-le-connect/id830125974)
[Download for Bluefruit LE Connect for Android](https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect)
## Changing the NeoPixel Count

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

```
pixel = neopixel.NeoPixel(board.D6, 28)
```

If you soldered to a pin other than pin **6** , change&nbsp; **D6** &nbsp;to reflect the correct pin. The last number (28) tells the board how many NeoPixels we have. If you have more or less than 28, change this number to reflect your actual setup.

## Customizing Palettes

The code features 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:

```
# 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&nbsp;[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.

# CircuitPython BLE Controlled NeoPixel Hat

## NeoPixel Strip Setup

## Choosing a NeoPixel Strip

In this project we’ll be using a Mini Skinny NeoPixel strip with 60 pixels per meter. The hat used here was purchased from Lids.com – [Snapback Adjustable Hat - Black/Gray](https://www.lids.com/pop-culture-blank-hats/snapback-adjustable-hat-black/gray/o-32259395+t-76371387+p-143702109+z-9-1712332016)

![led_strips_hat-strip.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/339/medium640/led_strips_hat-strip.jpg?1565719755)

## Measure Strip

Start by laying out our NeoPixel strip to figure out how many pixels we can fit on our hat. In my hat, I used a total of 49 NeoPixels which covers most of the front.

![led_strips_hat-strip-measure.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/340/medium640/led_strips_hat-strip-measure.jpg?1565720137)

## Pixel Data Flow

Flip the strip over to see labels for the ground, voltage and data pads. The arrow indicates the flow of data. Follow the arrow and locate the first pixel in the strip. We'll need to cut the strip to short it down to fit on the front of the hat.

![led_strips_pixel-direction.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/353/medium640/led_strips_pixel-direction.jpg?1565722995)

## Starting Pixel

Place the strip over one of the seams and skip the first pixel. It will become easier if the first pixel if cut this off rather than remove the existing cable.

![led_strips_hat-strip-start.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/341/medium640/led_strips_hat-strip-start.jpg?1565720147)

## Last Pixel

Wrap the NeoPixel strip across the front of the hat and mark the pixel that just about reaches the second seam – This will be the last pixel where we'll cut the strip.

![led_strips_hat-strip-end.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/342/medium640/led_strips_hat-strip-end.jpg?1565720156)

## Sacrificial Pixel

Carefully cut off the first pixel using flush diagonal cutters. Try to leave as much of the copper pad as possible – This extra space will allow for a stronger connection when soldering the 3-pin JST cable.

![led_strips_strip-cut-start.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/343/medium640/led_strips_strip-cut-start.jpg?1565720199)

## Pixel Count

Thoroughly count each LED element on the strip to determine the exist number of pixels in the strip.&nbsp;Count twice, cut once!&nbsp;

![led_strips_strip-pixel-count.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/344/medium640/led_strips_strip-pixel-count.jpg?1565720254)

## Cutting Strip

We can use wire cutters to cut across the pads on the strip.&nbsp;Be sure to count your pixels twice before cutting it down to size.&nbsp;Try to cut evenly across the three solder pads so you leave enough area for attaching wires.

![led_strips_strip-cut.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/345/medium640/led_strips_strip-cut.jpg?1565720342)

## Remove Sheathing

We won’t be using the silicone sheathing so we can remove it.

![led_strips_strip-remove-sheathing.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/347/medium640/led_strips_strip-remove-sheathing.jpg?1565720610)

## Extra Bling

To make the pixels extra shiny, use the Adafruit rainbow crystals on each pixel.

## No Foil Backing Crystals

These crystals have no foil backing so they’re great for adorning NeoPixels.&nbsp;This makes the LEDs look more like rhinestones and less like, well LEDS.

![led_strips_crystals-neopixel.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/348/medium640/led_strips_crystals-neopixel.jpg?1565720758)

## Install Crystals

Just a drop of super glue is all you need to bond the crystals, we just need to be precise with the placement.

![led_strips_crystal-superglue.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/349/medium640/led_strips_crystal-superglue.jpg?1565720770)

## Precise Placement

With the small size of these crystals, I found placing them rather tricky. For a finer control, perhaps try using a set of jewelers tweezers.

![led_strips_crystal-placement.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/350/medium640/led_strips_crystal-placement.jpg?1565720797)

## Bedazzled Pixels

These give the LEDs a shimmery effect that looks great even when they’re turned off.

![led_strips_crystal-installed-strip.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/351/medium640/led_strips_crystal-installed-strip.jpg?1565720808)

# CircuitPython BLE Controlled NeoPixel Hat

## Wire NeoPixel Strip

## JST Quick Connects

Use these 3-pin JST cables to connect the strip to the Feather.&nbsp;These cables makes it easy to connect and disconnect.

![led_strips_jst-cables-strip.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/354/medium640/led_strips_jst-cables-strip.jpg?1565723423)

## Cut Cables Short

You can cut the cables short using flush diagonal cutters. I made mine rather short, around an 1 inch (24mm) long.

![led_strips_jst-cut.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/355/medium640/led_strips_jst-cut.jpg?1565724147)

## Wiring

Lay out the components to map out the circuit. We'll connect the male JST connector to the NeoPixel strip and the female connector to the Feather.

![led_strips_ble-jst-cables.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/356/medium640/led_strips_ble-jst-cables.jpg?1565724155)

## Wire Stripping

Using wire strippers, remove a bit of insulation from the tips of each wire.

![led_strips_wire-strip.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/361/medium640/led_strips_wire-strip.jpg?1565724569)

## Tinning Wires

You can tin the wires by adding a bit of solder to the exposed wires.&nbsp;This prevents the strands of wires from fraying and makes it easier to solder.

![led_strips_wire-tinning.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/362/medium640/led_strips_wire-tinning.jpg?1565724580)

## Solder NeoPixel Strip

Now we can attach the wires to the pads on the NeoPixel strip by soldering them in place.&nbsp;Third helping hands can help you keep those wires in place while soldering.

Be sure the white wire (data) goes to the **Din** pin on the strip. The NeoPixels will **not** light of white is connected to the **Dout** pin (on the opposite side of the strip).

![led_strips_strip-wire-solder.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/363/medium640/led_strips_strip-wire-solder.jpg?1565724676)

## Wired NeoPixel Strip

Double check the solder joints are solid.

![led_strips_strip-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/364/medium640/led_strips_strip-wired.jpg?1565724793)

# CircuitPython BLE Controlled NeoPixel Hat

## Feather Wiring

## Wiring BLE Feather

Next we’ll wire up the Adafruit Feather. I used a stick vise to secure the PCB while soldering wires.

![led_strips_ble-stickvise.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/366/medium640/led_strips_ble-stickvise.jpg?1565724951)

## Solder JST Cable

We’ll solder the JST cable female to ground, voltage and any of the available data pins. In this project, the code is set to Pin #6. If you decide to change this, you will need to reflect that in the code.

![led_strips_ble-wiring.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/370/medium640/led_strips_ble-wiring.jpg?1565725204)

## Wired BLE Feather

Now the feather just needs a way to turn the circuit on and off.

![led_strips_ble-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/369/medium640/led_strips_ble-wired.jpg?1565725192)

## Connect JST to BLE Feather

Plug in the male JST connector into the female JST connector on the Feather. Make sure the registration keys are lined up, it should snap fit!

![led_strips_ble-strip-connect.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/371/medium640/led_strips_ble-strip-connect.jpg?1565725342)

# CircuitPython BLE Controlled NeoPixel Hat

## Switch Wiring

## Slide Switch Wires

We'll need to make two wired connections to connect the switch to the Feather.

![led_strips_switch-wire.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/372/medium640/led_strips_switch-wire.jpg?1565725516)

## Solder Slide Switch

Wire up a small 2-wire cable to the middle pin and either one of the pins on either side.&nbsp;

![led_strips_switch-solder-wire.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/373/medium640/led_strips_switch-solder-wire.jpg?1565726154)

## Wired Slide Switch

Double check the solder joints to ensure they're solid.

![led_strips_switch-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/374/medium640/led_strips_switch-wired.jpg?1565726180)

## Wire Switch to BLE Feather

We’ll wire up a the slide switch to the **ground** and **enable** pins on the back of the board.

![led_strips_ble-switch-soldered.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/375/medium640/led_strips_ble-switch-soldered.jpg?1565726197)

## Hot Glue Switch

You can use a bit of hot glue to secure the switch to the PCB. We can also use hot glue to insulate the exposed pins.

![led_strips_ble-hotglue.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/376/medium640/led_strips_ble-hotglue.jpg?1565726208)

## Power Switch

This allows us to turn off the 3-volt regulator and still recharge a LiPo battery over USB.

![led_strips_ble-switch-glued.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/377/medium640/led_strips_ble-switch-glued.jpg?1565726222)

## Connect Battery

The battery plugs into the port on the side of the feather.

![led_strips_battery-ble.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/378/medium640/led_strips_battery-ble.jpg?1565726234)

## Test Circuit

With the code and libraries uploaded, we can plug in the NeoPixel strip and test out the circuit.

![led_strips_test-circuit.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/379/medium640/led_strips_test-circuit.jpg?1565726284)

# CircuitPython BLE Controlled NeoPixel Hat

## Hat Assembly

## Hat Installation

The Adafruit Feather and LiPo battery fits nicely inside the lining of the hat.&nbsp;Just unfold the flap and drop in the feather and battery.&nbsp;You can secure the electronics but I kept them loose so I can quickly remove them if needed.

![led_strips_hat-install-ble-bat.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/380/medium640/led_strips_hat-install-ble-bat.jpg?1565726703)

## Make A Hole

Create a small incision in the seam of the hat using a sharp hobby knife.

![led_strips_hat-slit.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/381/medium640/led_strips_hat-slit.jpg?1565727086)

## Slit

To make the wiring more discreet, fit the JST connector through the slit.&nbsp;You can use a seam ripper to create a clean opening.&nbsp;Cutting the fabric can leave frayed edges so you’ll need to be careful.

![led_strips_hat-slit-closeup.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/382/medium640/led_strips_hat-slit-closeup.jpg?1565727096)

## Thread JST Cable

With the incision now large enough, you can insert the connector and pull the wiring through.

![led_strips_hat-install-jst.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/383/medium640/led_strips_hat-install-jst.jpg?1565727112)

## Adjust Strip

Take a moment to adjust the placement of the strip and ensure it's in a position that looks straight.

![led_strips_hat-strip-through.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/384/medium640/led_strips_hat-strip-through.jpg?1565727125)

## Affix NeoPixel Strip

I used hot glue to affix the NeoPixel strip to the front of the hat.&nbsp;My glue gun has a fine tipped nozzle which I found to be really helpful.&nbsp;

![led_strips_hat-strip-hotglue.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/385/medium640/led_strips_hat-strip-hotglue.jpg?1565727138)

## Secure NeoPixel Strip

Press the strip onto the hat to make sure the hot glue has a good hold of the fabric.

![led_strips_hat-strip-press.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/386/medium640/led_strips_hat-strip-press.jpg?1565727242)

## Manage Hot Glue Application

You’ll want to be careful not to use too much glue or it may leave a stain on the outside.&nbsp;Otherwise, I found this to work pretty well.

![led_strips_hat-strip-glue-close.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/387/medium640/led_strips_hat-strip-glue-close.jpg?1565727370)

## Install the NeoPixel Strip

And there you have it! That’s how you can add NeoPixels to your hat. You can use the switch to power the circuit on and off.

![led_strips_hat-strip-glued.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/388/medium640/led_strips_hat-strip-glued.jpg?1565727484)

## Adding Bling

You can add [crystals](https://www.adafruit.com/product/4044) to each NeoPixel for additional diffusion.

The crystals appear really nice as is and looks even better with the LEDs on.

![led_strips_hat-loop-gems.gif](https://cdn-learn.adafruit.com/assets/assets/000/079/389/medium640thumb/led_strips_hat-loop-gems.jpg?1565727886)


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

In Stock
[Buy Now](https://www.adafruit.com/product/4062)
[Related Guides to the Product](https://learn.adafruit.com/products/4062/guides)
### Lithium Ion Polymer Battery - 3.7v 500mAh

[Lithium Ion Polymer Battery - 3.7v 500mAh](https://www.adafruit.com/product/1578)
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 500mAh for a total of about 1.9 Wh. If you need a larger (or smaller!) battery, <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/1578)
[Related Guides to the Product](https://learn.adafruit.com/products/1578/guides)
### No-Foil Flat Back Rainbow Crystals for NeoPixel LEDs - 100 pack

[No-Foil Flat Back Rainbow Crystals for NeoPixel LEDs - 100 pack](https://www.adafruit.com/product/4044)
Bedazzle your board with these **No-Foil Flat Back SS16 Rainbow Crystals**. They're a lot like the crystals you see decorating clothes, bags and phones. But unlike most crystals you can buy these have no reflective foil on the back, which means they let light shine through and...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/4044)
[Related Guides to the Product](https://learn.adafruit.com/products/4044/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...

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

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

These NeoPixel strips have 30 digitally-addressable pixel Mini LEDs per meter and are very affordable and are...

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

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

These NeoPixel strips have 144 digitally-addressable pixel Mini LEDs per meter and are very affordable and are only 7.5 mm wide (0.3")&nbsp;if you remove the strip from the...

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

[Flush diagonal cutters](https://www.adafruit.com/product/152)
These are the best diagonal cutters, large super-comfortable grip to use and have strong nippers for perfect trimming of wires and leads. I've used my pair every day for years.

In Stock
[Buy Now](https://www.adafruit.com/product/152)
[Related Guides to the Product](https://learn.adafruit.com/products/152/guides)
### Hakko Professional Quality 20-30 AWG Wire Strippers

[Hakko Professional Quality 20-30 AWG Wire Strippers](https://www.adafruit.com/product/527)
These are the finest wire strippers we have used, and if you have to do a lot of wiring, you will agree! They have soft rounded grips - very comfortable to use, and precision ground notches that do a perfect job every time. No more yanking or twisting to strip wires cleanly and quickly.<br...></br...>

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

## Related Guides

- [Introducing the Adafruit nRF52840 Feather](https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather.md)
- [Halo Energy Sword RP2040](https://learn.adafruit.com/halo-energy-sword-rp2040.md)
- [TRON DISC](https://learn.adafruit.com/trondisc.md)
- [Adafruit NeoPixel Überguide](https://learn.adafruit.com/adafruit-neopixel-uberguide.md)
- [BLE Sniffer with nRF52840](https://learn.adafruit.com/ble-sniffer-with-nrf52840.md)
- [Weather Wise Wifi Umbrella Stand](https://learn.adafruit.com/weather-wise-wifi-umbrella-stand.md)
- [CircuitPython BLE Advertising Beacons](https://learn.adafruit.com/circuitpython-ble-advertising-beacons.md)
- [Prop-Maker Lightsaber](https://learn.adafruit.com/lightsaber-featherwing.md)
- [Introducing Adafruit Feather](https://learn.adafruit.com/adafruit-feather.md)
- [A Logger for CircuitPython](https://learn.adafruit.com/a-logger-for-circuitpython.md)
- [Crickit Powered Maker Ice Cream Truck!](https://learn.adafruit.com/crickit-maker-ice-cream-truck.md)
- [NeoPixel Badge Lanyard with Bluetooth LE](https://learn.adafruit.com/bluetooth-neopixel-badge-lanyard.md)
- [WiFi Jellyfish Lantern with WLED](https://learn.adafruit.com/wifi-jellyfish-lantern-with-wled.md)
- [CircuitPython BLE Crickit Rover](https://learn.adafruit.com/circuitpython-ble-crickit-rover.md)
- [CircuitPython BLE Heart Rate Zone Trainer Display](https://learn.adafruit.com/circuitpython-ble-heart-rate-monitor-gizmo.md)
- [Introduction to Bluetooth Low Energy](https://learn.adafruit.com/introduction-to-bluetooth-low-energy.md)
