# NeoPixel Tiara

## Overview

http://youtu.be/gBRODuwfYy4

You can make a crown of light for prom or your birthday this year! A few free-wired NeoPixels make you the cyber-pageant queen.  
  
For this project you will need:

- [Gemma M0](https://www.adafruit.com/product/3501) or&nbsp;[GEMMA v2 wearable microcontroller](http://www.adafruit.com/products/1222 "Link: http://www.adafruit.com/products/1222") (or build on the [GEMMA Starter Pack](http://www.adafruit.com/products/1657))
- seven [sewable NeoPixels](http://www.adafruit.com/products/1260) (or any combination of [pixels](http://www.adafruit.com/category/37_168), NeoPixel rings, or high-density NeoPixel strip) Use "RGB" NeoPixel rings, not "RGBW" type!
- [2x2032 coin cell battery holder](http://www.adafruit.com/products/783 "Link: http://www.adafruit.com/products/783") and [batteries](http://www.adafruit.com/products/654) or [rechargeable lipoly battery](http://www.adafruit.com/products/1317)
- zip ties & hot glue
- [3D printed band, crown](http://www.thingiverse.com/thing:237034), or recycled stiff headband
- [solid core hookup wire](http://www.adafruit.com/products/290)
- sharp [wire strippers](http://www.adafruit.com/products/527)
- sharp [flush snips](http://www.adafruit.com/products/1368)

Glamour shots by Andrew Tingle.

Info: 

Before you get started, follow the&nbsp;[Gemma M0 guide](../../../../adafruit-gemma-m0/circuitpython-digital-in-out?view=all)&nbsp;or the&nbsp;[Classic Introducing&nbsp;GEMMA guide](../../../../introducing-gemma/introduction)&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/013/835/medium800/gemma_Pixel_Tiara_443.jpg?1390941702)

# NeoPixel Tiara

## Build it!

![](https://cdn-learn.adafruit.com/assets/assets/000/013/856/medium800/gemma_tiara-diagram.png?1391019801)

Info: 

Above is the circuit diagram for the simple tiara. All ground pads are connected to GND on GEMMA, likewise all power pads are connected to Vout on GEMMA, and data lines are chained from D1 to the inward facing arrow on the first pixel, then from each pixel's outward facing arrow to the next pixel's inward facing arrow.

Strip the insulation from a long piece of solid-core hookup wire and clip it to one side of your headband. This will be the pixels' ground bus.  
  
Insert perpendicular wires through holes in the headband and curl their stripped ends around the long ground bus wire.  
  
Crimp wire connections with pliers.

![gemma_pixel-tiara-adafruit-01.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/830/medium640/gemma_pixel-tiara-adafruit-01.jpg?1390939427)

![gemma_pixel-tiara-adafruit-02.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/831/medium640/gemma_pixel-tiara-adafruit-02.jpg?1390939564)

![gemma_pixel-tiara-adafruit-03.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/832/medium640/gemma_pixel-tiara-adafruit-03.jpg?1390940717)

![gemma_pixel-tiara-adafruit-04.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/833/medium640/gemma_pixel-tiara-adafruit-04.jpg?1390941011)

Be sure wire connections are tidy enough to nest snugly against the hair band, and solder connections in place.

![gemma_pixel-tiara-adafruit-05.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/834/medium640/gemma_pixel-tiara-adafruit-05.jpg?1390941619)

![gemma_pixel-tiara-adafruit-06.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/837/medium640/gemma_pixel-tiara-adafruit-06.jpg?1390945370)

![gemma_pixel-tiara-adafruit-07.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/838/medium640/gemma_pixel-tiara-adafruit-07.jpg?1390947713)

Trim wires to the silhouette you like, then strip the ends. Bend the stripped ends over and hand the NeoPixels from them (through the pad marked -). Solder all NeoPixels, making sure they're facing the same way.

![gemma_pixel-tiara-adafruit-08.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/841/medium640/gemma_pixel-tiara-adafruit-08.jpg?1390948745)

![gemma_pixel-tiara-adafruit-09.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/844/medium640/gemma_pixel-tiara-adafruit-09.jpg?1390949806)

![gemma_pixel-tiara-adafruit-10.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/846/medium640/gemma_pixel-tiara-adafruit-10.jpg?1390953269)

![gemma_pixel-tiara-adafruit-13.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/847/medium640/gemma_pixel-tiara-adafruit-13.jpg?1390953442)

Next use bits of wire in the shape of staples to connect up the data lines.

![gemma_pixel-tiara-adafruit-14.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/848/medium640/gemma_pixel-tiara-adafruit-14.jpg?1390954224)

Solder wires from the + side of each pixel, and cut to length. Strip the ends and solder to one long power bus.

![gemma_pixel-tiara-adafruit-15.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/849/medium640/gemma_pixel-tiara-adafruit-15.jpg?1390971265)

![gemma_pixel-tiara-adafruit-16.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/850/medium640/gemma_pixel-tiara-adafruit-16.jpg?1390971810)

Connect power, ground, and data lines to GEMMA at the input end of the pixel chain. Plug in over USB and program it up! This basic sketch flashes the seven pixels randomly:

![gemma_pixel-tiara-adafruit-17.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/851/medium640/gemma_pixel-tiara-adafruit-17.jpg?1390974790)

![gemma_pixel-tiara-adafruit-21.jpg](https://cdn-learn.adafruit.com/assets/assets/000/013/852/medium640/gemma_pixel-tiara-adafruit-21.jpg?1390975760)

![](https://cdn-learn.adafruit.com/assets/assets/000/013/857/medium800/gemma_pixel-tiara-adafruit-00.jpg?1391020338)

Get creative with your tiara design! This one uses a NeoPixel ring in the center, and the wiring is barely different than above.

# NeoPixel Tiara

## Arduino Code

Info: 

[Click to Download the NeoPixel Library](https://github.com/adafruit/Adafruit_NeoPixel/archive/master.zip)
Installing Arduino libraries is a frequent stumbling block. If this is your first time, or simply needing a refresher, please read the&nbsp;[All About Arduino Libraries](http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use)&nbsp;tutorial.[![](../../../../assets/divider_icon-45a76f14a0234c47f43488c60c9d77a1701a0ff9f3a09498809a26305ce3df23.gif)](../../../../neopixel-punk-collar/3634)If the library is correctly installed (and the Arduino IDE is restarted), you should be able to navigate through the “File” rollover menus as follows:  
  
**File→Sketchbook→Libraries→Adafruit\_NeoPixel→strandtest**  
  
Connect up your NeoPixels in a solderless breadboard and use alligator clips to attach to GEMMA, referring to the circuit diagram if necessary.  
  
You’ll need to change a few lines in the code regarding the data pin (1), type of pixels (RGB vs GRB), and number of pixels (5). The resulting (and slightly simplified) code is below:

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/NeoPixel_Tiara/NeoPixel_Tiara.ino

From the&nbsp; **Tools→Board** &nbsp;menu, select&nbsp;the&nbsp;device you are using: **&nbsp;**

- **Adafruit Gemma M0**
- **Adafruit Gemma 8 MHz** &nbsp;

Connect the USB cable between the computer and your device. The original Gemma (8 MHz) need the reset button pressed on the board, then click the upload button (right arrow icon) in the Arduino IDE. You do not need to press the reset on the newer Gemma M0.

When the battery is connected, you should get a light show from the LEDs. All your pixels working? Great! You can take apart this prototype and get ready to put the pixels in the collar. Refer to the&nbsp;[NeoPixel Uberguide](../../../../adafruit-neopixel-uberguide)&nbsp;for more info.

# NeoPixel Tiara

## CircuitPython Code

![](https://cdn-learn.adafruit.com/assets/assets/000/047/423/medium800/adafruit_gemma_gemma-cp.jpg?1508355373)

 **GEMMA&nbsp;M0** &nbsp;boards can&nbsp;run&nbsp; **CircuitPython** &nbsp;— a different approach to programming compared to Arduino sketches. In fact,&nbsp; **CircuitPython comes&nbsp;factory pre-loaded on GEMMA&nbsp;M0**. If you’ve overwritten it with an Arduino sketch, or just want to learn the basics of setting up and using CircuitPython, this is explained in the&nbsp;[**Adafruit GEMMA&nbsp;M0 guide**](../../../../adafruit-gemma-m0/circuitpython-setup-1).

Info: 

Below is CircuitPython code that works&nbsp;similarly (though not exactly the same) as the Arduino sketch shown on a prior page. To use this, plug the GEMMA M0 into USB…it should show up on your computer as a small&nbsp; **flash drive** …then edit the file “ **code.py** ” with your text editor of choice. Select and copy the code below and paste it into that file,&nbsp; **entirely replacing its contents** &nbsp;(don’t mix it in with lingering bits of old code). When you save the file, the code should&nbsp; **start running almost immediately** &nbsp;(if not, see notes at the bottom of this page).

**If GEMMA M0 doesn’t show up as a&nbsp;drive, follow the GEMMA M0 guide link above to prepare the board for CircuitPython.**

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

This code requires the&nbsp; **neopixel.py** &nbsp;library. A factory-fresh board will have this already installed. If you’ve just reloaded the board with CircuitPython, create the “lib” directory and then&nbsp;[download neopixel.py from Github](https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel).

[Download neopixel.py from GitHub](https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel)
# NeoPixel Tiara

## Wear it!

![](https://cdn-learn.adafruit.com/assets/assets/000/013/836/medium800/gemma_Pixel_Tiara_465.jpg?1390941692)

Plug in a coincell battery holder or rechargeable lipoly battery! You can pin the battery up into your hairdo or attach to the tiara with glue.   
  
Glamour shots by Andrew Tingle.


## Related Guides

- [Sewable NeoPixels](https://learn.adafruit.com/flora-rgb-smart-pixels.md)
- [Portable 5in Monitor with HDMI](https://learn.adafruit.com/portable-5in-monitor-with-hdmi.md)
- [Infinity Mirror Valentine's Candy Box](https://learn.adafruit.com/infinity-mirror-candy-box.md)
- [3D Printed Starro Face Mask](https://learn.adafruit.com/3d-printed-starro-face-mask.md)
- [Crickit Lab Shaker](https://learn.adafruit.com/crickit-lab-shaker.md)
- [Spy Theme Playback Device](https://learn.adafruit.com/spy-theme-playback-device.md)
- [Fisher-Price USB Foot Pedal](https://learn.adafruit.com/fisher-price-usb-foot-pedal.md)
- [DIY Desktop Calculator with CircuitPython ](https://learn.adafruit.com/diy-rpn-desktop-calculator-with-circuitpython.md)
- [Color-sensor Driven NeoPixel Dress](https://learn.adafruit.com/color-sensor-driven-neopixel-dress.md)
- [Digi-Key IoT Studio Mini Smart Home](https://learn.adafruit.com/digikey-iot-studio-smart-home.md)
- [Control Electronics with your Brain using NextMind](https://learn.adafruit.com/control-electronics-with-your-brain-using-nextmind.md)
- [CPX Glowing Disembodied Hand](https://learn.adafruit.com/cpx-glowing-disembodied-hand.md)
- [Annoy-O-Matic Sound Prank Device](https://learn.adafruit.com/annoy-o-matic-sound-prank-device.md)
- [Disco Band Camp Jacket](https://learn.adafruit.com/disco-band-camp-jacket.md)
- [Four Channel Audio Passive Stereo Mixer](https://learn.adafruit.com/four-channel-audio-passive-stereo-mixer.md)
- [Low-Tech Buzzing Operation Game](https://learn.adafruit.com/low-tech-operation-game.md)
