Keep that New Years resolution of getting fit by staying safe with a neopixel motion activated running band powered by Flora, Adafruit's wearables electronics platform.

This is the activity monitor you'll want to wear outside and at the dance club!

Flexible Filament

NinjaFlex is a specially formulated thermoplastic elastomer (TPE) that produces flexible prints with elastic properties. This material is both strong and smooth. The filament properties enable you to create printable parts for wearable electronics projects. Flexible filament works with most FD 3D printers that use 1.75mm or 3mm filament.

Flora Band

The band is designed to be worn on your wrist or fore arm. It's a classic 6-hole adjustment band that has pins that snap into the holes. A cover fits on the bottom of the circuit and your wrist secures the components in place.
Body Band
About 45 minutes
6g
NinjaFlex @220
No Raft
No Support
2.0 Layer Height
45/150mm/s
Cover
About 15 minutes
3g
NinjaFlex @220
No Raft
No Support
2.0 Layer Height
45/150mm/s

Printing Techniques

Build Plate Preparations
There's a great video tutorial by Dr. Henry Thomas who demonstrations a great technique for preparing acrylic build plates for awesome prints. Wipe down the plate with a paper towel lightly dabbed in acetone. Use another paper towel and apply a tiny dab of olive oil. Wipe down the plate so a small film of oil is applied, this will allow the parts to come off the plate easier.

Live Level
We recommend going raft-less for each piece because it will have the best quality result. Each piece will require a well leveled platform. We tend to "live level" our prints, meaning we adjust the build plates thumb screws while the print is laying down filament. This way we can make adjustments directly and improve the leveling by seeing how the extruders are laying down the first layer onto the build plate. We recommend watching the first layer so that you get a more successful print. If you see the layers aren't sticking or getting knocked off, you can always cancel print, peel it off and try again.

Prototyping

Use alligator clips to test the circuit before soldering the components. Lets start with getting the accelerometer to light up the neopixel ring. We can use USB to power the FLORA after we have our components clipped together.

Accelerometer

  • GND to GND
  • SCL to SCL
  • 3V to 3.3V
  • SDA to SDA

NeoPixel Ring

  • IN to D10
  • GND to GND
  • Vcc to VBATT

Arduino Sketch

Copy the code below into your Adafruit Arduino IDE and click Upload. The colors can be specified in the myFavoriteColors array, and the sensitivity to motion can be defined with MOVE_THRESHOLD.
#include <Wire.h>
#include <Adafruit_LSM303.h>
#include <Adafruit_NeoPixel.h>

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_RGB     Pixels are wired for RGB bitstream
//   NEO_GRB     Pixels are wired for GRB bitstream
//   NEO_KHZ400  400 KHz bitstream (e.g. FLORA pixels)
//   NEO_KHZ800  800 KHz bitstream (e.g. High Density LED strip)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(16, 10, NEO_GRB + NEO_KHZ800);
Adafruit_LSM303 lsm;

// Here is where you can put in your favorite colors that will appear!
// just add new {nnn, nnn, nnn}, lines. They will be picked out randomly
//                                  R   G   B
uint8_t myFavoriteColors[][3] = {{200,   0, 200},   // purple
                                 {0,   117,   255},   // blue 
                                 {200, 200, 200},   // white
                               };
// don't edit the line below
#define FAVCOLORS sizeof(myFavoriteColors) / 3

// mess with this number to adjust TWINklitude :)
// lower number = more sensitive
#define MOVE_THRESHOLD 300

void setup() 
{
  Serial.begin(9600);
  
  // Try to initialise and warn if we couldn't detect the chip
  if (!lsm.begin())
  {
    Serial.println("Oops ... unable to initialize the LSM303. Check your wiring!");
    while (1);
  }
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() 
{
  // Take a reading of accellerometer data
  lsm.read();
  Serial.print("Accel X: "); Serial.print(lsm.accelData.x); Serial.print(" ");
  Serial.print("Y: "); Serial.print(lsm.accelData.y);       Serial.print(" ");
  Serial.print("Z: "); Serial.print(lsm.accelData.z);     Serial.print(" ");

  // Get the magnitude (length) of the 3 axis vector
  // http://en.wikipedia.org/wiki/Euclidean_vector#Length
  double storedVector = lsm.accelData.x*lsm.accelData.x;
  storedVector += lsm.accelData.y*lsm.accelData.y;
  storedVector += lsm.accelData.z*lsm.accelData.z;
  storedVector = sqrt(storedVector);
  Serial.print("Len: "); Serial.println(storedVector);
  
  // wait a bit
  delay(100);
  
  // get new data!
  lsm.read();
  double newVector = lsm.accelData.x*lsm.accelData.x;
  newVector += lsm.accelData.y*lsm.accelData.y;
  newVector += lsm.accelData.z*lsm.accelData.z;
  newVector = sqrt(newVector);
  Serial.print("New Len: "); Serial.println(newVector);
  
  // are we moving 
  if (abs(newVector - storedVector) > MOVE_THRESHOLD) {
    Serial.println("Twinkle!");
    flashRandom(5, 1);  // first number is 'wait' delay, shorter num == shorter twinkle
    flashRandom(5, 3);  // second number is how many neopixels to simultaneously light up
    flashRandom(5, 2);
  }
}

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));
      strip.show();
      delay(wait);
    }
    // & 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));
      strip.show();
      delay(wait);
    }
  }
  // LEDs will be off when done (they are faded to 0)
}

Flora Band Pin Out Diagram

Each components pin is marked as reference points for making soldering process easier.

Mark Pinouts

Use a thing sharpie marker to make the reference dots. Follow the circuit diagram for the pin layout.

Make Holes

Use a fairly large needle to puncture the marked reference points. Strench them out so that the 30 gauge wire can thread through the body of the band.

Thread Wires

Use lengthy stripes of 30 gauge wire wrap to thread through the marked reference points. Pull the wires through so they are about half-way through the body of the band.

Tinning Flora Pads

It's best to tin the pads of the Flora with solder so that you can easily solder the wire once threaded to the body of the band.

Thread Flora

Align up the usb port of the flora with the cut out on the inside of the body. Thread the appropriate wire to the pads of the Flora.

Solder Flora

Strip the tips of the wires. Bend the striped tips of the wire on the Flora down so that they're secure while applying solder to the pads.

Secure Flora

Position flora into place by pressing down inside the body. It needs to be nice and flush with the band so the components are tightly packaged.

Thead NeoPixel Ring

Thread the appropriate wires to the NeoPixel ring and position it so its flush with the body of the band.

Secure NeoPixel Ring

Once the wires are threaded, bend down the wires so that the NeoPixel ring is secure while soldering.

Trim Wiring

Pull the access wire that's soldered on the NeoPixel so that it's flush to the band and trim the wire.

Solder Flora Wiring

Solder the 30 gauge wire to the appropriate pins on the NeoPixel Ring.

Trim NeoPixel Wiring

Trim the access wire using scissors or diagonal wire cutters.
The solder connections would be trimmed and clean for a nice look

Position Accelerometer

Thead the 30 gauge wire through the appreciate pins on the LSM303 accelerometer sensor so its in the center and flush with the body of the band.

Lock it Down

Bend down the wiring on the LSM303 so its tightly secure into place.

Solder LSM303

Strip the wiring on the accelerometer and bend down the tips to secure the wires. Solder the pins to make the connections solid.

Clean & Trim Wiring

Trim down the access wire from the accelerometer so its nice and clean.
Prep the JST Extension cable
Measure the length of the cable from the JST ConnectOR to the USB port.
Build Switch
Cut the positive (Red) cable in half and solder to one of the pins on the slide switch. Remember to slide a small piece of heat shrink to seal the connections.
Battery Cable size
Shorten the battery cable by carefully cutting the wires and then heat shrinking each wire connection.
Use a third hand tool to help keep the wires aligned, solder and heat shrink the wires together.
Reroute Power

For a compact circuit we can reroute the power by soldering the JST Extension cable to the on-board battery connection.

Make sure to leave the onboard power to on.

Pop the slide switch through the cavity for a tight fit

Carefully position the battery on top of the circuit.

Align the back cover to the cut out of the slide switch

Press down on the edges of cover to protect the circuit.

The USB cut out allows you to easily plug into to the flora to reprogram sketches.

The pins on the band snap in to securely hold the body together.

This guide was first published on Jan 09, 2014. It was last updated on Jan 09, 2014.