# NeoPixel Flame Torch

## Overview

https://youtu.be/0NKauUmPgF4

## Props & Electronics

Build a 3D printed prop with a realistic looking flame! Use NeoPixels and GEMMA M0 to create a faux yet realistic looking torch. Hidden inside the torch is a mini fan and silk fabric. Use CircuitPython to easily program GEMMA M0 and NeoPixels.

![led_pixels_hero-flame-1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/386/medium640/led_pixels_hero-flame-1.jpg?1598366885)

## 3D Printing & Crafting

We designed and 3d printed the prop to house all of the electronics and features a modular design that allows parts to easily be swapped out. The flame is made from pieces of a silk that are cut and taped to a crossbar fitted over the neopixel jewel.

![led_pixels_hero-flame-3.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/387/medium640/led_pixels_hero-flame-3.jpg?1598366954)

Inspired by Nick Dimelow's [Medieval Torch project](https://www.prusaprinters.org/prints/38051).

## Prerequisite Guides

Take a moment to walk through the following guides.

- [GEMMA M0 Introduction](https://learn.adafruit.com/adafruit-gemma-m0)
- [NeoPixel Uber Guide](https://learn.adafruit.com/adafruit-neopixel-uberguide/)
- [Slide switch JST Adapters](https://learn.adafruit.com/on-slash-off-switches)

## Hardware

List of required hardware.

- 4x M3 x 30mm screws
- 12x M3 hex nuts
- 3x M2.5 x 6mm
- 3x M2.5 hex nuts

## Parts from Adafruit
List of parts used to build the project.

- [Adafruit GEMMA M0](https://www.adafruit.com/product/3501)
- [7x NeoPixel Jewel](https://www.adafruit.com/product/2226)
- [Adafruit 5V MiniBoost](https://www.adafruit.com/product/4654)
- [2200mAh battery](https://www.adafruit.com/product/1781)
- [5VDC Fan](https://www.digikey.com/product-detail/en/cui-devices/CFM-5010-03-10/102-4012-ND/6194920)
- [Slide switch](https://www.adafruit.com/product/805)

![led_pixels_parts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/269/medium640/led_pixels_parts.jpg?1598202899)

### Adafruit GEMMA M0 - Miniature wearable electronic platform

[Adafruit GEMMA M0 - Miniature wearable electronic platform](https://www.adafruit.com/product/3501)
The **Adafruit Gemma M0** is a super small microcontroller board, with just enough built-in to create many simple projects. It may look small and cute: round, about the size of a quarter, with friendly alligator-clip sew pads. But do not be fooled! The Gemma M0 is incredibly...

In Stock
[Buy Now](https://www.adafruit.com/product/3501)
[Related Guides to the Product](https://learn.adafruit.com/products/3501/guides)
![Pink polished fingers holding a Adafruit GEMMA M0 - Miniature wearable electronic platform. ](https://cdn-shop.adafruit.com/product-videos/640x480/3501-05.jpg)

### NeoPixel Jewel - 7 x 5050 RGB LED with Integrated Drivers

[NeoPixel Jewel - 7 x 5050 RGB LED with Integrated Drivers](https://www.adafruit.com/product/2226)
Be the belle of the ball with the NeoPixel Jewel! &nbsp;We fit seven of our tiny&nbsp;5050 (5mm x 5mm) smart RGB LEDs onto a beautiful, round&nbsp;PCB with mounting holes and a chainable design to create what we think is our most elegant (and evening-wear appropriate) NeoPixel board...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2226)
[Related Guides to the Product](https://learn.adafruit.com/products/2226/guides)
![NeoPixel Jewel - 7 x 5050 RGB LED wired to Trinket, lit up rainbow](https://cdn-shop.adafruit.com/640x480/2226-01.jpg)

### Adafruit MiniBoost 5V @ 1A - TPS61023

[Adafruit MiniBoost 5V @ 1A - TPS61023](https://www.adafruit.com/product/4654)
This adorable little board will come in very handy whenever you need a good amount of 5V power. It's the size of a linear regulator, but it's actually a mini-booster! Input 2-5VDC on one side, and **get 5V at up to 1A supply** on the other. Perfect for use with...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4654)
[Related Guides to the Product](https://learn.adafruit.com/products/4654/guides)
![Angled shot of boost converter PCB.](https://cdn-shop.adafruit.com/640x480/4654-03.jpg)

### Lithium Ion Cylindrical Battery - 3.7v 2200mAh

[Lithium Ion Cylindrical Battery - 3.7v 2200mAh](https://www.adafruit.com/product/1781)
Need a big battery for your project? This lithium-ion battery contains a 2200mAh and a protection circuit that provides over-voltage, under-voltage, and over-current protection. Yet, it is slim and easy to fit into many project cases.  
  
This cell can provide 2 **C** of...

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

### Part: Silk Dancing Scarves
quantity: 1
Silk Square Scarf with Hemmed Edges - 6 Colors(24" x 24")
[Silk Dancing Scarves](https://amzn.to/32vImdB)

### Part: Slide Switch
quantity: 1
Slide Switch
[Slide Switch](https://www.adafruit.com/product/805)

### Part: 5VDC Mini Fan
quantity: 1
CFM-5010-03-10
[5VDC Mini Fan](https://www.digikey.com/product-detail/en/cui-devices/CFM-5010-03-10/102-4012-ND/6194920)

### Part: 10-Wire Ribbon Cable
quantity: 1
28AWG Silicone Cover Stranded Core Wire
[10-Wire Ribbon Cable](https://www.adafruit.com/product/3890)

### Part: 3-pin JST cable
quantity: 1
JST PH 3-Pin Socket to Color Coded Cable - 200mm
[3-pin JST cable](https://www.adafruit.com/product/4046)

### Part: 3-pin JST cable
quantity: 1
Plug to Plug 100mm long
[3-pin JST cable](https://www.adafruit.com/product/4336)

![](https://cdn-learn.adafruit.com/assets/assets/000/094/392/medium800/led_pixels_hero-flame-2.jpg?1598367829)

# NeoPixel Flame Torch

## Circuit Diagram

The diagram below provides a visual reference for wiring of the components. This diagram was created using the software package [Fritzing](http://fritzing.org/download/).

## Adafruit Library for Fritzing

Use Adafruit's Fritzing parts library to create circuit diagrams for your projects. Download the library or just grab individual parts. Get the library and parts from [GitHub - Adafruit Fritzing Parts](https://github.com/adafruit/Fritzing-Library/tree/master/parts).

![](https://cdn-learn.adafruit.com/assets/assets/000/094/265/medium800/led_pixels_circuit-diagram.jpg?1598191237)

## Wired Connections

NeoPixel Jewel

- **5V** from Jewel to **3V** on GEMMA
- **GND** from Jewel to **GND** on GEMMA
- **DIN** from Jewel to **D2** on GEMMA

5V MiniBoost

- **VIN** from MiniBoost to **VOUT** &nbsp;on GEMMA
- **GND** from MiniBoost to **GND** on GEMMA

5VDC Fan

- **Voltage** from fan to **5V** on MiniBoost
- **Ground** from fan to **GND** on MiniBoost

## Powering

The Adafruit board can be powered via USB or JST using a 3.7v lipo battery. In this project, a 2200mAh lipo battery is used. The battery is rechargeable with a USB lipo charger. The switch is wired to a JST adapter.

# NeoPixel Flame Torch

## 3D Printing

## Parts List

STL files for 3D printing are oriented to print "as-is" on FDM style machines. Parts are designed to 3D print without any support material. Original design source may be downloaded using the links below.

**File names**

- handle.stl
- pommel.stl
- collar.stl
- torch-bottom.stl
- torch-top.stl
- gemma-mount.stl
- jewel-mount.stl
- flame-bar.stl
- battery-clip.stl

![led_pixels_3d-parts-v2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/271/medium640/led_pixels_3d-parts-v2.jpg?1598233114)

[Fusion 360 Share Link](https://a360.co/2CW4163)
[Download CAD files from PrusaPrinters](https://www.prusaprinters.org/prints/39421-neopixel-led-torch)
[Download CAD files from Thingiverse](https://www.thingiverse.com/thing:4579492)
## CAD Assembly

The GEMMA M0, 5V MiniBoost, switch and NeoPixel Jewel are mounted to both sides of the 5V fan using M3 x 30mm long screws. The GEMMA M0 is press fitted into a PCB mount which is secured to the bottom of the torch cage. The fan is mounted over the GEMMA PCB mount. The NeoPixel Jewel is secured to a separate PCB mount using 2x M2.5 x 6mm long screws and nuts. The NeoPixel Jewel PCB mount is secured on top of the 5V fan. The 2200mAh battery is hidden inside the handle.

&nbsp;

![led_pixels_cad-explode.gif](https://cdn-learn.adafruit.com/assets/assets/000/094/401/medium640thumb/led_pixels_cad-explode.jpg?1598380705)

## Slicing Parts

No supports are required. Slice with setting for PLA material.&nbsp;

The parts were sliced using CURA using the slice settings below.

- PLA filament 220c extruder
- 0.2 layer height
- 10% gyroid infill
- 60mm/s print speed
- 60c heated bed

![led_pixels_cura-slice.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/388/medium640/led_pixels_cura-slice.jpg?1598367113)

## Design Source Files

The project assembly was designed in Fusion 360. This can be downloaded in different formats like STEP, STL and more. Electronic components like Adafruit's board, displays, connectors and more can be downloaded from the [Adafruit CAD parts GitHub Repo](https://github.com/adafruit/Adafruit_CAD_Parts).

![led_pixels_adafruit-gemma-m0.gif](https://cdn-learn.adafruit.com/assets/assets/000/094/389/medium640thumb/led_pixels_adafruit-gemma-m0.jpg?1598367443)

## Installing Top and Bottom Cage

Insert the fingers from the bottom half into the slots on the top half.

![led_pixels_cage-bottom-fit.gif](https://cdn-learn.adafruit.com/assets/assets/000/094/357/medium640thumb/led_pixels_cage-bottom-fit.jpg?1598318177)

## Secure Top and Bottom Cage

Carefully press the fingers inward and lightly apply pressure. Slowly fit the fingers into the slots. With the nubs fitted through, firmly press together to snap fit.

![led_pixels_cage-bottom-install.gif](https://cdn-learn.adafruit.com/assets/assets/000/094/359/medium640thumb/led_pixels_cage-bottom-install.jpg?1598318232)

## Cage Disassembly

The cage halves are designed to be removable. Squeeze all of the fingers inward on the bottom half and gently push the top up and pull them part.

![led_pixels_cage-removal.gif](https://cdn-learn.adafruit.com/assets/assets/000/094/360/medium640thumb/led_pixels_cage-removal.jpg?1598318563)

# NeoPixel Flame Torch

## CircuitPython

Danger: 

[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. The Gemma M0 is the first board that comes pre-loaded with CircuitPython. Simply copy and edit files on the **CIRCUITPY** drive to iterate.

Warning: 

If you've already plugged your board into your computer, you should see a drive called **CIRCUITPY**. The drive will contain a few files. If you want to make a 'backup' of the current firmware on the device, drag-off and save the **CURRENT.UF2** file. Other that that you can ignore the **index.htm** and **info\_uf2.txt** files. They cannot be deleted and are only for informational purposes.

**If you have already plugged in your board, start by ejecting or "safely remove" the CIRCUITPY drive**. This is a good practice to get into. Always eject before unplugging or resetting your board!

## 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/gemma_m0/)
 **Click the link above and download the latest UF2 file.**

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

![adafruit_gemma_GemmaUF2Downloaded.png](https://cdn-learn.adafruit.com/assets/assets/000/049/737/medium640/adafruit_gemma_GemmaUF2Downloaded.png?1514579268)

Plug your Gemma 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.**

Double-click the small **Reset** button opposite the On/Off switch on your board. You will see the Dotstar RGB LED turn green. If it turns red, check the USB cable, try another USB port, etc. **Note:** The little LED next to the On/Off switch will be red - this is ok!

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

![adafruit_gemma_GemmaM0GreenLED.jpg](https://cdn-learn.adafruit.com/assets/assets/000/049/738/medium640/adafruit_gemma_GemmaM0GreenLED.jpg?1514579381)

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

&nbsp;

&nbsp;

&nbsp;

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

![adafruit_gemma_GEMMABOOT.png](https://cdn-learn.adafruit.com/assets/assets/000/049/739/medium640/adafruit_gemma_GEMMABOOT.png?1514587011)

![adafruit_gemma_GemmaDragUF2ToGEMMABOOT.png](https://cdn-learn.adafruit.com/assets/assets/000/049/740/medium640/adafruit_gemma_GemmaDragUF2ToGEMMABOOT.png?1514587039)

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

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

![adafruit_gemma_GemmaCIRCUITPY.png](https://cdn-learn.adafruit.com/assets/assets/000/049/741/medium640/adafruit_gemma_GemmaCIRCUITPY.png?1514587332)

## Further Information
For more detailed info on installing CircuitPython, check out [Installing CircuitPython](../../../../welcome-to-circuitpython/installing-circuitpython).

## Gemma Default Zip Install

Gemma M0 is limited on space. As you begin working on projects, you may run out of space. Operating systems can create hidden files that take up space. To prevent these files from being added to your Gemma, we suggest installing the Gemma Default Zip.

[Download the Gemma Default Zip](https://cdn-learn.adafruit.com/assets/assets/000/046/590/original/gemma_m0_2.0.0.zip)
 **Click the link above to download the default zip.**

&nbsp;

Download and save it to your desktop, or wherever is handy!

![adafruit_gemma_GemmaDefaultZipDownloaded.png](https://cdn-learn.adafruit.com/assets/assets/000/049/742/medium640/adafruit_gemma_GemmaDefaultZipDownloaded.png?1514590151)

If you haven't already, **plug your Gemma into your computer using a known-good USB cable.**

&nbsp;

Make sure your **CIRCUITPY** drive appears.

![adafruit_gemma_GemmaDefaultZipCIRCUITPY.png](https://cdn-learn.adafruit.com/assets/assets/000/049/743/medium640/adafruit_gemma_GemmaDefaultZipCIRCUITPY.png?1514590193)

Once downloaded, **double-click the file to extract the contents.**

![adafruit_gemma_GemmaDefaultZipExtracted.png](https://cdn-learn.adafruit.com/assets/assets/000/049/744/medium640/adafruit_gemma_GemmaDefaultZipExtracted.png?1514590215)

Double click newly extracted folder to open it.

![adafruit_gemma_GemmaDefaultZipFolderOpen.png](https://cdn-learn.adafruit.com/assets/assets/000/049/746/medium640/adafruit_gemma_GemmaDefaultZipFolderOpen.png?1514590284)

To load the files that will keep the system from adding hidden files to your drive, highlight these three files:

**.fseventsd**

**.metadata\_never\_index**

**.Trashes**

&nbsp;

Drag them to your **CIRCUITPY** drive. If it asks to replace any, say yes!

![adafruit_gemma_GemmaDragThreeFiles.png](https://cdn-learn.adafruit.com/assets/assets/000/049/747/medium640/adafruit_gemma_GemmaDragThreeFiles.png?1514590331)

If you'd like to **reset your Gemma to the same files it shipped with** , you can do that with these files. **If you changed main.py, and you want to keep your changes, back up main.py first.**

Highlight all the files in this folder. Drag them all to your CIRCUITPY drive.

If it asks to replace anything, say yes.

![adafruit_gemma_GemmaDragDefaultZipContents.png](https://cdn-learn.adafruit.com/assets/assets/000/049/748/medium640/adafruit_gemma_GemmaDragDefaultZipContents.png?1514590362)

# NeoPixel Flame Torch

## CircuitPython Libraries

Danger: 

Each CircuitPython program you run needs to have a lot of information to work. The reason CircuitPython is so simple to use is that most of that information is stored in other files and works in the background. These files are called _libraries_. Some of them are built into CircuitPython. Others are stored on your **CIRCUITPY** drive in a folder called **lib**. Part of what makes CircuitPython so great is its ability to store code separately from the firmware itself. Storing code separately from the firmware makes it easier to update both the code you write and the libraries you depend.

Your board may ship with a **lib** folder already, it's in the base directory of the drive. If not, simply create the folder yourself. When you first install CircuitPython, an empty **lib** directory will be created for you.

![](https://cdn-learn.adafruit.com/assets/assets/000/105/961/medium800/circuitpython_WtCP_CIRCUITPY_contents.png?1635281033)

CircuitPython libraries work in the same way as regular Python modules so the [Python docs](https://docs.python.org/3/tutorial/modules.html) are an excellent reference for how it all should work. In Python terms, you can place our library files in the **lib** directory because it's part of the Python path by default.

One downside of this approach of separate libraries is that they are not built in. To use them, one needs to copy them to the **CIRCUITPY** drive before they can be used. Fortunately, there is a library bundle.

The bundle and the library releases on GitHub also feature optimized versions of the libraries with the **.mpy** file extension. These files take less space on the drive and have a smaller memory footprint as they are loaded.

Due to the regular updates and space constraints, Adafruit does not ship boards with the entire bundle. Therefore, you will need to load the libraries you need when you begin working with your board. You can find example code in the guides for your board that depends on external libraries.

Either way, as you start to explore CircuitPython, you'll want to know how to get libraries on board.

# The Adafruit Learn Guide Project Bundle

The quickest and easiest way to get going with a project from the Adafruit Learn System is by utilising the Project Bundle. Most guides now have a **Download Project Bundle** button available at the top of the full code example embed. This button downloads all the necessary files, including images, etc., to get the guide project up and running. Simply click, open the resulting zip, copy over the right files, and you're good to go!

The first step is to find the Download Project Bundle button in the guide you're working on.

Info: 

![](https://cdn-learn.adafruit.com/assets/assets/000/111/837/medium800/circuitpython_PB_download_project_bundle_button.png?1652915277)

Warning: 

The Download Project Bundle button downloads a zip file. This zip contains a series of directories, nested within which is the **code.py** , any applicable assets like images or audio, and the **lib/** folder containing all the necessary libraries. The following zip was downloaded from the Piano in the Key of Lime guide.

![](https://cdn-learn.adafruit.com/assets/assets/000/111/838/medium800/circuitpython_PB_downloaded_and_expanded_zip.png?1652915317)

Info: 

When you open the zip, you'll find some nested directories. Navigate through them until you find what you need. You'll eventually find a directory for your CircuitPython version (in this case, 7.x). In the version directory, you'll find the file and directory you need: **code.py** and **lib/**. Once you find the content you need, you can copy it all over to your **CIRCUITPY** drive, replacing any files already on the drive with the files from the freshly downloaded zip.

Info: 

Once you copy over all the relevant files, the project should begin running! If you find that the project is not running as expected, make sure you've copied ALL of the project files onto your microcontroller board.

That's all there is to using the Project Bundle!

# The Adafruit CircuitPython Library Bundle

Adafruit provides CircuitPython libraries for much of the hardware they provide, including sensors, breakouts and more. To eliminate the need for searching for each library individually, the libraries are available together in the Adafruit CircuitPython Library Bundle. The bundle contains all the files needed to use each library.

## Downloading the Adafruit CircuitPython Library Bundle

You can download the latest Adafruit CircuitPython Library Bundle release by clicking the button below. The libraries are being constantly updated and improved, so you'll always want to download the latest bundle.&nbsp;

**Match up the bundle version with the version of CircuitPython you are running.** For example, you would download the 6.x library bundle if you're running any version of CircuitPython 6, or the 7.x library bundle if you're running any version of CircuitPython 7, etc. If you mix libraries with major CircuitPython versions, you will get incompatible mpy errors due to changes in library interfaces possible during major version changes.

[Click to visit circuitpython.org for the latest Adafruit CircuitPython Library Bundle](https://circuitpython.org/libraries)
 **Download the bundle version that matches your CircuitPython firmware version.** If you don't know the version, check the version info in **boot\_out.txt** file on the **CIRCUITPY** drive, or the initial prompt in the CircuitPython REPL. For example, if you're running v7.0.0, download the 7.x library bundle.

There's also a **py** bundle which contains the uncompressed python files, you probably _don't_ want that unless you are doing advanced work on libraries.

# The CircuitPython Community Library Bundle

The CircuitPython Community Library Bundle is made up of libraries written and provided by members of the CircuitPython community. These libraries are often written when community members encountered hardware not supported in the Adafruit Bundle, or to support a personal project. The authors all chose to submit these libraries to the Community Bundle make them available to the community.

**These libraries are maintained by their authors and are not supported by Adafruit.** As you would with any library, if you run into problems, feel free to file an issue on the GitHub repo for the library. Bear in mind, though, that most of these libraries are supported by a single person and you should be patient about receiving a response. Remember, these folks are not paid by Adafruit, and are volunteering their personal time when possible to provide support.

## Downloading the CircuitPython Community Library Bundle

You can download the latest CircuitPython Community Library Bundle release by clicking the button below. The libraries are being constantly updated and improved, so you'll always want to download the latest bundle.

[Click for the latest CircuitPython Community Library Bundle release](https://github.com/adafruit/CircuitPython_Community_Bundle/releases)
The link takes you to the latest release of the CircuitPython Community Library Bundle on GitHub. There are multiple versions of the bundle available. **Download the bundle version that matches your CircuitPython firmware version.** If you don't know the version, check the version info in **boot\_out.txt** file on the **CIRCUITPY** drive, or the initial prompt in the CircuitPython REPL. For example, if you're running v7.0.0, download the 7.x library bundle.

# Understanding the Bundle

After downloading the zip, extract its contents. This is usually done by double clicking on the zip. On Mac OSX, it places the file in the same directory as the zip.

![](https://cdn-learn.adafruit.com/assets/assets/000/105/908/medium800/circuitpython_WtCP_lib_bundle_extracted.png?1635183852)

Open the bundle folder. Inside you'll find two information files, and two folders. One folder is the lib bundle, and the other folder is the examples bundle.

![](https://cdn-learn.adafruit.com/assets/assets/000/105/909/medium800/circuitpython_WtCP_lib_zip_contents.png?1635183864)

Now open the lib folder. When you open the folder, you'll see a large number of **.**** mpy** files, and folders.

![](https://cdn-learn.adafruit.com/assets/assets/000/105/910/medium800/circuitpython_WtCP_lib_bundle_folder_contents.png?1635183871)

## Example Files

All example files from each library are now included in the bundles in an **examples** directory (as seen above), as well as an examples-only bundle. These are included for two main reasons:

- Allow for quick testing of devices.
- Provide an example base of code, that is easily built upon for individualized purposes.

![](https://cdn-learn.adafruit.com/assets/assets/000/105/911/medium800/circuitpython_WtCP_examples_bundle_directory_contents.png?1635184002)

## Copying Libraries to Your Board

First open the **lib** folder on your **CIRCUITPY** drive. Then, open the **lib** folder you extracted from the downloaded zip. Inside you'll find a number of folders and **.mpy** files. Find the library you'd like to use, and copy it to the **lib** folder on **CIRCUITPY**.

If the library is a directory with multiple **.mpy** files in it, be sure to **copy the entire folder to CIRCUITPY/lib**.

This also applies to example files. Open the **examples** folder you extracted from the downloaded zip, and copy the applicable file to your **CIRCUITPY** drive. Then, rename it to **code.py** to run it.

Info: 

# Understanding Which Libraries to Install

You now know how to load libraries on to your CircuitPython-compatible microcontroller board. You may now be wondering, how do you know _which_ libraries you need to install? Unfortunately, it's not always straightforward. Fortunately, there is an obvious place to start, and a relatively simple way to figure out the rest. First up: the best place to start.

When you look at most CircuitPython examples, you'll see they begin with one or more `import` statements. These typically look like the following:

- `import library_or_module`

However, `import` statements can also sometimes look like the following:

- `from library_or_module import name`
- `from library_or_module.subpackage import name`
- `from library_or_module import name as local_name`

They can also have more complicated formats, such as including a `try` / `except` block, etc.

The important thing to know is that **an** `import` **statement will always include the name of the module or library that you're importing**.

Therefore, the best place to start is by reading through the `import` statements.

Here is an example import list for you to work with in this section. There is no setup or other code shown here, as the purpose of this section involves only the import list.

```python
import time
import board
import neopixel
import adafruit_lis3dh
import usb_hid
from adafruit_hid.consumer_control import ConsumerControl
from adafruit_hid.consumer_control_code import ConsumerControlCode
```

Keep in mind, not all imported items are libraries. Some of them are almost always built-in CircuitPython modules. How do you know the difference? Time to visit the REPL.

In the [Interacting with the REPL section](https://learn.adafruit.com/welcome-to-circuitpython/the-repl#interacting-with-the-repl-2977486-14) on [The REPL page](https://learn.adafruit.com/welcome-to-circuitpython/the-repl) in this guide, the `help("modules")` command is discussed. This command provides a list of all of the built-in modules available in CircuitPython for your board. So, if you connect to the serial console on your board, and enter the REPL, you can run `help("modules")` to see what modules are available for your board. Then, as you read through the `import` statements, you can, for the purposes of figuring out which libraries to load, ignore the statement that import modules.

The following is the list of modules built into CircuitPython for the Feather RP2040. Your list may look similar or be anything down to a significant subset of this list for smaller boards.

![](https://cdn-learn.adafruit.com/assets/assets/000/105/967/medium800/circuitpython_WtCP_CP_libs_help_modules_feather_rp2040.png?1635369618)

Now that you know what you're looking for, it's time to read through the import statements. The first two, `time` and `board`, are on the modules list above, so they're built-in.

The next one, `neopixel`, is not on the module list. That means it's your first library! So, you would head over to the bundle zip you downloaded, and search for **neopixel**. There is a **neopixel.mpy** file in the bundle zip. Copy it over to the **lib** folder on your **CIRCUITPY** drive. The following one, `adafruit_lis3dh`, is also not on the module list. Follow the same process for **adafruit\_lis3dh** , where you'll find **adafruit\_lis3dh.mpy** , and copy that over.

The fifth one is `usb_hid`, and it is in the modules list, so it is built in. Often all of the built-in modules come first in the import list, but sometimes they don't! Don't assume that everything after the first library is also a library, and verify each import with the modules list to be sure. Otherwise, you'll search the bundle and come up empty!

The final two imports are not as clear. Remember, when `import` statements are formatted like this, the first thing after the `from` is the library name. In this case, the library name is `adafruit_hid`. A search of the bundle will find an **adafruit\_hid _folder_**. When a library is a folder, you must copy the **entire folder and its contents&nbsp;_as it is in the bundle_** to the **lib** folder on your **CIRCUITPY** drive. In this case, you would copy the entire **adafruit\_hid** folder to your **CIRCUITPY/lib** folder.

Notice that there are _two_ imports that begin with `adafruit_hid`. Sometimes you will need to import more than one thing from the same library. Regardless of how many times you import the same library, you only need to load the library by copying over the **adafruit\_hid** folder _once_.

That is how you can use your example code to figure out what libraries to load on your CircuitPython-compatible board!

There are cases, however, where libraries require other libraries internally. The internally required library is called a _dependency_. In the event of library dependencies, the easiest way to figure out what other libraries are required is to connect to the serial console and follow along with the `ImportError` printed there. The following is a very simple example of an `ImportError`, but the concept is the same for any missing library.

# Example: `ImportError` Due to Missing Library

If you choose to load libraries as you need them, or you're starting fresh with an existing example, you may end up with code that tries to use a library you haven't yet loaded.&nbsp; This section will demonstrate what happens when you try to utilise a library that you don't have loaded on your board, and cover the steps required to resolve the issue.

This demonstration will only return an error if you do not have the required library loaded into the **lib** folder on your **CIRCUITPY** drive **.**

Let's use a modified version of the Blink example.

```auto
import board
import time
import simpleio

led = simpleio.DigitalOut(board.LED)

while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)
```

Save this file. Nothing happens to your board. Let's check the serial console to see what's going on.

![](https://cdn-learn.adafruit.com/assets/assets/000/105/964/medium800/circuitpython_WtCP_serial_console_ImportError.png?1635355664)

You have an `ImportError`. It says there is `no module named 'simpleio'`. That's the one you just included in your code!

Click the link above to download the correct bundle. Extract the lib folder from the downloaded bundle file. Scroll down to find **simpleio.mpy**. This is the library file you're looking for! Follow the steps above to load an individual library file.

The LED starts blinking again! Let's check the serial console.

![](https://cdn-learn.adafruit.com/assets/assets/000/105/965/medium800/circuitpython_WtCP_CP_libraries_ImportError_resolved.png?1635355829)

No errors! Excellent. You've successfully resolved an `ImportError`!

If you run into this error in the future, follow along with the steps above and choose the library that matches the one you're missing.

# Library Install on Non-Express Boards

If you have an M0 non-Express board such as Trinket M0, Gemma M0, QT Py M0, or one of the M0 Trinkeys, you'll want to follow the same steps in the example above to install libraries as you need them. Remember, you don't need to wait for an `ImportError` if you know what library you added to your code. Open the library bundle you downloaded, find the library you need, and drag it to the **lib** folder on your **CIRCUITPY** drive.

You can still end up running out of space on your M0 non-Express board even if you only load libraries as you need them. There are a number of steps you can use to try to resolve this issue. You'll find suggestions on the [Troubleshooting page](https://learn.adafruit.com/welcome-to-circuitpython/troubleshooting).

# Updating CircuitPython Libraries and Examples

Libraries and examples are updated from time to time, and it's important to update the files you have on your **CIRCUITPY** drive.

To update a single library or example, follow the same steps above. When you drag the library file to your lib folder, it will ask if you want to replace it. Say yes. That's it!

A new library bundle is released every time there's an update to a library. Updates include things like bug fixes and new features. It's important to check in every so often to see if the libraries you're using have been updated.

## CircUp CLI Tool

There is a command line interface (CLI) utility called [CircUp](https://learn.adafruit.com/keep-your-circuitpython-libraries-on-devices-up-to-date-with-circup) that can be used to easily install and update libraries on your device. Follow the directions on the [install page within the CircUp learn guide](https://learn.adafruit.com/keep-your-circuitpython-libraries-on-devices-up-to-date-with-circup/install-circup). Once you've got it installed you run the command `circup update` in a terminal to interactively update all libraries on the connected CircuitPython device. See the [usage page in the CircUp guide](https://learn.adafruit.com/keep-your-circuitpython-libraries-on-devices-up-to-date-with-circup/usage) for a full list of functionality

# NeoPixel Flame Torch

## Code

## Coding

This project uses the neopixel library from the CircuitPython. For more information on NeoPixel animations, check out the [LED animation guide](https://learn.adafruit.com/circuitpython-led-animations) and the [NeoPixel Uber Guide](https://learn.adafruit.com/adafruit-neopixel-uberguide/python-circuitpython).

![led_pixels_code-3.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/393/medium640/led_pixels_code-3.jpg?1598369371)

## Download the Adafruit CircuitPython Library Bundle

In order to run the code, we'll need to download a few libraries. Libraries contain code to help interface with hardware a lot easier for us.

Use the [GEMMA M0 page on Installing CircuitPython](https://learn.adafruit.com/adafruit-gemma-m0/circuitpython) to get the library that matches the major version of CircuitPython you are using noted above.

To run the code for this project, we need the three libraries in the Required Libraries list below. Unzip the library bundle and search for the libraries. Drag and drop the files into a folder named **lib** on the **CIRCUITPY** drive (which appears when your board is plugged into your computer via a known good USB cable) if the directory is not already on the GEMMA M0).

## Required Libraries&nbsp;

- **adafruit\_dotstar.mpy**
- **adafruit\_pypixelbuf.mpy**
- **neopixel.mpy**

![](https://cdn-learn.adafruit.com/assets/assets/000/094/395/medium800/led_pixels_circuitpy-drive.jpg?1598369601)

## The Mu Python Editor

Mu is a simple Python editor that works with Adafruit CircuitPython hardware. 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! While you can use any text editor with your code, Mu makes it super simple. [Instructions for Mu are available here](https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor).

![led_pixels_code-2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/394/medium640/led_pixels_code-2.jpg?1598369393)

## Installing or upgrading CircuitPython

You should ensure you have CircuitPython 5.0 or greater on your board. Plug your board in with a known good data + power cable (not the cheesy USB cable that comes with USB power packs, they are power only). You should see a new flash drive pop up.

If the drive is **CIRCUITPY** , then open the **boot\_out.txt** file to ensure the version number is 5.0 or greater.&nbsp;

```python
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit Gemma M0 with samd21e18
```

Click on the download link below to grab the project code directly from GitHub.

## Upload Code

**Ensure the file** is named **code.py** &nbsp;and drop it onto the **CIRCUITPY** drive main (root) directory that appears when your **GEMMA M0** is plugged into your computer via a known good USB data cable. The code will run properly when all of the files have been uploaded including libraries.

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

# NeoPixel Flame Torch

## Silk Flame

## Materials

The flame is cut from silk fabric. These [dance scarves](https://amzn.to/32vImdB) are made from a lightweight material with a low thread count. This pack includes several colors, orange and red being the ones suited for this project.

![led_pixels_flame-parts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/336/medium640/led_pixels_flame-parts.jpg?1598300223)

[flame_cutout.svg](https://cdn-learn.adafruit.com/assets/assets/000/094/342/original/flame_cutout.svg?1598304262)
## Cutting Silk

Print out the template and cut out the shape of the flames. Attach the cutouts to the fabric by taping it to the surface. Use sharp scissors to cut out the shape from the fabric.

Avoid the using fabric that has creases or deformations. These can distort the movement of the flame. Use neat and clean material that with a flat and even surface.&nbsp;

![led_pixels_flame-cutting-tape.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/331/medium640/led_pixels_flame-cutting-tape.jpg?1598299717)

## Flame Template

Carefully remove the template from the fabric and peel off any excess tape or loose threads.

![led_pixels_flame-cut-piece.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/332/medium640/led_pixels_flame-cut-piece.jpg?1598299617)

Danger: 

## Additional Flames

Repeat this process for the second flame.

![led_pixels_flame-cut-pieces.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/333/medium640/led_pixels_flame-cut-pieces.jpg?1598299963)

## Secure Silk Fabric

The silk flames are attached to the crossbar using double-stick tape. Orient the flames with the crossbar so the standoffs are facing down. Reference the photo for correct placement.

Apply double stick tape to all four sides of the crossbar.

![led_pixels_flame-crossbar-taped.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/334/medium640/led_pixels_flame-crossbar-taped.jpg?1598299396)

## Flame Crossbar

Attach the large single flame to the edge along the side of the crossbar. Attach the two thinner flames to the opposite side. Add pieces of double-stick tape to the crossbar first, then carefully place the fabric over.

![led_pixels_flame-crossbar-silk-installed-2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/335/medium640/led_pixels_flame-crossbar-silk-installed-2.jpg?1598299450)

# NeoPixel Flame Torch

## Wiring

## Slide Switch JST Adapter

Use a 2-pin JST female and male cables to get a slide switch JST adapter. This allows the power to be cut from the battery. The switch is wired in-line with the voltage (red) wire.

![led_pixels_switch-jst-cables.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/287/medium640/led_pixels_switch-jst-cables.jpg?1598281815)

## Wired Slide Switch

Solder the ground wires from both JST cables together. Solder the two voltage wires to the middle pin and either side pin on the slide switch. Use pieces of heat shrink tubing to insulate the exposed connections.

![led_pixels_switch-jst-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/273/medium640/led_pixels_switch-jst-wired.jpg?1598280115)

## NeoPixel Jewel JST Cable

A male 3-pin JST cable is soldered to the DIN, 5V and GND pins on the NeoPixel Jewel.

![led_pixels_jewel-jst-cable.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/288/medium640/led_pixels_jewel-jst-cable.jpg?1598281666)

## NeoPixel Jewel JST Cable

Solder the red wire to the 5V pin, the black wire to GND and the white wire to the DIN pin on the back of the NeoPixel Jewel.

![led_pixels_jewel-wiring.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/275/medium640/led_pixels_jewel-wiring.jpg?1598280178)

## Wired NeoPixel Jewel

Double check the solder joints are solid. Note, the cable in the photo is silicone stranded cover ribbon wire.

![led_pixels_jewel-jst-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/274/medium640/led_pixels_jewel-jst-wired.jpg?1598280147)

## Cables for GEMMA M0

A female 3-pin JST cable and 2-wire ribbon cable is soldered to the GEMMA M0.

![led_pixels_gemma-jst-wires.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/276/medium640/led_pixels_gemma-jst-wires.jpg?1598280223)

## Connect 3-pin JST to GEMMA

Solder the white wire to D2, black wire to GND and red wire to 3V.

![led_pixels_gemma-jst-wiring.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/277/medium640/led_pixels_gemma-jst-wiring.jpg?1598280234)

## Connect 2-wire Cable to GEMMA

Solder the 2-wire ribbon cable to the GND and VOUT pins on the GEMMA M0.

![led_pixels_gemma-boost-wiring.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/278/medium640/led_pixels_gemma-boost-wiring.jpg?1598280246)

## Wired GEMMA M0

The ground pin on the GEMMA M0 shares common ground with the JST cable and 2-wire ribbon cable.

![led_pixels_gemma-boost-cable-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/279/medium640/led_pixels_gemma-boost-cable-wired.jpg?1598280283)

## 5V MiniBoost Headers

Install a 4-pin male headers to the 5V MiniBoost. This will make it easier to attach multiple wires to the pins.

![led_pixels_boost-headers.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/280/medium640/led_pixels_boost-headers.jpg?1598280371)

## Installed Headers

Tin the pins on the headers by adding a bit of solder. This will make it easier to attach wires to the pins.

![led_pixels_boost-headers-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/281/medium640/led_pixels_boost-headers-wired.jpg?1598281110)

## 5V DC Fan

The fan comes with pre-soldered ground and voltage wires. Silicone cover stranded core wires can be substituted for stronger more flexible wires.&nbsp; &nbsp;

![led_pixels_fan-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/282/medium640/led_pixels_fan-wired.jpg?1598281132)

## Wiring Gemma and Fan to Boost&nbsp;

The GEMMA M0 and 5V fan are soldered to the pins on the 5V MiniBoost. The 5V MiniBoost provided the fan with proper 5V with 1A current.

![led_pixels_gemma-boost-fan-prewire.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/283/medium640/led_pixels_gemma-boost-fan-prewire.jpg?1598281380)

## Wiring Boost

Solder the wires to the following pins:

- VOUT from GEMMA to VIN on MiniBoost
- GND from GEMMA to GND on MiniBoost
- GND from fan to GND on MiniBoost
- Voltage from fan to 5V on MiniBoost.

![led_pixels_boost-wiring.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/284/medium640/led_pixels_boost-wiring.jpg?1598281178)

## Wired GEMMA and 5V Fan

Double check the solder joints are solid.

![led_pixels_gemma-boost-wired.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/285/medium640/led_pixels_gemma-boost-wired.jpg?1598281695)

## Circuit Testing

Connect the NeoPixel Jewel to the GEMMA M0. Connect the slide switch JST adapter to the GEMMA M0 and 2200mAh battery. Ensure the fan blades are not being obstructed before powering on. Use the switch to power on the circuit. Ensure the on/off switch on-board the GEMMA M0 is set to the ON position.

![led_pixels_circuit-testing.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/286/medium640/led_pixels_circuit-testing.jpg?1598281778)

# NeoPixel Flame Torch

## Assembly

## Secure NeoPixel Jewel to Mount

The NeoPixel Jewel is secured to the jewel-mount.stl using M2.5 x 6mm long screws and hex nuts.

&nbsp;

![led_pixels_jewel-mount-screws.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/299/medium640/led_pixels_jewel-mount-screws.jpg?1598294528)

## Install Hardware for NeoPixel Jewel

Place the NeoPixel Jewel into the center of the jewel-mount and line up the mounting holes. Insert 2x M2.5 x 6mm screws. Secure PCB using 2x M2.5 hex nuts.

![led_pixels_jewel-mount-secured.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/300/medium640/led_pixels_jewel-mount-secured.jpg?1598294714)

## Install Switch to GEMMA Mount

The slide switch JST adapter is press fitted into the built-in holder on the gemma-mount.

![led_pixels_gemma-mount-switch-preinstall.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/301/medium640/led_pixels_gemma-mount-switch-preinstall.jpg?1598295714)

## Installed Switch

Insert the body of the slide into the built-in holder at an angle.

![led_pixels_gemma-mount-switch-installed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/302/medium640/led_pixels_gemma-mount-switch-installed.jpg?1598295729)

## Install 5V MiniBoost

The 5V MiniBoost is secured to the mounting tab on the side of the Gemma mount.

![led_pixels_gemma-mount-boost-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/303/medium640/led_pixels_gemma-mount-boost-install.jpg?1598295778)

## Secure 5V MiniBoost

Use a single M2.5 x 6mm long machine screw and hex nut to secure the 5V MiniBoost to the Gemma mount.

![led_pixels_gemma-mount-boost-installed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/304/medium640/led_pixels_gemma-mount-boost-installed.jpg?1598295868)

## GEMMA Mount

The GEMMA M0 is press fitted into the center of the Gemma mount.

![led_pixels_gemma-mount-preinstall.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/305/medium640/led_pixels_gemma-mount-preinstall.jpg?1598297370)

## Install GEMMA

The GEMMA M0 is inserted at an angle with one side of the PCB fitting under the nub. Carefully flex the gemma-mount to fit the other side of the PCB.

![led_pixels_gemma-mount-bottom.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/306/medium640/led_pixels_gemma-mount-bottom.jpg?1598297386)

## Secured GEMMA

The GEMMA M0 should be secured to the mount with the wires and cables accessible.

![led_pixels_gemma-mount-pcb-installed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/307/medium640/led_pixels_gemma-mount-pcb-installed.jpg?1598297407)

## Installing GEMMA and Fan

The fan and Gemma are secured to the tabs built-in to the top cage.

![led_pixels_cage-preinstall.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/308/medium640/led_pixels_cage-preinstall.jpg?1598297458)

## Install GEMMA Mount

Flip the top cage so the tabs are facing up. Place the Gemma mount over the bottom and line up the four mounting holes.

![led_pixels_cage-gemma-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/309/medium640/led_pixels_cage-gemma-install.jpg?1598297511)

## Install Hardware for GEMMA Mount

Insert 4x M3 x 30mm long screws through the four tabs. These screws are intentionally long in order to fit through the fan and various mounts.

![led_pixels_cage-gemma-screws.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/310/medium640/led_pixels_cage-gemma-screws.jpg?1598297563)

## Secured GEMMA Mount

Insert and fasten four M3 hex nuts onto the threads of the screws. Finger tighten the hex nuts to secure the Gemma mount to the top cage.

![led_pixels_cage-gemma-hexnuts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/311/medium640/led_pixels_cage-gemma-hexnuts.jpg?1598297609)

## Install 5VDC Fan

Place the fan over the top cage and fit the holes through the screws. Press the fan down into the cage so it rests on the hex nuts.

![led_pixels_cage-fan-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/312/medium640/led_pixels_cage-fan-install.jpg?1598297804)

## Secure 5VDC Fan

Insert four more M3 hex nuts onto the threads of the screws to secure the fan to the top cage.

![led_pixels_cage-fan-hexnuts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/313/medium640/led_pixels_cage-fan-hexnuts.jpg?1598298799)

## Install JST for NeoPixel Jewel

Insert the JST connector from the NeoPixel Jewel through the top of the cage and through the opening on the bottom. Reference the photo for correct placement.

![led_pixels_cage-jewel-jst-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/314/medium640/led_pixels_cage-jewel-jst-install.jpg?1598298048)

## Install NeoPixel Jewel Mount

Place the NeoPixel Jewel mount into the top cage with the tabs fitting through the screws.

![led_pixels_cage-jewel-mount-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/315/medium640/led_pixels_cage-jewel-mount-install.jpg?1598298178)

## Secure NeoPixel Jewel Mount

Install and insert four additional M3 hex nuts onto the threads on top of the NeoPixel Jewel mount.

![led_pixels_cage-jewel-mount-hexnuts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/316/medium640/led_pixels_cage-jewel-mount-hexnuts.jpg?1598298247)

## Connect NeoPixel Jewel to GEMMA

Plug in the JST cable from the NeoPixel Jewel to the Gemma.

![led_pixels_cage-gemma-jewel-plug.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/318/medium640/led_pixels_cage-gemma-jewel-plug.jpg?1598298366)

## Connect Switch to GEMMA

Ensure the 2-pin JST cable from the slide switch is plugged into the Gemma M0.

![led_pixels_cage-gemma-switch-plug.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/319/medium640/led_pixels_cage-gemma-switch-plug.jpg?1598298383)

## Install Crossbar

Place the crossbar over the tips of the screws. Press down to fully set the standoffs into the threads of the screws.

![led_pixels_flame-crossbar-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/320/medium640/led_pixels_flame-crossbar-install.jpg?1598298429)

## Flame Test

Test out the placement of the crossbar and silk fabric. Connect the 2200mAh battery to the JST connector on the slide switch. Use the slide switch to power on the circuit.

![led_pixels_cage-circuit-test-2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/321/medium640/led_pixels_cage-circuit-test-2.jpg?1598299504)

## Install Battery to Cage Bottom

Insert the 2200mAh battery through the cage bottom. Reference the photo for correct placement.

![led_pixels_cage-battery-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/322/medium640/led_pixels_cage-battery-install.jpg?1598298513)

## Installed Cage Bottom

Double check all of the wires are fitted inside the cage before snap fitting together.

![led_pixels_cage-bottom-batttery-installed.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/323/medium640/led_pixels_cage-bottom-batttery-installed.jpg?1598298519)

## Assembled Cage

Fully install the cage halves by firmly pressing them together. Test the circuit again to ensure everything is still working properly.

![led_pixels_cage-switch-test.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/324/medium640/led_pixels_cage-switch-test.jpg?1598298533)

## Install Battery through Collar

Fit the 2200mAh battery through the collar. Begin to install the collar by screwing in into the bottom of the cage.

![led_pixels_battery-collar-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/325/medium640/led_pixels_battery-collar-install.jpg?1598298567)

Primary: 

## Install Battery to Handle

Fit the 2200mAh battery through the handle. Begin to install the handle to the collar by screwing it in.

![led_pixels_battery-handle-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/326/medium640/led_pixels_battery-handle-install.jpg?1598298596)

## Install Pommel to Handle

The pommel is screwed into the bottom of the handle.

![led_pixels_handle-pommel-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/327/medium640/led_pixels_handle-pommel-install.jpg?1598298659)

## Final Build

And there you have it! Be sure to tighten all of the parts before handling. Use the slide switch to power the circuit on and off.

![led_pixels_final-build.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/328/medium640/led_pixels_final-build.jpg?1598298667)

## Fueling the flame

Getting the flame to move in a realistic way can be a bit tricky. We found the effect looks the best when it's in low lighting, while in motion or interacting with an additional air stream.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/094/330/medium800/led_pixels_final-build-test.jpg?1598298745)

## Recharge Battery

Remove the battery from the handle and disconnect from slide switch. Use a lipoly USB recharging breakout to recharge the 3.7v 2200mAh battery.

### Adafruit Micro-Lipo Charger for LiPoly Batt with USB Type C Jack

[Adafruit Micro-Lipo Charger for LiPoly Batt with USB Type C Jack](https://www.adafruit.com/product/4410)
Oh so handy, this little lipo charger is so small and easy to use you can keep it on your desk or mount it easily into any project! Simply plug it via any USB C cable into a USB port and a 3.7V/4.2V lithium polymer or lithium ion rechargeable battery into the JST plug on the other end. There...

In Stock
[Buy Now](https://www.adafruit.com/product/4410)
[Related Guides to the Product](https://learn.adafruit.com/products/4410/guides)
![Adafruit Micro-Lipo Charger for LiPoly Batt with USB Type C Jack connected to Lipoly battery and USB cable. ](https://cdn-shop.adafruit.com/640x480/4410-05.jpg)

### Adafruit Micro-Lipo Charger for LiPo/LiIon Batt w/MicroUSB Jack

[Adafruit Micro-Lipo Charger for LiPo/LiIon Batt w/MicroUSB Jack](https://www.adafruit.com/product/1904)
Oh so handy, this little lipo charger is so small and easy to use you can keep it on your desk or mount it easily into any project! Simply plug it via any MicroUSB cable into a USB port and a 3.7V/4.2V lithium polymer or lithium ion rechargeable battery into the JST plug on the other end....

In Stock
[Buy Now](https://www.adafruit.com/product/1904)
[Related Guides to the Product](https://learn.adafruit.com/products/1904/guides)
![Adafruit Micro-Lipo Charger for LiPo/LiIon Batt w/MicroUSB Jack connected to battery. ](https://cdn-shop.adafruit.com/640x480/1904-06.jpg)


## Featured Products

### Adafruit GEMMA M0 - Miniature wearable electronic platform

[Adafruit GEMMA M0 - Miniature wearable electronic platform](https://www.adafruit.com/product/3501)
The **Adafruit Gemma M0** is a super small microcontroller board, with just enough built-in to create many simple projects. It may look small and cute: round, about the size of a quarter, with friendly alligator-clip sew pads. But do not be fooled! The Gemma M0 is incredibly...

In Stock
[Buy Now](https://www.adafruit.com/product/3501)
[Related Guides to the Product](https://learn.adafruit.com/products/3501/guides)
### NeoPixel Jewel - 7 x 5050 RGB LED with Integrated Drivers

[NeoPixel Jewel - 7 x 5050 RGB LED with Integrated Drivers](https://www.adafruit.com/product/2226)
Be the belle of the ball with the NeoPixel Jewel! &nbsp;We fit seven of our tiny&nbsp;5050 (5mm x 5mm) smart RGB LEDs onto a beautiful, round&nbsp;PCB with mounting holes and a chainable design to create what we think is our most elegant (and evening-wear appropriate) NeoPixel board...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2226)
[Related Guides to the Product](https://learn.adafruit.com/products/2226/guides)
### Adafruit MiniBoost 5V @ 1A - TPS61023

[Adafruit MiniBoost 5V @ 1A - TPS61023](https://www.adafruit.com/product/4654)
This adorable little board will come in very handy whenever you need a good amount of 5V power. It's the size of a linear regulator, but it's actually a mini-booster! Input 2-5VDC on one side, and **get 5V at up to 1A supply** on the other. Perfect for use with...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4654)
[Related Guides to the Product](https://learn.adafruit.com/products/4654/guides)
### Lithium Ion Cylindrical Battery - 3.7v 2200mAh

[Lithium Ion Cylindrical Battery - 3.7v 2200mAh](https://www.adafruit.com/product/1781)
Need a big battery for your project? This lithium-ion battery contains a 2200mAh and a protection circuit that provides over-voltage, under-voltage, and over-current protection. Yet, it is slim and easy to fit into many project cases.  
  
This cell can provide 2 **C** of...

In Stock
[Buy Now](https://www.adafruit.com/product/1781)
[Related Guides to the Product](https://learn.adafruit.com/products/1781/guides)
### Breadboard-friendly SPDT Slide Switch

[Breadboard-friendly SPDT Slide Switch](https://www.adafruit.com/product/805)
These nice switches are perfect for use with breadboard and perfboard projects. They have 0.1" spacing and snap in nicely into a solderless breadboard. They're easy to switch no matter what size fingers you have, but not so easy that they'll get flipped by accident. Work great as...

In Stock
[Buy Now](https://www.adafruit.com/product/805)
[Related Guides to the Product](https://learn.adafruit.com/products/805/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)
### 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)
### JST PH 2mm 3-pin Plug-Plug Cable - 100mm long

[JST PH 2mm 3-pin Plug-Plug Cable - 100mm long](https://www.adafruit.com/product/4336)
This cable is a little over 100mm / 4" long&nbsp;and fitted with JST-PH 3-pin connectors on either end.&nbsp;

We dig the solid and compact nature of these connectors and the latch that keeps the cable from coming apart easily. We're carrying these to <a...></a...>

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

## Related Guides

- [NeoPixel Spats with Gemma and MakeCode](https://learn.adafruit.com/neopixel-spats.md)
- [Superhero Power Gauntlet](https://learn.adafruit.com/superhero-power-gauntlet.md)
- [CircuitPython Hardware: LED Backpacks & FeatherWings](https://learn.adafruit.com/micropython-hardware-led-backpacks-and-featherwings.md)
- [Disco Band Camp Jacket](https://learn.adafruit.com/disco-band-camp-jacket.md)
- [3D Printed NeoPixel LED Gas Mask](https://learn.adafruit.com/3d-printed-el-wire-laser-neopixel-led-gas-mask.md)
- [NeoPixel Bracelet](https://learn.adafruit.com/neopixel-bracelet.md)
- [Animated NeoPixel Glow Fur Scarf](https://learn.adafruit.com/animated-neopixel-gemma-glow-fur-scarf.md)
- [Debugging the SAMD21 with GDB](https://learn.adafruit.com/debugging-the-samd21-with-gdb.md)
- [Adafruit IO Home: Lights and Temperature ](https://learn.adafruit.com/adafruit-io-house-lights-and-temperature.md)
- [CircuitPython Hardware: SSD1306 OLED Display](https://learn.adafruit.com/micropython-hardware-ssd1306-oled-display.md)
- [Color Mixing QT Py Cuff Bracelet](https://learn.adafruit.com/color-mixing-qt-py-cuff.md)
- [Phantom Mouse Jiggler](https://learn.adafruit.com/phantom-mouse-jiggler.md)
- [Trinket / Gemma IR Control](https://learn.adafruit.com/trinket-gemma-ir-remote-control.md)
- [Color-sensor Driven NeoPixel Dress](https://learn.adafruit.com/color-sensor-driven-neopixel-dress.md)
- [Mystical LED Halloween Hood](https://learn.adafruit.com/mystical-led-halloween-hood.md)
