Sunday, December 8, 2013

And it's all done!

Just some final soldering/sewing.  I had some trouble getting everything to connect properly, but I de-soldered two wires and reconnected them in a more logical fashion, so that improved this greatly.  Here I'm sewing the SquareWear into the skirt, which was difficult to do without catching the outer chiffon layer (which I did a few times, prompting several restarts and some frustration).
SquareWear and battery placed, and all systems go!  I attached the battery with Velcro so that it can be replaced in the future but sewed down the wires connecting it to the SquareWear so that they wouldn't get in the way while dancing.
Lighting up red...
...and lighting up purple, at a different angle.
Time in the lab: ~2 hours
So excited to wear this for dance class tomorrow!  And for CS Week!  And for the final presentation on Thursday!

Saturday, December 7, 2013

Oh my God, it works...!

Just checking that everything I did yesterday still works.  Yes, I'm paranoid, but with very good reason! 
Challenge #1 of today: attach the tilt sensor to SquareWear so that it sticks out over the skirt ribbon in the back.
This proved to be a very difficult challenge.  I first experimented with some solder but found that it burned the SquareWear rather than attaching anything, so I remembered the hot glue gun and that worked pretty well.  Only major problem?  I attached the tilt sensor on the wrong way so had to rip it out before the glue dried too hard.  All's well that ends well, though, because the glue held nicely in the proper alignment.
Challenge #2: attach copper wire to GND, VCC, SCL, and SDA ports.
This was also pretty hard.  I had to strip the wires to the exact right length, else they would cross and mess up all the connections, something I'm a little too familiar with.  I ended up stripping a lot of excess wire to get everything to the right length.  Here's my first attempt at connecting to VCC (which proved to be the easiest).
Attaching to GND.  A bit tricky with making sure nothing crossed, but it worked out.
The final product!  I used some needle-nosed pliers to pull the tilt sensor legs away from one another and give space so that the copper wires wouldn't cross.  I then covered the unused legs with hot glue just to be safe.  I'm proud of the result: it doesn't look terribly messy.
Challenge #3: does it actually work?
I was absolutely terrified to hook everything up and turn on the power button.  For the sound-in project a few weeks ago, I had wired everything but, when I turned on the power, nothing worked.  So, basically, I was scared out of my wits at what would happen with this.  Holding my breath, I switched on SquareWear.  My heart basically fell through my feet when the lights didn't immediately turn on but, a fraction of a second later, everything was up and running and responding perfectly to the tilt sensor!  That split second was the time it took for the current to get running.  I nearly fainted with happiness!
Time spent in lab: 2 hours, 15 minutes

I can actually taste my skirt's completion.  I estimate another hour of work, maybe two, and then it will be done.  I only have to solder three connections and attach the SquareWear...!!!!!

Friday, December 6, 2013

Skirt construction

Lucky for me, the Neopixel strand comes with an adhesive backing, so I just peeled back the layer and stuck the lights directly on the skirt's lining; it seems to be sticking just fine, so I'm delighted that I don't have to use hot glue or sew it into place.  It's a real time-saver at this point!
It took me a really long time to figure out how to wire the D1 (D10 for SquareWear) connection.  I tried to use my thin jewelry wire, but, for some reason, the solder just wouldn't grab onto it.  Thicker wire worked pretty well, so I'm fine using that.  I put the electrical tape on the 5V and GND connections to make sure nothing crossed while I was testing.
...and speaking of testing!  I was petrified that things wouldn't work, so I decided to test the connection with just the D1/10 pin soldered on.  To my delight, everything works properly!
I finished off tonight's work by sewing the wire into place above the lights so that it wouldn't move around and disrupt the connection.  That surprisingly took a long time, but at least it's done now.  You can't even see the wire when the chiffon layer is pulled over it, so that's a plus.

I spent a bit over an hour in the lab tonight.  More work to come, but I'm almost there!

Thursday, December 5, 2013

MANY hours in the lab today...


After testing the lights with two SquareWears and two different tilt sensors, something weird was going on, especially since the code was written properly.  So, while I was testing the lights and becoming frustrated that they were responding erratically, I noticed that, if I wiggled the strand or pushed down on it in certain places, the lights would switch on and off.  This led me to think that there was maybe something wrong with the connections between each of the LEDs from one to the next.  Audrey suggested soldering one section together to see if that worked to stabilize the lights, and it did!  Ridiculously happy, I proceeded to spend an hour soldering about 110 connections with three strips per connection for a grand total of 300+ connections.  Even though I'm not going to be using the entire strand, I wanted to solder all the connections for the next person to use the lights.  I don't want them to have to spend time being confused as to why the lights were so unpredictable!

I tested the lights several times throughout this process to make sure that everything was still working properly, and I am relieved to say that I now have a consistent response from the strand.

Having finished that, it was time to make the skirt!  I decided to hand-sew the lining into the existing chiffon skirt, mostly because I couldn't figure out the sewing machine and didn't want to come back to the lab later.  I figured that it would be more efficient to use a method that I was familiar with, and it took less than an hour to sew everything in properly.  Unfortunately, when I tried it on, I discovered that the fabric for the lining doesn't stretch like the chiffon does, so I had to unpick a few stitches.  The main problem is that it's too long, so I'll cut the lining down to maybe an inch or so, just enough for the lights.  Tomorrow, I'm aiming to embed the technology and start testing!

The grand total of hours for this?  FIVE!  But it was worth every moment.  This was definitely the most satisfying work I've done on this project and, despite the long consecutive hours, I felt happy and productive and like I knew what I was doing.  I honestly didn't think I'd get to that point, but I have, and I am so proud!

SquareWear testing with lights draped over a chair (out of view)

Soldering the connections.  Proud of the artsy photo :)  I definitely had some scary moments with this because, sometimes, the soldering iron would burn/melt the plastic coating or not pick up the solder properly.  All in all, no burns or injuries or bad connections, so I'd consider it a success!
Testing successfully after properly soldering connections!!
Sewn-in lining with taped-on lights.  Managed to poke myself with the needle too many times.  I'll be cutting down the lining length a bit so that I can actually wear the skirt without it puckering too much.

Wednesday, December 4, 2013

Week of 12/4/13

Lots of work happened in the two classes this week!

I've finally gotten to the point where I can start making the actual skirt, since I'm pretty confident that the lights will be working properly.  Audrey modified the code so that the rainbow cycle would change depending on the direction of the tilt of the wearer, and it looks so cool!  It worked just fine for me with Arduino but, when I tried to switch over to SquareWear today, the lights started flashing and acting up.  I cut off the first line in the string because it had died (?), but it still was reacting strangely to the tilt sensor: it either didn't light up or reacted properly for a few moments, then got stuck on either red or green.  I wonder why it would default to those colors.

In terms of actually making the skirt, I will definitely be all finished by Sunday.  I've cut the under-layer down to size (mostly) and attaching the LEDs really shouldn't be too tricky.  The only challenging part is running a wire from one side to the other so that I don't have to cut the strand apart.  Then, I'll make a small compartment for the SquareWear with an opening for the on/off switch.  And then I'll be done!  I'm hoping to wear the skirt to dance class on Monday and for CS week.

Monday, November 25, 2013

The code works!!!

Five minutes at TA hours, and the code for the lights responding to the tilt sensor works!!!  I am so unbelievably happy!  I can't get the video to upload, but I'm so proud of it.

11/25/13: Class and office hours

THE TILT SENSOR IS FINALLY WORKING!!  The new code prints out logical values for the x and y axes that change in a predictable and understandable manner.  Unlike the raw data, this is useable and finally makes sense to me.

I only need to worry about two axes now (x and y) and can disregard z, since the new code doesn't recognize any motion in the z direction.  My short-term goal is have one strand of LEDs respond to tilt in the x direction and light up a different color depending on if the motion is in the negative or positive direction.  I will then code for another strand of lights to respond for the y axis.  To do this, I am transferring my Neopixel code from the raw-tilt-sensor-and-Neopixel-strand-combined code.  I've successfully compiled the sketch for just the x-direction, but the LEDs aren't reacting.  However, I feel optimistic that this isn't a huge problem to solve.  I have to go to other appointments now but will return for an hour or so tonight to try to finish this up before I leave for break.

New orientation of tilt sensor and Arduino
The beginnings of new combined code

Sunday, November 24, 2013

TA hours 11/24/13

Two hours in the TA session today (30 minutes with Nikki, the rest with Shani), and the tilt sensor has stopped functioning.  I wrote code to combine the tilt sensor and the Neopixel lights, and everything compiled properly, but it doesn't actually work in real life because of the situations the axes find themselves in.  That is, x can be greater than y but still less than z, so the tilt sensor just doesn't know what to do with the data.

Shani and I tried to figure out the new code from Audrey, but neither of us really understands what's going on with it.  We uploaded it to the Arduino and opened the serial monitor, and it basically just spewed out an incoherent stream of letters, which means that something's not hooked up properly.  We went to the blog where the code came from and tried to reconfigure the tilt sensor, but it still doesn't work.

Next, Shani and I focused in on my code, and I decided that it would be best to comment out one of the axes (x) so that the tilt sensor could be more focused.  It actually does respond and changes colors but then freezes and stops reading the data.  I don't know what to do about this.  It has happened multiple times, and I have no solution right now.

Thursday, November 21, 2013

TA hours 11/21/13

I went to Nikki's TA hours tonight (9:00-10:15...she's a saint), and she's helping me write the code I need for the tilt sensor to read values the way I need it to.  We've had to modify (again) the idea, so this what I will be doing:

  • The tilt sensor will read values in a certain range from the x, y, and z axes
    • We figured out the range by holding the tilt sensor on my back (where it will be placed on the skirt) and rotating around the different axes; from this, we found several ranges of values we don't want the sensor to use because they're too sensitive
  • After storing these values, the code compares x to y and z and then y to x and z to determine which is greater and light up the LED strand in that way (there will be specific colors or patterns for each axis pattern)
  • If neither of these works (i.e. equal values), the code will light the LEDs according to the z way, which must be true if neither x nor y are
Here's the document with my notes:

Nikki helped me write most of this, and I'm working on how to incorporate the LEDs now.  I feel a lot's coming along!

(for 11/20/13)

I'm finally starting to work out how the tilt sensor functions.  From the work during class (and from Audrey's advice), I'm going to work with the gyroscope instead of the accelerometer, since time is running short and the accelerometer seems to be really unreliable.  I was shaking it and moving it with different speeds along the different axes but the values changed without making a lot of sense.  Because this, my design needs to be modified a bit.  I was initially going to separate the lights and spread them out underneath the chiffon layer of the skirt, but now, to accommodate the altered code, I will just attach the light strips around the ribbon (belt) of the skirt.  I think this will still be an interesting project and viable in the marketplace.  Here are my notes from the class about going forward:

Should change to gyroscope instead of accelerometer
·         X = rotating around center
·         Y = leaning forward/backward
·         Z = tilting side to side

If rotating on x-axis, light strip red
If tilting on y-axis, light strip blue
If tilting on z-axis, light strip green
If not tilting on x-, y-, or z-axis, light rainbow cycle

The text in red is the code I intend to write.

I've figured out the axes for the tilt sensor (at least in one particular orientation).  The videos won't upload right now, but I have them on my phone.

Tuesday, November 19, 2013


I've been sitting in TA hours for a little while, looking at my code and wondering what the difference between the "ax" and "gx" values are.  This seems obvious now, but I'm so excited to have figured out (by myself!) that "a" corresponds to the acceleration values and "g" corresponds to the gyroscope values!  I started to Google the tilt sensor and that reminded me of the gyroscope function, which led me to the conclusion about the "a" and "g" letters.  I'm quite proud of myself...!

I've been working on my pseudocode and have come up with the following:

scaled_ax = map(ax, -17000, 17000, 0, 179)
scaled_ay = map(ay, -17000, 17000, 0, 179)
scaled_az = map(az, -17000, 17000, 0, 179)
scaled_gx = map(gx, -17000, 17000, 0, 179)
scaled_gy = map(gy, -17000, 17000, 0, 179)
scaled_gz = map(gz, -17000, 17000, 0, 179)
If acceleration in the x-direction is a high value, cycle the rainbow quickly
                If scaled_ax is ________, quick rainbow cycle
If acceleration in the x-direction is a low value, cycle the rainbow slowly
                If scaled_ax is ________, slow rainbow cycle

If acceleration in the y-direction is a high value, cycle the rainbow quickly
                If scaled_ay is ________, quick rainbow cycle
If acceleration in the y-direction is a low value, cycle the rainbow slowly
                If scaled_ay is ________, slow rainbow cycle

If acceleration in the z-direction is a high value, cycle the rainbow quickly
                If scaled_az is ________, quick rainbow cycle
If acceleration in the z-direction is a low value, NOTHING
                If scaled_az is ________, do nothing

If acceleration in the x-, y-, AND z-directions are zero, DO NOTHING
                If scaled_ax, scaled_ay, and scaled_az are 0, do nothing
I was working on the basis that "z" is the up/down axis, but I guess that would actually be "y."  Nikki suggested that ignore that axis to make things simpler, and I agree with her.  Maybe I will add it in later if the code comes together reasonably well.

I need to test the lights to find a comfortable value for the delay.

So, the tilt sensor theoretically puts out values between 0 and 179, but Nikki reminded me that it's like the microphone in that it might never reach the ends of the full range, so I need to find a comfortable max and min value to work with.  I loaded the code onto the Arduino to experiment at a standstill, walk, jog, run, but the serial monitor isn't functioning properly, and I know everything is connected properly.  I'll continue this during lab tomorrow, but it has to be done then.

Time spent: ~ 1 hour

Here is the evolutions of my code:
  (this is the delay I need to alter)

Monday, November 18, 2013

11/18/13 (class)

After dealing with dead LED strips yesterday, I've been given another strip to experiment with, and I'm going to be very, very careful.  It was missing a wire to the +5V port, so I've solved that with a new soldered wire.  It's really difficult to solder the LED strips, so I'm going to need to budget a significant amount of time for attaching them individually to the skirt fabric.

I'm making progress with the code.  I've succeeded (with lots of help from Audrey) in combining the tilt sensor simple LED code with the code for the Neopixel LED strip (standtest).  Now that these two have been combined, I need to actually work on my goal, which is for the LEDs to read data from the tilt sensor and, depending on the amount of acceleration/motion sensed, cycle the rainbow appropriately slowly or quickly (I'm not sure what the LEDs should do when no motion is sensed).  At the moment, I'm in the pseudo-code stage of figuring things out.

I'm trying to conceptualize the x, y, and z axes in terms of dance and the skirt.  X and y are the logical values to work with, provisionally ignoring z, since it would only really correspond to if the dancer jumped straight into the air.  Jumps are important in dance, but I don't really know how to incorporate that into the code; it seems like way too many variables, but I don't want the skirt to go dark if the dancer jumps into the air without moving along the x or y I guess I do need to incorporate z...?

Pictures to follow!

Sunday, November 17, 2013

I went to TA hours tonight to try to figure out why my LED strand wasn't working.  I tested the strand with an Arduino, Meaghan's SquareWear, and my SquareWear, and I think it's just dead.  I don't know what could have happened to make it stop working because it was working Friday afternoon: it just spluttered and lit up erratically, then stopped lighting up at all.  I did connect it while the Arduino was on, but I don't think that should have bothered it...right?

I found another, longer strand to test, but that didn't work either!  I tried that on my SquareWear and on Ione's, and nothing happened.  Then Ione's weather-proofed strand stopped working.  I'm thinking that there's something wrong with the strands?  I can't move on with my project until we figure this out.
[This is a late post, because it is actually about Friday's work]

Since the code for Neopixel isn't working on my laptop, I tried setting up the board with the lab computer, and I got the LED strip to work!  Next, when I hooked up the wires for the tilt sensor and was getting ready to try to combine the two pieces of code, the lights suddenly stopped working.  The computer gave me the error, "Programmer is not responding."  I closed and reopened Arduino several times and I switched the power source for the LEDs from 5V to 3.3V, but neither worked.  I'm going to TA hours tonight to try to fix this.  I'm a little worried, though, because my code was supposed to be done last Wednesday, and nothing's working the way it should.

Wednesday, November 13, 2013


Today was the shopping trip to Jo-Ann's, and I am so excited to have all my materials ready to go!  I have a little less than a yard of black fabric for the under-layer of the skirt (where I'll be mounting all the components...actually looks like it will be sturdy enough to allow me to solder the LEDs directly onto it) and also found some beading wire that has copper wire inside.  It's so much thinner than the rainbow cable I was planning on using and will be much more subtle.  In the lab, I stripped two ends of a sample section and connected them to an LED/coin battery to check conductivity, and it has a strong connection.  I will post a video later.

Now, I just need to fix my code...I'm still getting the strange Adafruit Neopixel error on my computer, so I'll try uploading on the lab computer tomorrow or Friday and that will hopefully solve the problem.

Tuesday, November 12, 2013


The first time I started working on this was Sunday night.  I ran into problems because the code "TiltSensorSimple" is designed to work with the Arduino, not the SquareWear.  I was really hoping to use SquareWear since it is so much smaller and lighter, but, since the skirt is just a prototype, I guess I'll switch to Arduino instead.

Today, (11/12/13) after meeting with Audrey, I went to TA hours with Shani and Nikki and am trying to hook up the tilt sensor.  I ran the scan to confirm the sensor was hooked up properly, and I was ecstatic when it matched the guidelines!


Then, I hooked up LEDs with another breadboard and took a video of the tilt working.  Stupid mistake 101: I was tilting the board with the LED and exclaiming how frustrated I was that nothing was happening...Nikki pointed out that I needed to be tilting the tilt sensor.  Oops.

And now I have another major error.  It took a while to compile the new files (neopixel and the updated SquareWear2) and figure out where the Arduino files were hiding (not in neopixel but in SquareWear2).  Now I'm getting an annoying error, though:

I'm doing all this on my PC, which doesn't run SquareWear, so I'm thinking that could be the reason why...?  Something else I need to figure out is how to activate the accelerometer.  I want to use that function of the tilt sensor, but I'm pretty sure the code is working the gyroscope.