I made a rainbow led belt!

Went into the lab today to finish up the led belt I started yesterday. Yesterday, I sewed it for a couple hours, measuring out the fabric, folding it in half, sewing it, trimming off the excess, then folding, sewing, and trimming a second time so that the fabric would be stable and not too transparent. I then slipped in the weatherproof led strip (which was the larger strip shown in one of my previous code test videos), and decided to call it a night.


Today, I went back, and tried on the belt. Realizing it was much to wide to fit in belt loops, I sewed the facbric sleeve as narrow as I could get it around the weatherproof strip. Then I glued velcro onto my second squarewear and the fabric, and hooked up the led strip. It’s really quite pretty. My only complaint is that the code is not very responsive to the light sensor at all, but I went back and looked through the code, and couldn’t figure out why.




Being Creative

I went in to TA hours last night, and soldered some of the connections to make them more secure. But after doing this, my suspenders were still being very glitchy.

Here’s a video of me wearing them:  https://www.youtube.com/watch?v=wWi_LGDsgyc

As an attempt to make some connections more reliable, I decided to try painting a few of them with conductive paint. However, there are no paintbrushes in the lab, so i went rummaging around and made a paintbrush out of some braided wire. Image

However, I don’t think this has helped much, and I’m looking for some other solutions

Long Hours of Hard Work

I sat working in the lab today from 1:00 pm to 6:15 pm hand-stitching together the suspenders. I used hand-stitching to tack lines of conductive thread from the chains of rgb leds to the Squarewear I am using as the main open source hardware for the project.(http://www.adafruit.com/blog/2013/11/27/squarewear-2-0-arduino-compatible-wearablewednesday/ImageImageImageImageImageImageTo attach the conductive threads to the squarewear without crossing them, I sewed on some small metal snaps, and tied the conductive threads to these snaps. I then connected these snaps to the proper pins on the Squarewear using some wire I cut and stripped with scissors. As a result, the circuit for the suspenders is now complete, though it’s very glitchy and temperamental. I will post a video of the suspenders soon.

It’s Funny, But When I Set Out to Make Wearables, I Never Expect to do This Much Hand Sewing

less with sticking connecting them (both front and back of suspenders shown)

leds with hand-stitching connecting them (both front and back of suspenders shown)

It’s taking a really long time to stitch all these LEDs together into a chain on the suspenders. In addition to attaching them to the suspenders themselves, (which took about 6 hours), I have to hand sew connections between the LEDs, which requires three lines of conductive thread connecting all the LEDs. This probably took another 5 hours….

Edit: I’ve discovered that a lot of the connections I made between leds on the front of the suspenders unraveled. A good way to secure knots it by covering them with clear nail polish, which did manage to save some of my connections, although I ended up having to redo half of them.

Finally Got My Code to Work!!!

I finally got my rainbow cycle code to work properly with the microphone input. It’s really sensitive now and reacts really well.

If your curious, here is my code:

//This is a code that combines Neopixel code with input from a mic


#define PIN 11

// hook up the out of the mic to analog input A2
//#define MIC_IN 2
#define MIC_IN A2

int sampleWindow = 50;

//HIDSerial serial;

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic ‘v1’ (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);

double brightness = .1;
int defaultSpeed = 15;
int lightingSpeed = defaultSpeed;
int time = 0; // start time at 0
uint16_t i = 0;
uint16_t j = 0;

// for mic
// this will be the highest peak, so start it very small
int signalMax;

// this will be the lowest peak, so start it very high
int signalMin;

// will hold the current value from the microphone
int sample;

// keep track of how long we’re sampling
int sampleTime;

void setup()
strip.show(); // Initialize all pixels to ‘off’


void loop() {

// if we just finished a sampling sound window
if ( sampleTime >= sampleWindow )
double soundSensed = getSoundSample();
lightingSpeed = round(60/((1+soundSensed)));

Serial.println( lightingSpeed );

// and restart sampling
// otherwise, keep getting samples

// if enough time has passed
if ( time >= lightingSpeed )
// light the next dot

// reset the timer
time = 0;

//wait 1 ms between loops
delay( 1 );

// increase time

// this is the function that makes the led strip cycle through the colors
void rainbowCycle()
// if end of j loop, reset
if ( j >= 256*5 )
j = 0;

for(i=0; i< strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));

// update i and j

// Input a value 0 to 255 to get a color value.
// The colours are a transition r – g – b – back to r.
uint32_t Wheel(byte WheelPos)
if(WheelPos < 85) {
return strip.Color(brightness * WheelPos * 3, brightness * (255 – WheelPos * 3), 0);
} else if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(brightness * (255 – WheelPos * 3), 0, brightness * WheelPos * 3);
} else {
WheelPos -= 170;
return strip.Color(0, brightness * WheelPos * 3, brightness * (255 – WheelPos * 3));

void startSampling()
// this will be the highest peak, so start it very small
signalMax = 0;

// this will be the lowest peak, so start it very high
signalMin = 1024;

// start sample timer
sampleTime = 0;

void keepSampling()
// read a value from mic and record it into sample variable
sample = analogRead( MIC_IN );
// Serial.print(sample);

// toss out spurious readings
if (sample signalMax)
// this is the new max — save it
signalMax = sample;
// otherwise, if the current sample is smaller than the min
else if (sample < signalMin)
// this is the new min — save it
signalMin = sample;


double getSoundSample()
// now that we’ve collected our data,
// determine the peak-peak amplitude as max – min
int peakDifference = signalMax – signalMin;

// give it back to the caller of this method
return peakDifference;

Finicky Code

I’d altered the code, and worked with my professor to try to work out some bugs. Today, we figured out that the soundSensed program I copied from some old code took too long to spit out information to properly work with the altered led code to get the light strip to respond better with the sound sensed from the microphone. I’ve sent the code to my professor, and plan on working with her to get all this sorted out tomorrow.

Beginning Construction

Still having problems with my code, but I’m off for Thanksgiving break, and I decided a good project to take with me was sewing the leds onto the suspenders, thus beginning construction. I’d originally intended to use a Neopixel led strip from Adafruit, but then realized that the suspenders are elastic, and need to stretch, but the continuous led strip of made of a plastic, which understandable has no give in it at all. Luckily, when ordering supplies I’d ordered a few of these Neopixel flora individual leds intended for wearable projects. (http://www.adafruit.com/products/1260) Sewing these on individually will not prevent the suspenders from fitting properly. However, these pixels are rather costly, and come out to be about $2 each unless you are ordering massive quantities of them.

Edit: I had not expected how long it would take to sew these pixels on. Although they look quite nice, in total it probably took me about 6 hours to sew all 16 pixels onto the suspenders.

It Seems that Every Time I Fix Something, Something Else is Still Broken

It’s been an interesting lab today. I got a working microphone from a classmate, and hooked that up with one of the led strips that my professor told me was fixed, only to have a lot of trouble getting the led strip to work. It turns out the jumper cables I was using to connect the led strip to the Arduino were pretty unreliable, so I soldered wires onto the strip that would more easily plug into the Arduino, and tried to move forward from there. When I plugged everything into the board to do a finall test before building the suspenders I had intended to build last week, neither my laptop nor the mac I’d been using in the lab would upload the code. They both even rejected the simplest Blink sample code for a few minutes, but after waiting a bit, I was able to upload code eventually, though both computers will just spontaneously quit. I sat working with one of my TAs, Nikki, trying to figure this out, but we got nowhere. I’m still not able to get the leds to light up from my sample code. I think I will begin building the suspenders themselves and schedule a meeting with my professor to sort out the code. 

Code is All About the Details

Went to TA hours with Nikki and we discovered that the reason the Serial monitor on Arduino wasn’t working was that we forgot to write Serial.begin(); into the setup. This means we never launched the serial monitor. I then went through the serial monitor, and printed out the sound sensed. Initially, the amount of sound sensed from the microphone varied slightly, and now it is constant, and doesn’t change no matter how loudly I scream at the microphone. I fear my microphone may have died. I’ve put in another hour and half, with little tangible progress…


I spent at least 2 hours today working with my code when I finally got my hands on a led strip I borrowed from a friend. Initially, I thought my code worked, but it doesn’t seem to have much response to any input from the microphone. When I tried to switch my code and microphone over to the Arduino Uno so I could run the serial monitor, I ran into serious problems. I wanted to use the serial monitor to analyze the input received from the microphone, but whenever I try to run it, nothing happens. I’m not sure if this is a problem with my code or my computer settings. My professor and I suspect it has do do with my computer settings, but I don’t know, and there’s not much I can do to progress from here until I figure it out, especially since I still don’t have a working led strip. I may have to use the small individual flora neopixels that I bought for my second project, and order more later. I think if I can’t make much progress with the code, I will at least move forward with building, since I finally got my hands on a pair of suspenders.