# DotStar Fortune Necklace with Bluetooth and Touch

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/097/460/medium800thumb/led_matrices_touch.jpg?1607325917)

## Geometric LED matrix pendant with fortune-telling talent

&nbsp;

Sometimes, you want to be subtle, and sometimes you want to be loud. And sometimes, you just want to ask the Fortunes a simple yes or no question.&nbsp;

![led_matrices_DSC_0557.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/757/medium640/led_matrices_DSC_0557.jpg?1607899103)

Now you can do all that with this modern necklace that looks subtle and simple at first glance, and then turns into a versatile light show with a touch or a tap. It even reaches into the random number universe to answer your categorical questions when you touch it!

This necklace is programmed with CircuitPython and made with the adorable DotStar LED Matrix, powered by the ItsyBitsy nRF52840 so you can easily customize your style over Bluetooth using the Adafruit Bluefruit Connect App!

The front panel is a fascinating black LED acrylic material, which stays opaque until LED lights shine through. It also has a brass piece that acts as a capacitive touch button and a rechargeable battery thanks to the LiPo backpack.&nbsp;

The ItsyBitsy and LiPo battery are all housed inside a case that can be worn behind your neck, and the necklace is connected via a USB micro-B connector, so you can change the electronics housing if you desire. There is a lot of room for customization here to really make this project your own!

![led_matrices_modular.gif](https://cdn-learn.adafruit.com/assets/assets/000/097/466/medium640thumb/led_matrices_modular.jpg?1607330110)

This project requires quite a bit of soldering, so here are some excellent guides if you want to brush up on the basics:

- [Adafruit Guide To Excellent Soldering](https://learn.adafruit.com/adafruit-guide-excellent-soldering "Adafruit Guide To Excellent Soldering")
- [Collin's Lab: Soldering](https://learn.adafruit.com/collins-lab-soldering "Collin's Lab: Soldering")

You'll also need to either laser cut or 3D print the both the pendant frame and electronics case. The black LED acrylic can be milled or laser cut to a simple square shape.

## Parts for Pendant
### Adafruit DotStar High Density 8x8 Grid - 64 RGB LED Pixel Matrix

[Adafruit DotStar High Density 8x8 Grid - 64 RGB LED Pixel Matrix](https://www.adafruit.com/product/3444)
Do not eat this LED grid just because it is so colorful and bite-sized! This is the tiniest little LED grid we could make, with 64 full RGB color pixels in a square that is only 1" by 1" square (thats 25.4mm x 25.4mm for you metric-lovers). Best of all, these are little DotStar LEDs,...

In Stock
[Buy Now](https://www.adafruit.com/product/3444)
[Related Guides to the Product](https://learn.adafruit.com/products/3444/guides)
![Hand holding small Adafruit DotStar High Density 8x8 Grid - 64 RGB LED Pixel Matrix](https://cdn-shop.adafruit.com/640x480/3444-04.jpg)

### Black LED Diffusion Acrylic Panel - 10.2" x 5.1"

[Black LED Diffusion Acrylic Panel - 10.2" x 5.1"](https://www.adafruit.com/product/4749)
&nbsp;nice whoppin' rectangular slab of some lovely black acrylic to add some extra diffusion to your LED Matrix project. This material is 2.6mm (0.1") thick and is made of special cast acrylic that makes it perfect for glowy projects, especially matrices or NeoPixels.

Unlike...

In Stock
[Buy Now](https://www.adafruit.com/product/4749)
[Related Guides to the Product](https://learn.adafruit.com/products/4749/guides)
![LED RGB matrix 10.2" x 5.1" with "Adafruit Industries LED Matrix" text showing, and LED acrylic slowly covering to make it nicely diffused](https://cdn-shop.adafruit.com/product-videos/640x480/4749-02.jpg)

### Part: Silicone Stranded-Core Ribbon Wire - 10 Wire
quantity: 1
For easy neat wiring
[Silicone Stranded-Core Ribbon Wire - 10 Wire](https://www.adafruit.com/product/3890)

### Part: Brass kite shape
quantity: 1
For capacitive touch sensing (choose whatever shape you like!)
[Brass kite shape](https://www.etsy.com/listing/760890902/12-flat-brass-diamond-stamping-blanks)

### Part: Small zip tie
quantity: 1
Secure the wires on top of the pendant
[Small zip tie](https://amzn.to/37YS6QC)

### Part: Double sided foam tape
quantity: 1
Strong enough to stick to acrylic and PCBs

### Part: Super glue
quantity: 1
Get the gel kind so you have a few more seconds before it dries

### Part: Jump ring
quantity: 1
Optional. Makes it easy to attach the pendant to some thread
[Jump ring](https://amzn.to/3qTfhUX)

### Part: Enameled copper wire
quantity: 1
Optional. Use as a thin wire to connect the brass shape to the board.
[Enameled copper wire](https://amzn.to/38lYAsP)

# Parts for Electronics + Power
### Adafruit ItsyBitsy nRF52840 Express - Bluetooth® LE

[Adafruit ItsyBitsy nRF52840 Express - Bluetooth® LE](https://www.adafruit.com/product/4481)
What's smaller than a Feather but larger than a Trinket? It's an **Adafruit ItsyBitsy nRF52840 Express** featuring the **Nordic nRF52840 Bluetooth® LE** processor! Teensy & powerful, with an fast nRF52840 Cortex M4 processor running at 64 MHz and 1 MB...

In Stock
[Buy Now](https://www.adafruit.com/product/4481)
[Related Guides to the Product](https://learn.adafruit.com/products/4481/guides)
![Angled Shot of the Adafruit ItsyBitsy nRF52840 Express - Bluetooth LE.](https://cdn-shop.adafruit.com/640x480/4481-05.jpg)

### Lithium Ion Polymer Battery with Short Cable - 3.7V 420mAh

[Lithium Ion Polymer Battery with Short Cable - 3.7V 420mAh](https://www.adafruit.com/product/4236)
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 420mAh for a total of about 1.55 Wh. If you need a larger (or smaller!) battery, <a...></a...>

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

### Part: USB DIY Slim Connector Shell - MicroB Plug
quantity: 1
To connect the necklace to the ItsyBitsy and power
[USB DIY Slim Connector Shell - MicroB Plug](https://www.adafruit.com/product/1826)

### Part:  LiIon/LiPoly Backpack Add-On
quantity: 1
Power the ItsyBitsy via a rechargeable battery
[ LiIon/LiPoly Backpack Add-On](https://www.adafruit.com/product/2124)

### Part: Slide Switch
quantity: 1
SPDT switch to control power when battery is connected
[Slide Switch](https://www.adafruit.com/product/805)

### Part: Embroidery threads
quantity: 1
Gold thread to wrap necklace cord and allow braiding of wires
[Embroidery threads](https://amzn.to/2VMG8UA)

### Part: 1M (or greater) ohm resistor
quantity: 1
For the capacitive touch pin

### Part: Double sided thin tape
quantity: 1
For securing the battery

### Part: Brass teardrop shape
quantity: 1
Optional. To decorate the electronics case with!
[Brass teardrop shape](https://www.etsy.com/listing/178463091/18-small-flat-brass-teardrop-stamping)

![](https://cdn-learn.adafruit.com/assets/assets/000/097/756/medium800/led_matrices_knolled-raw-stuff?1607897368)

# DotStar Fortune Necklace with Bluetooth and Touch

## Circuit Diagrams

There are two circuits to build: the necklace itself and the ItsyBitsy + power housed inside the case. These are connected via the USB MicroB counterparts. These diagrams will detail which circuit connections need to be made, but we'll go over assembly in more detail later.

## ItsyBitsy and Power Circuit
![](https://cdn-learn.adafruit.com/assets/assets/000/097/559/medium800/led_matrices_power-and-brains-2.jpg?1607500773)

Note that the diagram above doesn't show the exact placement of the components -- it was laid out so that you can easily see the wire connections. Also note that this wiring means that the slide switch will turn off battery power, but it has no effect if the ItsyBitsy is connected to USB.

Here is a table for the connections illustrated above to help make it more clear:

| LiPo backpack | ItsyBitsy | USB micro-B |
|----------------------|---------------|------------------|
| BAT | BAT | - |
| G | G | G |
| 5V | USB | - |
| - | VHi | 5V |
| - | A1 | D- |
| - | A2 | D+ |
| - | D11 | ID |

To make the slide switch a power switch, cut the copper trace between the two through-hole connectors on the **LiPo backpack** next to the **5V** hole, and solder two wires through those to the slide switch.

To support capacitive touch on **D11** , connect a **1MΩ** resistor from **D11** to Ground.&nbsp;

## Necklace LED Matrix Circuit
![](https://cdn-learn.adafruit.com/assets/assets/000/098/053/medium800/led_matrices_pendant-circuit.jpg?1608449193)

The above diagram is a representation of the circuit connections that need to be made between the DotStar 8x8 Matrix and the USB MicroB plug. Note that there is a single MicroB plug pictured, with both of its sides showing.&nbsp;

| DotStar Matrix | USB MicroB plug |
|----------------------|---------------|
| CIN | D- |
| DIN | D+ |
| GND | GND |
| +5v | +5V |
| - | ID (to brass kite)|


# DotStar Fortune Necklace with Bluetooth and Touch

## 3D printing or laser cutting

![](https://cdn-learn.adafruit.com/assets/assets/000/097/938/medium800/led_matrices_DSC_0752.jpg?1608184908)

You can choose either laser cut parts or 3d printed parts for this project. Either way though, you'll need to cut the Black LED Acrylic front piece to the exact size needed. The cut dimensions of the acrylic varies depending on what method you choose:

- If using the laser cut frame, cut the acrylic to **28.73mm x 28.70mm** (the PDF and DXF files include this)
- If using the 3d printed frame, cut the acrylic to **29.02mm x 28.99mm**

The button link below includes both the laser cutter files and the 3d printer files:

[Download Pendant parts on Thingiverse](https://www.thingiverse.com/thing:4688133)
![](https://cdn-learn.adafruit.com/assets/assets/000/097/939/medium800/led_matrices_DSC_0753.jpg?1608186840)

You can also choose between two different types of cases that will hold the electronics and the battery. The hexagonal 3D printed case is a remix of the case from [Neopixel LED Heart Necklace](https://learn.adafruit.com/neopixel-led-heart-necklace "Neopixel LED Heart Necklace") and is quite a bit easier to put together. The laser cut rectangular case will be faster to cut out but requires a bit of glueing. Choose the shape that most pleases you!

The button link below also includes both the laser cutter files and the 3d printer files:

[Download Case parts on Thingiverse](https://www.thingiverse.com/thing:4688138)
# DotStar Fortune Necklace with Bluetooth and Touch

## Pendant wiring and assembly

Prepare the DotStar Matrix

&nbsp;

Cut the mounting tabs off the DotStar matrix and carefully sand down with coarse grit sandpaper to smooth the edges. Test if it press fits into the pendant frame you chose before sanding down any further -- you don't want it too loose.

![led_matrices_DSC_0646.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/947/medium640/led_matrices_DSC_0646.jpg?1608189319)

### Solder wires

&nbsp;

The length of the wires will depend on the diameter of your head since they'll need to be long enough to fit your head through. **20cm** should be a good starting point, adjust as needed.

Tin the pads for all 4 contacts first, and then tin the exposed wires as well before soldering together. Make sure to cut any leads sticking out after.

It will help to use a different color wire for each pad, so that you can easily identify which wire is which later.

&nbsp;

![led_matrices_DSCF4200.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/942/medium640/led_matrices_DSCF4200.jpg?1608188164)

![led_matrices_DSCF4197.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/943/medium640/led_matrices_DSCF4197.jpg?1608188241)

![led_matrices_DSCF4204.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/944/medium640/led_matrices_DSCF4204.jpg?1608188268)

### Make sure that the wires are flat

&nbsp;

Double check that the wires are soldered as flat as possible against the PCB so that it will fit nicely within the pendant frame.

![led_matrices_DSCF4208.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/945/medium640/led_matrices_DSCF4208.jpg?1608188364)

### Attach matrix to the frame

&nbsp;

Using either the 3d printed frame or the laser cut frame, push the wired matrix to the frame, it should just press fit in.&nbsp;

You want the wires to be oriented as shown -- if the top hole is "north", the wires should be "southeast" of the hole. This orientation will ensure that the back cover will protect the wires AND it is the orientation that the code animations are setup for.

![led_matrices_DSC_0653.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/946/medium640/led_matrices_DSC_0653.jpg?1608189087)

![led_matrices_DSCF4212.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/948/medium640/led_matrices_DSCF4212.jpg?1608189491)

![led_matrices_DSC_0652.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/950/medium640/led_matrices_DSC_0652.jpg?1608189866)

### Glue the top cover to the frame

&nbsp;

Using super glue or any other appropriate glue, secure the black LED front cover so that it's aligned with the frame and covers the LED matrix entirely.

Tip: using the "gel" kind for super glue will allow you to have significantly more seconds to align the cover to the frame before the glue dries.

![led_matrices_DSC_0588.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/949/medium640/led_matrices_DSC_0588.jpg?1608189734)

### Secure the back cover

&nbsp;

For laser cut frame only. Secure the back cover using foam double sided tape.

![led_matrices_DSC_0604.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/981/medium640/led_matrices_DSC_0604.jpg?1608198960)

![led_matrices_DSC_0605.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/982/medium640/led_matrices_DSC_0605.jpg?1608198994)

### Solder a wire to the brass shape

&nbsp;

This brass shape will be used as a capacitive touch button. You can use the same wires as the ones used for the matrix, but that will add a bit of bulk to the necklace, so here I've opted to use some thin enameled copper wire instead.

Make sure that you're using a heat resistant silicone surface when soldering the wire to brass like this since the brass piece will get really hot. Check continuity with a multimeter to make sure that the solder joint is good.

![led_matrices_DSC_0616.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/951/medium640/led_matrices_DSC_0616.jpg?1608190148)

### Secure the brass shape onto the cover

&nbsp;

Use some glue or double sided tape, and adjust to your desired position. Pause to admire the beauty that you have created so far :)

![led_matrices_DSC_0621.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/952/medium640/led_matrices_DSC_0621.jpg?1608190536)

### Secure the wires and use embroidery floss for support

&nbsp;

Optionally attach a jump ring through the hole, then use a small zip tie to secure the wires together at the top of the pendant.&nbsp;

Then, tie a piece of embroidery floss either directly through the pendant hole or through the jump ring if you attached one. This will help give the necklace some support, and will allow you to braid the wires together.

The length of the resulting 2 halves of the embroidery thread should be slightly longer than the rest of the wires to account for the braiding in the next step.

![led_matrices_DSC_0626.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/953/medium640/led_matrices_DSC_0626.jpg?1608191044)

![led_matrices_DSC_0630.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/954/medium640/led_matrices_DSC_0630.jpg?1608191182)

![led_matrices_DSC_0635.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/955/medium640/led_matrices_DSC_0635.jpg?1608191211)

### Braid the wires together to form a necklace chain

&nbsp;

Separate the wires and the embroidery floss into two groups. Each group should have either 3 or 4 wires + floss each. Braid each group together to form the necklace chain.

After braiding, secure the end with a simple knot of the embroidery floss. This will be a good time to double check that the braided necklace chain will be long enough such that your head fits through.

![led_matrices_DSC_0637.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/956/medium640/led_matrices_DSC_0637.jpg?1608191627)

![led_matrices_DSC_0638.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/957/medium640/led_matrices_DSC_0638.jpg?1608191656)

At this point, you'll have something that looks like the picture below. Pause here to admire your handy work! :)

![](https://cdn-learn.adafruit.com/assets/assets/000/097/959/medium800/led_matrices_DSC_0641.jpg?1608192043)

### Solder the necklace chain wires to the USB microB plug

&nbsp;

Now that you have double checked that the length of the wires is enough to fit your head through (you did, right?), you can proceed to soldering the ends to the microB plug. First, insert the wires through the two connector pieces as shown. Then, refer to the circuit diagram in the previous page to solder the proper wires. Use the different wire colors to guide you through this step.&nbsp;

Note that the circuit diagram refers to both sides of the microB plug (the 2-pad and 3-pad side)

![led_matrices_DSC_0758.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/016/medium640/led_matrices_DSC_0758.jpg?1608424479)

![led_matrices_DSC_0756.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/017/medium640/led_matrices_DSC_0756.jpg?1608424562)

![led_matrices_DSC_0001.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/018/medium640/led_matrices_DSC_0001.jpg?1608424605)

### Optional: Wrap the necklace chain with gold embroidery floss

&nbsp;

This step is optional because it takes a long time to do, but the result is quite satisfying! It helps if you wrap the embroidery floss around something cylindrical so that you can more easily maneuver the floss around the braided wires.

![led_matrices_EnpZskYVkAA6IXT.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/960/medium640/led_matrices_EnpZskYVkAA6IXT.jpg?1608192608)

![](https://cdn-learn.adafruit.com/assets/assets/000/097/962/medium800/led_matrices_DSC_0754.jpg?1608192929)

Now, you're ready to tackle the next part: the ItsyBitsy wiring with the LiPo battery!

# DotStar Fortune Necklace with Bluetooth and Touch

## ItsyBitsy + Power wiring

Info: 

### Prepare the power slide switch

&nbsp;

Cut one of the side legs, and shorten the remaining two legs. Tin the legs, tin the wires, and solder them together. Cover with heat shrink tubing.

![led_matrices_DSC_0672.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/966/medium640/led_matrices_DSC_0672.jpg?1608194014)

![led_matrices_DSC_0675.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/967/medium640/led_matrices_DSC_0675.jpg?1608194045)

![led_matrices_DSC_0677.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/968/medium640/led_matrices_DSC_0677.jpg?1608194074)

### Prepare the LiPo backpack

&nbsp;

Cut the copper trace between the two holes next to the mounting hole. This will allow us to attach the slide switch that will act as a power switch.

Solder 3 ribbon wires to the through-holes for 5V, BAT and GND. The length of the ribbon wires can be about **5cm**.

![led_matrices_DSC_0663.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/963/medium640/led_matrices_DSC_0663.jpg?1608193538)

![led_matrices_DSC_0664.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/964/medium640/led_matrices_DSC_0664.jpg?1608193674)

![led_matrices_DSC_0694.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/965/medium640/led_matrices_DSC_0694.jpg?1608193793)

### Prepare the USB MicroB port

&nbsp;

Solder 5 ribbon wires onto all 5 through-holes. The length of the ribbon wires can be around **6cm.**

![led_matrices_DSC_0692.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/970/medium640/led_matrices_DSC_0692.jpg?1608194304)

### Combine the ground wires

&nbsp;

Carefully identify the GND wires for both the USB microB port and the LiPo backpack, twist them together, and dab a bit of solder to secure.

![led_matrices_DSC_0695.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/971/medium640/led_matrices_DSC_0695.jpg?1608194940)

![led_matrices_DSC_0695.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/972/medium640/led_matrices_DSC_0695.jpg?1608195033)

### Solder combined GND wires plus resistor to ItsyBitsy

&nbsp;

Take the **combined GND** wires and fit them into **GND** of the ItsyBitsy. Before soldering, fit a **1M** resistor or higher into **GND** as well, and put the other end of the resistor through **D11**.

**Do not solder on D11 yet.**

**BAT** and **5V** from the LiPo backpack connects to **BAT** and **USB** of the ItsyBitsy respectively. Solder these connections.

![led_matrices_DSC_0697.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/973/medium640/led_matrices_DSC_0697.jpg?1608195240)

### Solder USB MicroB's ID to ItsyBitsy's D11

&nbsp;

Carefully identify which wire from the MircoB port is connected to **ID** , and solder that into the ItsyBitsy's **D11** together with the resistor.

This resistor is important to be able to use the brass shape as a capacitive touch button.

![led_matrices_DSC_0699.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/974/medium640/led_matrices_DSC_0699.jpg?1608195638)

### Solder remaining 3 wires from microB port

### &nbsp;

Carefully identify the wires, and connect:

- microB port's **5V** to ItsyBitsy's **VHi**
- microB port's **D-** to ItsyBitsy's **A1**
- microB port's **D+** to ItsyBitsy's **A2**

Once all the wires are soldered, connect the battery to the LiPo backpack and test to see that the green light on the ItsyBitsy turns on.&nbsp;

![led_matrices_DSC_0702.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/975/medium640/led_matrices_DSC_0702.jpg?1608195786)

Now, turn off your soldering iron, find some fresh air away from any lingering fumes, and take a deep breath. You've come quite far in this journey, I'm proud of you. :D

Before we move on with final case assembly, we should setup and load the CircuitPython code into the ItsyBitsy so that we can test and make sure that all our soldered connections work before we stuff everything inside an enclosure!

# DotStar Fortune Necklace with Bluetooth and Touch

## CircuitPython for ItsyBitsy nRF52840 Express

[CircuitPython](https://github.com/adafruit/circuitpython) is a derivative of [MicroPython](https://micropython.org) designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the **CIRCUITPY** drive to iterate.

## Set up CircuitPython Quick Start!

Follow this quick step-by-step for super-fast Python power :)

[Download the latest version of CircuitPython for this board via CircuitPython.org](https://circuitpython.org/board/itsybitsy_nrf52840_express/)
## Further Information

For more detailed info on installing CircuitPython, check out [Installing CircuitPython](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython).

 **Click the link above and download the latest UF2 file.**

Download and save it to your desktop (or wherever is handy).

![adafruit_products_Itsy_nRF_UF2_Download.png](https://cdn-learn.adafruit.com/assets/assets/000/087/069/medium640/adafruit_products_Itsy_nRF_UF2_Download.png?1579288766)

Plug your Itsy nRF52840 into your computer using a known-good USB cable.

**A lot of people end up using charge-only USB cables and it is very frustrating! So make sure you have a USB cable you know is good for data sync.**

In the image, the **Reset** button is indicated by the magenta arrow, and the **BTLE**  **status LED** is indicated by the green arrow.

Double-click the **Reset** button on your board (magenta arrow), and you will see the **BTLE LED** (green arrow) will pulse quickly then slowly blue. If the DotStar LED turns red, check the USB cable, try another USB port, etc.

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

![adafruit_products_ItsynRF_DotStar_Reset.jpg](https://cdn-learn.adafruit.com/assets/assets/000/087/086/medium640/adafruit_products_ItsynRF_DotStar_Reset.jpg?1579292351)

You will see a new disk drive appear called **ITSY840BOOT**.

Drag the **adafruit\_circuitpython\_etc.uf2** file to **ITSY840BOOT.**

![adafruit_products_ITSY840BOOT.png](https://cdn-learn.adafruit.com/assets/assets/000/087/081/medium640/adafruit_products_ITSY840BOOT.png?1579292047)

![adafruit_products_Itsy_nRF_Drag_UF2.png](https://cdn-learn.adafruit.com/assets/assets/000/087/089/medium640/adafruit_products_Itsy_nRF_Drag_UF2.png?1579292454)

The LED will flash. Then, the **ITSY840BOOT** drive will disappear and a new disk drive called **CIRCUITPY** will appear.

That's it, you're done! :)

![adafruit_products_Itsy_nRF_CIRCUITPY.png](https://cdn-learn.adafruit.com/assets/assets/000/087/093/medium640/adafruit_products_Itsy_nRF_CIRCUITPY.png?1579292569)

# DotStar Fortune Necklace with Bluetooth and Touch

## CircuitPython Code

This necklace code uses the excellent Adafruit Bluefruit app, you can get it free for both Android and iOS. Read more about what this app can do in its official guide: [Bluefruit LE Connect for iOS and Android](https://learn.adafruit.com/bluefruit-le-connect)!

[iOS App](https://itunes.apple.com/us/app/adafruit-bluefruit-le-connect/id830125974?mt=8)
[Android App](https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect)
Now that you've set up CircuitPython on the ItsyBitsy and downloaded the app from the links above, we can take a look at the code!&nbsp;

Near the bottom of the page is the code. Click the Download Project Bundle button and save the zip file on your computer.

Plug your ItsyBitsy into your computer with a known good USB data+power cable.

In your File Explorer or Finder (depending on your operating system), navigate in the zip to the files for your CircuitPython version. Copy **code.py** and the **lib** directory to your ItsyBitsy which shows up as a thumb drive named **CIRCUITPY**.

Now your board has all the files. The **CIRCUITPY** drive should have all the files listed below. If not copy them from the zip file.

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

## Going Through the Code

The main `while` loop will be structured like this:

```python
# Initial empty state
state = ""
 
while True:
    # Advertise when not connected.
    ble.start_advertising(advertisement)
 
    while not ble.connected:
        # do something while ble is not yet connected
 
    while ble.connected:
        # Receive packets from Adafruit Bluefruit app
        # Set the state to prevent redundant hits
        # Act upon the current state
        # Also handle touch interrupt
```

The behavior when there is no BLE connection is simple: we detect touch, and then randomly choose Y or N to display. If there's no touch, we display a default, very classy, twinkling animation. Now, you can ask a question of the necklace, and the random number gods will give you the answer you seek!

```python
if touch.value:
  yes_or_no() # Randomly displays 'Y' for yes and 'N' for no.
else:
  twinkle() # Keep it classy.
```

When we are connected over BLE, we then watch out for any packets that come in from the app, and we set the value of the `state` variable accordingly. Setting this state will keep behavior deterministic and will prevent any app double-taps from affecting the necklace. Note that to keep it simple, I've opted to simply use strings and if-statements to track the state here, but you could also use constant variables and/or other data structures to optimize further.

```python
# Set state string based on pressed button from Bluefruit app
# and to prevent redundant hits
if isinstance(packet, ButtonPacket) and packet.pressed:
  # UP button pressed
  if packet.button == ButtonPacket.UP and state != "chase":
    state = "chase"
    # DOWN button
    elif packet.button == ButtonPacket.DOWN and state != "comet":
      state = "comet"
      # ...
```

Finally, we display animations based on the value of the state string, and we choose a different default animation just to indicate to the necklace viewer that Bluetooth is indeed connected. Touch is in a separate if-statement so that it can be triggered in the middle of the other animations.

```python
# Touch is handled as a separate state
if touch.value:
    yes_or_no()

# Act upon the state
if state == "chase":
    chase.animate()
elif state == "comet":
    rainbow_comet.animate()
elif state == "rainbowchase":
    rainbow_chase.animate()
elif state == "hello":
    pixels.fill(0)
    scroll_text(packet, SCROLL_TEXT_CUSTOM_WORD)
else:
    chase.animate()
```

## Installing Project Code

To use with CircuitPython, you need to first install a few libraries, 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 in the **lib** folder and the&nbsp; **code.py** file in a zip file. Extract the contents of the zip file, open the directory **ItsyBitsy\_DotStar\_Necklace/** and then click on the directory that matches the version of CircuitPython you're using and copy the contents of that directory to your **CIRCUITPY** drive.

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

Warning: 

## Test capacitive touch

Now you can connect the necklace via the microB port to test that the twinkling animation and capacitive touch sensing is working. You may need to adjust the threshold of the capacitive touch if it's too sensitive or not sensitive enough.

![](https://cdn-learn.adafruit.com/assets/assets/000/097/976/medium800/led_matrices_DSC_0704.jpg?1608196418)

## Test Bluefruit app interaction

You can now test the interaction with the necklace using the Bluefruit app. Turn on the power switch, and open the Bluefruit app -- you should see your device like so:

![](https://cdn-learn.adafruit.com/assets/assets/000/098/019/medium800/led_matrices_IMG_7168.jpg?1608429011)

&nbsp;Then, press "Connect" and then "Controller" and then "Control Pad". You can then click on the following buttons in the Control Pad screen and see the animations change in the necklace:

- Up button
- Down button
- "1" button
- "2" buton

Go ahead and change the corresponding animations in the code to whatever you choose!

We're almost done. Head on over to final assembly to stuff everything into an enclosure!

# DotStar Fortune Necklace with Bluetooth and Touch

## Final Assembly

You can either choose the 3d printed case or the laser cut case. I recommend the 3d printed case since it's a very slight mod of the excellent case from the [Neopixel LED Heart Necklace tutorial](https://learn.adafruit.com/neopixel-led-heart-necklace "Neopixel LED Heart Necklace tutorial"), and it allows access to the reset button.&nbsp;

If you want something a bit smaller and compact though, the laser cut case is provided here as well (it's slimmer in width, but thicker in depth).

## 3D printed hex case
Carefully slot the ItsyBitsy, LiPo backpack and slide switch as shown -- the model will have dedicated structures to support these parts.

Align the microB usb port to the remaining hole to the left of the switch. Secure it using some double sided foam tape, and make sure that it's right up against the edge of the case. Test that the necklace's microB plug will fit into the plug through the case hole and adjust accordingly.

![led_matrices_DSC_0743.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/977/medium640/led_matrices_DSC_0743.jpg?1608197187)

Connect the battery to the LiPo backpack and place on top of the ItsyBitsy as shown. You may want to tuck it under the wires. There should be no tape needed to secure this battery.&nbsp;

Nudge the wires away from the RESET button before putting on the case cover, making sure to align the RESET button with the button extender.

Optionally, add another brass shape to this case for extra _bling_.

![led_matrices_DSC_0740.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/978/medium640/led_matrices_DSC_0740.jpg?1608197461)

![led_matrices_DSC_0745.jpg](https://cdn-learn.adafruit.com/assets/assets/000/097/979/medium640/led_matrices_DSC_0745.jpg?1608197597)

## Laser cut rectangular case
This case is made up of 4 different types of panels, with finger joints that slot into each other:

1. Top/bottom panels
2. Side panels
3. Necklace port panel
4. Power and charging port panel

![led_matrices_DSC_0705.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/040/medium640/led_matrices_DSC_0705.jpg?1608446825)

### Add thin tape to LiPo battery and foam tape to LiPo backpack

&nbsp;

Then, with the bottom panel and one of the side panels attached perpendicularly, place the battery and the LiPo backpack to the bottom panel as shown in the photo.

The thin tape is needed for the battery so that the ItsyBitsy can fit on top of it and align with Panel #4 (as referenced above).

Fit the switch in the appropriate cutout in Panel #4 and fit that panel with the rest of the case.

![led_matrices_DSC_0727.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/038/medium640/led_matrices_DSC_0727.jpg?1608446568)

![led_matrices_DSC_0717.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/045/medium640/led_matrices_DSC_0717.jpg?1608447314)

![led_matrices_DSC_0719.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/046/medium640/led_matrices_DSC_0719.jpg?1608447444)

### Secure the USB MicroB port in place

&nbsp;

Use foam tape to secure the microB port as shown in the photo. The edge of the port should be as close as possible to the inner edges of the finger joints.

Then, attach Panel #3 (necklace port panel), and make sure that the microB port is aligned with the cutout.

![led_matrices_DSC_0722.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/041/medium640/led_matrices_DSC_0722.jpg?1608446911)

![led_matrices_DSC_0725.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/042/medium640/led_matrices_DSC_0725.jpg?1608446940)

![led_matrices_DSC_0728.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/051/medium640/led_matrices_DSC_0728.jpg?1608448211)

### Place the ItsyBitsy on top of the battery

&nbsp;

Cut some foam tape to fit in the flat areas on the bottom of the board. The foam tape should be thick enough to allow the ItsyBitsy to lay flat. The amount of tape shown in the photo should provide enough resistance when inserting a micro USB plug into the board.

Secure the ItsyBitsy on top of the battery and make sure to align the edge of the ItsyBitsy right up against the panel, centering the microUSB port with the cutout on the panel.

![led_matrices_DSC_0726.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/043/medium640/led_matrices_DSC_0726.jpg?1608447139)

![led_matrices_DSC_0731.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/044/medium640/led_matrices_DSC_0731.jpg?1608447165)

![led_matrices_DSC_0733.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/047/medium640/led_matrices_DSC_0733.jpg?1608447688)

### Close up the case

&nbsp;

Once you're happy with how everything is laid out, you can use super glue or any other appropriate glue on the finger joints to solidify the case.

Secure and glue the last top panel, and if desired, add a bit of flair with another brass shape. The contrast of brass and black here is simply beautiful!

![led_matrices_DSC_0732.jpg](https://cdn-learn.adafruit.com/assets/assets/000/098/049/medium640/led_matrices_DSC_0732.jpg?1608447992)

And that's it! You can now light up the night (or day) with your very own modern geometric LED matrix necklace. Ask the necklace a question, touch for the answer, and may the Fortunes smile upon you.

Below is a photo of the combination of the 3D printed hex case and the laser cut pendant frame, which is definitely my fave combo. Since the parts of this project is quite modular, there's lots of room for customization, and with CircuitPython it's quite easy to change the LED animations. Have fun modifying this project so that it suits your own style!

![](https://cdn-learn.adafruit.com/assets/assets/000/097/980/medium800/led_matrices_DSC_0748.jpg?1608197887)


## Featured Products

### Adafruit ItsyBitsy nRF52840 Express - Bluetooth® LE

[Adafruit ItsyBitsy nRF52840 Express - Bluetooth® LE](https://www.adafruit.com/product/4481)
What's smaller than a Feather but larger than a Trinket? It's an **Adafruit ItsyBitsy nRF52840 Express** featuring the **Nordic nRF52840 Bluetooth® LE** processor! Teensy & powerful, with an fast nRF52840 Cortex M4 processor running at 64 MHz and 1 MB...

In Stock
[Buy Now](https://www.adafruit.com/product/4481)
[Related Guides to the Product](https://learn.adafruit.com/products/4481/guides)
### Adafruit DotStar High Density 8x8 Grid - 64 RGB LED Pixel Matrix

[Adafruit DotStar High Density 8x8 Grid - 64 RGB LED Pixel Matrix](https://www.adafruit.com/product/3444)
Do not eat this LED grid just because it is so colorful and bite-sized! This is the tiniest little LED grid we could make, with 64 full RGB color pixels in a square that is only 1" by 1" square (thats 25.4mm x 25.4mm for you metric-lovers). Best of all, these are little DotStar LEDs,...

In Stock
[Buy Now](https://www.adafruit.com/product/3444)
[Related Guides to the Product](https://learn.adafruit.com/products/3444/guides)
### Black LED Diffusion Acrylic Panel - 10.2" x 5.1"

[Black LED Diffusion Acrylic Panel - 10.2" x 5.1"](https://www.adafruit.com/product/4749)
&nbsp;nice whoppin' rectangular slab of some lovely black acrylic to add some extra diffusion to your LED Matrix project. This material is 2.6mm (0.1") thick and is made of special cast acrylic that makes it perfect for glowy projects, especially matrices or NeoPixels.

Unlike...

In Stock
[Buy Now](https://www.adafruit.com/product/4749)
[Related Guides to the Product](https://learn.adafruit.com/products/4749/guides)
### Lithium Ion Polymer Battery with Short Cable - 3.7V 420mAh

[Lithium Ion Polymer Battery with Short Cable - 3.7V 420mAh](https://www.adafruit.com/product/4236)
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 420mAh for a total of about 1.55 Wh. If you need a larger (or smaller!) battery, <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4236)
[Related Guides to the Product](https://learn.adafruit.com/products/4236/guides)
### Adafruit LiIon/LiPoly Backpack Add-On for Pro Trinket/ItsyBitsy

[Adafruit LiIon/LiPoly Backpack Add-On for Pro Trinket/ItsyBitsy](https://www.adafruit.com/product/2124)
If you have an ItsyBitsy or Pro Trinket you probably know it's the perfect little size for a portable project. This LiPoly backpack makes it really easy to do! Instead of wiring 2 or 3 boards together to make a charging system, this little PCB sits on top of the PCB and allows a...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2124)
[Related Guides to the Product](https://learn.adafruit.com/products/2124/guides)
### USB Micro-B Breakout Board

[USB Micro-B Breakout Board](https://www.adafruit.com/product/1833)
Simple but effective - this breakout board has a USB Micro-B connector, with all 5 pins broken out. Great for pairing with a microcontroller with USB support, or adding USB 5V power to a project.  
  
We use a micro-B connector with through-hole shielding pads for an excellent strong...

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

[Silicone Cover Stranded-Core Ribbon Cable - 10 Wire 1 Meter Long](https://www.adafruit.com/product/3890)
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/3890)
[Related Guides to the Product](https://learn.adafruit.com/products/3890/guides)
### USB DIY Slim Connector Shell - MicroB Plug

[USB DIY Slim Connector Shell - MicroB Plug](https://www.adafruit.com/product/1826)
Make your own USB connections without slicing apart a USB cable and soldering those thin wires inside. This is the 'slim' version of the DIY MicroB Male connector. It's a little more elegant because instead of snapping two pieces together the connector press-fits into the...

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

## Related Guides

- [Adafruit ItsyBitsy nRF52840 Express](https://learn.adafruit.com/adafruit-itsybitsy-nrf52840-express.md)
- [LED Matrix Necklace Pendant](https://learn.adafruit.com/led-matrix-necklace-pendant.md)
- [CircuitPython Sound Box](https://learn.adafruit.com/circuitpython-sound-box.md)
- [Purple People Eater](https://learn.adafruit.com/purple-people-eater.md)
- [Fiber Optic Whip](https://learn.adafruit.com/fiber-optic-whip.md)
- [NeoPixel Infinity Cube](https://learn.adafruit.com/neopixel-infinity-cube.md)
- [HalloWing Interactive Cat Toy](https://learn.adafruit.com/hallowing-cat-toy.md)
- [Introducing Bluefruit LE Micro](https://learn.adafruit.com/bluefruit-le-micro-atmega32u4-microcontroller-usb-bluetooth-le-in-one.md)
- [Zelda: Breath of the Wild – 3D Printed Guardian Sword with NeoPixel LEDs](https://learn.adafruit.com/breath-of-the-wild-guardian-sword-led-3d-printed.md)
- [Animated Flame Pendant](https://learn.adafruit.com/animated-flame-pendant.md)
- [BLE Sniffer with nRF52840](https://learn.adafruit.com/ble-sniffer-with-nrf52840.md)
- [Morning Star POV Double Staffs](https://learn.adafruit.com/pov-dotstar-double-staff.md)
- [TRON DISC](https://learn.adafruit.com/trondisc.md)
- [Tiny LED WiFi Companion Cube](https://learn.adafruit.com/tiny-led-wifi-cube.md)
- [Supernova Poi](https://learn.adafruit.com/supernova-poi.md)
- [NeoPixel Infinity Mirror Coaster](https://learn.adafruit.com/infinity-mirror-coaster.md)
