What’s a wearable project without LEDs? Designed specifically for wearables, bright RGB LEDs are paired with a constant-current driver chip. The contacts are easily sewn with conductive thread. Use this guide to test your first pixel and start on a blinding wearables project with Circuit Playground Express, FLORA or GEMMA!
Each pixel draws as much as 60mA (all three RGB LEDs on for full brightness white). In theory, FLORA can drive up to 500 pixels at 30 FPS (above which it will run out of RAM). Circuit Playground Express can drive more than that. However, above about 20 pixels (and/or if the overall length of conductive thread exceeds ~6 feet/2 meters), the nontrivial resistance of the thread adds up and can affect the power supply. For large quantities of pixels over 20 or if you need to insulate your circuit, you should upgrade to silicone coated stranded core wire, which will provide better conductivity for the pixels – the current draw will add up fast!
Before you begin, familiarize yourself with the following tutorials:
Hook up three alligator clips to your FLORA as shown: one to VOUT (red), one to D6 (yellow), and one to GND (black). I used a red wire for power and a black wire for ground for clarity, but it doesn’t matter what color you use.
Hook up the other ends of your alligator clips to a single pixel. VOUT (red) connects to the +on the pixel, GND (black) to the –, and A1 (yellow) to the pad marked with an arrow pointing towards the LED on the tiny board (not away from it).
On GEMMA or Gemma M0, the wiring is very similar. Hook up VOUT (red in the picture above) to +, GND to – (black above), and D1 to the inward facing arrow (yellow above).
Install the NeoPixel Arduino library
Installation of the library is as follows:
- Visit the Adafruit_NeoPixel library page at Github.com.
- Select the “Download ZIP” button, or simply click this link to download directly.
- Uncompress the ZIP file after it’s finished downloading.
- The resulting folder should contain the files “Adafruit_NeoPixel.cpp”, “Adafruit_NeoPixel.h” and an “examples” sub-folder. Sometimes in Windows you’ll get an intermediate-level folder and need to move things around.
- Rename the folder (containing the .cpp and .h files) to “Adafruit_NeoPixel” (with the underscore and everything), and place it alongside your other Arduino libraries, typically in your (home folder)/Documents/Arduino/Libraries folder. Libraries should not be installed alongside the Arduino application itself.
- Re-start the Arduino IDE if it’s currently running.
Here’s a tutorial that walks through the process of correctly installing Arduino libraries.
Connect your FLORA and computer with a USB cable.
Install the NeoPixel library and go to File –> Examples –> Adafruit_NeoPixel –> strandtest.
If you cannot find that file in the dropdown menu go back up and reinstall the library.
This will launch a window containing the sample sketch. Upload it to your FLORA or GEMMA with the Upload button.
Once successfully uploaded to your FLORA or GEMMA, the pixel will flash and fade different colors. Congrats, you’ve tested your pixel!
Adafruit does each pixel in the factory, but sometimes they are still defective– you should use this method to test that all three colors (red, green, blue) work on each of your pixels before sewing them into your project!
For GEMMA, you’ll need to change the pin number in the Arduino sketch before uploading. Change “6” to “1”:
Then upload the sample code to GEMMA by pressing the reset button (the red LED should start pulsing) and clicking the “upload” button in the Arduino software.
Sewing More Pixels
The pixels are chainable – so you only need 1 pin/wire to control as many LEDs as you like. They’re easy to sew, and the chainable design means no crossed conductive threads. The output of one pixel connects directly to the input of the next.
To begin sewing, stitch around the data pin of your microcontroller (A1 on Circuit Playground, D1 on GEMMA or Gemma M0 and D6 on FLORA are ideal because they’re right between power and ground), and stitch over to your first pixel.
Make sure that each arrow points away from the microcontroller in a line. Stitch around the input pad tightly, even knotting the thread here to form an extra sturdy connection.
Stitch back to the thread origin and tie the two ends in a square knot. Use clear nail polish to seal this knot and pull the ends tight until it dries. Do not clip the thread tails until later on.
All the positive pads (marked with a +) connect together to form one power bus. Likewise all the negative pads (marked with a –) connect together to form one ground bus.
Here’s what a three-pixel circuit looks like from the back. See the individual data connections in the center and the continuous power and ground buses above and below?
Double check your knots are secure before clipping all your thread tails. Clean up your work space so there aren’t any stray bits of conductive thread hanging around.
Visually inspect your circuit to check for shorts or stray threads.
Plug your microcontroller into your computer with a USB cable. Change the number of pixels in the Arduino sketch or MakeCode project to match the number of pixels in your projects, and make sure the pin number matches what you sewed to. Upload the strandtest sample code as you did when testing a pixel earlier in this guide. Your pixels should light up and animate different colors and patterns.
If they don’t all come on or some later in the chain are flickering, your stitches might not be snug enough against the pads of the circuit board. Double check your sewing and reinforce it where necessary (with the circuit off/unplugged).