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.

Image

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.

Image

 

video:https://www.youtube.com/watch?v=we5B_0A3pG0

Advertisements

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

#include

#define PIN 11

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

int sampleWindow = 50;

//#include
//
//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()
{
Serial.begin(9600);
strip.begin();
strip.show(); // Initialize all pixels to ‘off’

startSampling();
}

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
startSampling();
}
// otherwise, keep getting samples
else
{
keepSampling();
}

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

// reset the timer
time = 0;
}

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

// increase time
time++;
sampleTime++;
}

// 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));
}
strip.show();

// update i and j
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.