Feel the magic of fiber optics!  This guide will lead you through adding fiber optic ruffles to a skirt or dress, and then change lighting modes with a twirl or twitch of your hips.  

You can use an existing dress and add your own ruffles, or make one from whole cloth -- your imagination is the limit.  With a little sewing, a few 3d printed parts and a Flora, you will absolutely light up any room you walk into.  

This technique is perfect for embellishing a prom or wedding dress, or for more advanced sewers, creating a gorgeous ball gown worthy of a fairy princess or snow queen.

Fiber optics are a great choice for a dress to dance in.  They're sturdy and washable, and really versatile.  The fibers hold their shape when gently heated, creating a delightful swirl of light, and they can be lit up in whatever color strikes your fancy, even animated with light patterns, unlike EL wire which is a bit more delicate and can only show one color.  

Side glow fiber optics aren't as bright as EL wire when used with most addressable LEDs, but these 3W Pixies are screaming bright! They easily rival EL wire for brightness... without the squeaky high pitched whine of an EL converter.  Move over, EL wire! Pixie's in town!



  • Soldering iron & accessories
  • 3d printer (optional)
  • Sewing machine or serger with a cording presser foot
  • Heat gun
  • E6000 glue

If this is your first time using Flora, check out the Flora setup guide to get up and running.

You'll need to install a couple libraries to get this code working.

First, open the Arduino library manager:

Search for Adafruit Sensor library and install it

Search for Adafruit Pixie library and install it

Search for Adafruit LSM303DLHC library and install it

There is a great tutorial on how to install Arduino libraries in case you haven't done this before. It’s even simpler if using Arduino version 1.6.5 or newer…from the “Sketch” menu, select “Include Library→Manage Libraries…” and use the install option for each of these. Done!

Then copy and paste the code below into your Arduino IDE.

Plug your Flora in with a USB cable.  Select Flora from your list of boards under the Tools menu, and choose your USB port under the Ports menu.  Press upload.

// SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
// SPDX-License-Identifier: MIT

#include <Adafruit_Pixie.h>
#include "SoftwareSerial.h"
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_LSM303DLH_Mag.h>
#include <Adafruit_LSM303_Accel.h>

int ledMode = 0;  //FIRST ACTIVE MODE

#define NUMPIXIES 5 // Number of Pixies in the fiber optics
#define PIXIEPIN 6

SoftwareSerial pixieSerial(-1, PIXIEPIN);

Adafruit_Pixie strip = Adafruit_Pixie(NUMPIXIES, &pixieSerial);

Adafruit_LSM303_Accel_Unified accel = Adafruit_LSM303_Accel_Unified(54321);
Adafruit_LSM303DLH_Mag_Unified mag = Adafruit_LSM303DLH_Mag_Unified(12345);

const float twirl = 7; // accelerometer threshold for toggling modes -- change this number to change sensitivity
long twirlStart = 0;
long twirlTime = 2000;

// Set your colors for RandomFlash mode here.
// just add new {nnn, nnn, nnn}, lines. They will be picked out randomly
//                                  R   G   B
uint8_t myFavoriteColors[][3] = {{255,   0,   0},   // red
                                 {255,   150,   0},   // orange 
                                 {251, 255, 0},   // yellow
// don't edit the line below
#define FAVCOLORS sizeof(myFavoriteColors) / 3

void setup() 
  // Initialize the sensors
  strip.show(); // Initialize all pixels to 'off

#define NUM_MODES 4  //change this if you add more modes

//------------------MAIN LOOP------------------
void loop() {
    switch (ledMode) {
       case 0: colorWipe(strip.Color(200, 20, 20), 20); break;   //  red
       case 1: colorWipe(strip.Color(20, 200, 50), 20); break;   //   yellow
       case 2: colorWipe(strip.Color(200, 0, 200), 20); break;  // purple
       case 3: rainbowfill(); break;              //rainbow
       case 4: flashRandom(5, 4); break;      // flash      

   // Now read the accelerometer to control the motion.
   sensors_event_t event; 
   // Check for mode change commands


// monitor orientation for mode-change 'gestures'
void CheckFortwirls(sensors_event_t event)
   if (event.acceleration.x > twirl)
     if (millis() - twirlStart > twirlTime)
    colorWipe(strip.Color(0, 0, 0), 10);
    if (ledMode > NUM_MODES){
    ledMode=0; }
   else if (event.acceleration.x < -(twirl + 1))
     if (millis() - twirlStart > twirlTime)
       Serial.println("Twirl Back!");
    colorWipe(strip.Color(0, 0, 0), 10);
    if (ledMode < 0){
   else // no nods in progress
     twirlStart = millis(); // reset timer

void flashRandom(int wait, uint8_t howmany) {

  for(uint16_t i=0; i<howmany; i++) {
    // pick a random favorite color!
    int c = random(FAVCOLORS);
    int red = myFavoriteColors[c][0];
    int green = myFavoriteColors[c][1];
    int blue = myFavoriteColors[c][2]; 

    // get a random pixel from the list
    int j = random(strip.numPixels());
    //Serial.print("Lighting up "); Serial.println(j); 
    // now we will 'fade' it in 5 steps
    for (int x=0; x < 5; x++) {
      int r = red * (x+1); r /= 5;
      int g = green * (x+1); g /= 5;
      int b = blue * (x+1); b /= 5;
      strip.setPixelColor(j, strip.Color(r, g, b));
    // & fade out in 5 steps
    for (int x=5; x >= 0; x--) {
      int r = red * x; r /= 5;
      int g = green * x; g /= 5;
      int b = blue * x; b /= 5;
      strip.setPixelColor(j, strip.Color(r, g, b));


// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);

// Fill the dots one after the other with a color
void rainbowfill() {
  strip.setPixelColor(0, strip.Color(255, 0, 0));
  strip.setPixelColor(1, strip.Color(200, 100, 0));
  strip.setPixelColor(2, strip.Color(0, 255, 0));
  strip.setPixelColor(3, strip.Color(50, 50, 200));
  strip.setPixelColor(4, strip.Color(255, 0, 255));

Solder your Pixie LEDs together as shown in the Pixie Guide, leaving around 2 feet of wire between each pixel.  Since we've got a smaller power source and only a few Pixies, I used 26awg wire for the power and ground lines, and 30awg wire for the data line.

Soldering these pixies together with stranded wire can be a little tricky!  The soldering holes are very, very close together and it's really easy to get a short from one hole to the next.  I found it easiest to solder the power and ground wires back-to-front, and then the data wire front-to-back, to avoid any chance of having stray strands touching. 

Next, solder the Flora and LSM303 together as shown in the Sparkle Skirt tutorial.  The wiring is exactly the same, only we'll be using wires instead of conductive thread, and leaving a bit more space (around 8 inches of wire) between. 

  • LSM303 G --> Flora G
  • LSM303 SDA --> Flora SDA
  • LSM303 SCL --> Flora SCL
  • LSM303 3v --> Flora 3.3v


Lastly, connect the Flora to the Pixies:

  • Pixies -  --> Flora G
  • Pixies +  --> Flora VBATT
  • Pixies IN --> Flora 6

Spend a few minutes preparing for strain relief using zip ties to keep any of the wires from taking all the stress of movement.  You'll sew these components into the dress later on.

If you haven't uploaded your code to the Flora yet, now is a great time to do that.  Plug your battery into the Flora and wiggle the sensor around, and make sure all your Pixies light up and change colors.

Add an on/off switch to your battery as shown in the Neopixel Glow Fur Scarf Tutorial. 

Adding an on/off switch to the battery is optional, since the Flora has an onboard switch you can use, but it's worth your time!  This is a complicated costume, and searching for a teensy switch among all those ruffles can be tricky.


Your measurements will depend on the effect you're going for.  I wanted vertical ruffles, and I wanted them about 5" wide, so that was where I started.  

For vertical ruffles, measure the length of your skirt from waist to floor.  If you want them horizontal or diagonal, measure that distance.  Write this number down.

Your fiber optic fibers should be about 2-3x this length.  For my skirt, I used about 7 feet of fiber.  

When you order the fibers, be sure to order an extra foot or two in length over what you think you'll need -- you can always trim the fibers down but you can't make them any longer! 

Fabric Cutting

The pattern for the ruffles is basically a doughut shape with a slash through one side.  The inner edge (the doughnut hole) is the part that will get sewn to your dress.  The outer edge will have the fibers sewn into it.  

Create a half circle pattern out of some scrap fabric using the measurements shown.  Remember, this is just half the circle -- you're cutting on the fold, so when you unfold the fabric you'll have complete circles.

Fold your ruffle fabric so you can cut multiple ruffles all at once.  A good way to do this is to wrap your fabric around a piece of cardboard that's about the same radius as your doughnut, then slip the cardboard out and voila!  Perfectly aligned folds.  Pin the pattern to the pile of fabric and cut.  

Cut along one of the folded edges to make an open circle, and then tidy up the edges to get rid of any corners.

If your fabric wants to ravel, finish the inner edge of each ruffle with a zigzag stitch or a serger.

Preparing the Fiber

Slice the plastic tube and pull the fibers out.  This is much easier said than done, but a thread ripper and an extra pair of hands will get you there. 

Decide how many fibers you want to put in each ruffle.  I wanted maximum brightness, so each of my ruffles has 3 fibers sewn into it.  This is the most that would fit into my cording presser foot's hole, so that made it easy to decide.

Try passing two or three fibers through your machine's presser foot to see what your options are.  

Since I used 3 fibers in each ruffle, I separated out 3 fibers from the bundle.

Next, we want to add curl to the fibers. 

Find a mailing tube or paper towel roll, or something else heat-resistant with a pleasing diameter.  Wrap your 3 fibers around in a spiral pattern, making sure they don't cross each other.  

Gently heat the whole tube with a heat gun.  You'll see the fibers react and crinkle up a bit when they get hot.  Be careful not to heat them so much that they melt or break, but get them nice and evenly hot.  Let them cool COMPLETELY before you remove them from the tube, and they'll hold their delightfully bouncy spiral shape.

Note: You may find yourself wanting to try this with all 84 fibers at once instead of just 3 fibers at a time.  It seems like a good idea, but it isn't.  If the fibers get too hot and fuse together, they'll break when you try to pull them apart, and there's no fixing that!  So be patient.

Take your 3 fibers and thread them through the hole in your cording presser foot.  

Set your machine to a loose zigzag stitch (or whatever is recommended in your manual).  Be sure to make the stitch length fairly long.  A very short stitch length will cover up the fibers and not let the light come through.  You want enough stitches-per-inch to secure the fiber but not so many that the light gets blocked by too much thread.  

Make sure you have 5-6 inches of fiber pulled through the presser foot, so you have some "lead" for attaching the lights. Stitch along the outer edge of your ruffles, pulling gently on the fibers as you sew.   Your fibers will end up encased in a zigzag thread "tunnel".

Repeat with each ruffle.  

I have 30 ruffles on my skirt.  This may get a little tedious.  You may want a good audiobook for this portion.  I recommend Name of The Wind by Pat Rothfuss.  

Stretch the ruffles out with the extra loose fiber at the top, and pin them to your dress, spacing them artfully. 

Once all the ruffles are done and pinned, sew them in place.

The trick to fiber optics is getting them aligned as nicely as possible above the LED, for maximum brightness.  

This 3d printed cover fits right over the Pixie LED and holds up to 20 fibers in place right above the light.  If you're using 3 fibers per ruffle, that works out to 6-7 ruffles per light.

I found that printing in black filament seemed to work well -- the Pixies are so bright that they blow right through a lighter color of filament and wash out the fiber optic lighting.

If you don't have a 3d printer, you can order them from shapeways

Print them with a nice high resolution, with minimal supports.  

Poke a hole at the top of each ruffle and slip all the fiber leads through to the inside of the dress.

You'll be hooking up multiple ruffles to each Pixie LED.  I had 30 ruffles and 5 Pixies: 30/5 = 6. That means 6 ruffles, containing 3 strands each (18 fibers) per Pixie.

I wanted the different colors dispersed semi-randomly throughout the skirt, instead of having solid color block sections, which made the organization of the fibers a little bit complicated.  I wanted to keep all 18 fibers going to each light in the same general area of the skirt (to avoid lots of fiber leads wrapping around my waist) but didn't want them all next-door to each other.

I used colored pins to mark out which fibers should go to which light, and gathered all the fibers together and secured them with a small rubber band.   

Do not stretch fibers across your zipper opening!

Be careful to leave the zipper opening or closure on your dress free!  You don't want to fiber yourself into the dress permanently.  (At least, I assume you don't)

Slide all the fibers through the top of your Pixie cover.  Make sure you have enough play that nothing's pulling too hard on anything else.  Clip all the fibers at once so they're exactly perfectly the same length.

Slip the fibers through the case until they're just at the bottom of the fiber tube.  Place a Pixie LED in there temporarily, and press the fibers down so they're touching the top of the LED.  Make sure all the fibers light up.

On the outside of the case (at the top where the fibers go in), coat the whole assembly liberally with E6000 glue.  Don't use hot glue or crazy glue here -- hot glue could melt the fibers, and crazy glue will make them disintigrate, stop carrying light, and break.  (Ask Me How I Know)

Once you have all your fibers managed and glued, and the glue has dried completely, sew each Pixie LED into its case using the mounting holes on each side.  Watch it GLOW!

Now it's time to secure the electronic components to your skirt and test it out.

If your skirt isn't lined, you may want to add a lining to protect your wires and fibers and make the whole thing a lot more comfortable.

Find a safe place near the waistband to sew down the LSM303 accelerometer.  Don't choose any place that will get sweaty or you'll short your dress out.  Between the skirt and lining is a great way to go.  Orient the sensor so the arrows indicating "X" are parallel to the ground.  Sew it down with the unused pads.

It's also a great idea to add a little pocket for the battery, so it doesn't pull too much on the electronic components.

Once everything is secure, spend some more time on strain relief.  Tack down the wires so nothing pulls, and make sure everything is comfortable.

Put your skirt on and twirl around a bunch!

There are a few lines in the code you can change in order to change the sensitivity of the sensor.  

const float twirl = 7; // accelerometer threshold for toggling modes -- change this number to change sensitivity
long twirlStart = 0;
long twirlTime = 2000;

The "const float twirl" variable will adjust the sensitivity.  Whole numbers or decimals are OK here.  Change this number until you find a sensitivity that works for you.

The "twirlTime" variable sets the duration of time between sensor checks.  It's set to 2000 (2 seconds).  If you find the modes double-changing before you're done with your twirl, play with this number until you find one that works for you.

This guide was first published on Nov 29, 2015. It was last updated on Nov 29, 2015.