Monday, December 29, 2014

The temperature sensor on my hat works!

In my last post, I shared my first completed eTextile, a hat that plays Rudolph the Red-Nosed Reindeer in sync with his flashing nose! After quite a bit of trial and error, I added a temperature sensor and got my hat working the way I want it to! Figuring out the code for this sensor wasn't entirely intuitive.

For example, I wanted the buzzer music to come on when the temperature dipped well below room temperature.  When trying to figure out the code for the temperature sensor, I spent a lot of time writing things like:



if(sensorValue <=155)
and if(sensorValue <=100) 
and if(sensorValue <=50)


By using the Arduino Serial Monitor, I'd determined that the ambient temperature of my room equated to approximately 157 (I don't yet know how that translates to degrees in Fahrenheit).  I thought that using the <= sign would tell the LilyPad that I wanted it to trigger the music when the temperature went down.   This was NOT the case.

The correct way to achieve the result I was after actually looks like this:

 if(sensorValue >=155)

The >= sign doesn't seem to mean GREATER than in this case, because when the temperature goes DOWN, my music comes on.  I would like to understand this better.

In any case, when I wear my hat indoors the lights flash, but the music doesn't come on unless the ambient temperature is pretty chilly. The beauty of this is that the music should only come on when I'm outside, away from the delicate nerves of my loved ones (or to signal our need to heave another log onto the family hearth).






Sunday, December 14, 2014

Reindeer Hat Debut

Earlier today, I posted about my progress on my first e-textile project.  I am happy to report that it has now been sewn together and is working properly!

While the audio in this video sounds pretty distorted, the hat clearly plays "Rudolph the Red Nosed Reindeer."

I used a Lily Pad Simple Snap so that I could re-use and reprogram the board for other projects, without having to remove the LilyPad, itself.
Here is what my sketch looked like before I started sewing.  I'll be the first to admit that I didn't spend that much time on this.  I really wanted to jump right in, rather than spending a great deal of time sketching...plus, I always change my mind when I'm on the midst of creative work. The addition of a temperature sensor is featured in a later blog post. I'm not sure that I love the pom-poms.

My First E-Textile is Nearly Complete!

After going a couple of days living in a house without power, I was starting to think that I wasn't going to accomplish my goal of having one e-textile project complete for my brief presentation at the Generator this Thursday evening.

Then, I found some inspiration from seeing the gorgeous felt ornaments that Leah Joly has been making with her middle school girls...and, as luck would have it, the power was miraculously restored!

I am so happy with the way that this is turning out!


Last night, I turned a boring black hat into this near masterpiece.  I spent the morning coding the music and futzing with the circuit!  It works!  I am so excited!  If I can get this thing sewn together in time, I may have something to show after all!

Here are two aha's!

1.  After connecting my project with alligator clips to ensure that the circuit works properly, I discovered that I didn't have a clip running to my + (positive pin).  This confused me, because the circuit still worked perfectly.  So, I attached an alligator clip to the + pin and connected the other side of the clip to the clip connecting my speaker to the LilyPad and discovered that this caused the volume of my speaker to plunge dramatically.  Although I don't yet understand why this is the case, I wonder whether that might have something to do with why the speaker on Leah's "ugly sweater" isn't louder. (Update:  Nope, it doesn't.)


2.  There are different numbers that people look at when they are coding music.  Some people use the frequencies associated with musical notes, but others use a number called a "half-cycle delay."  Both may be used, as long as the code consistently uses one or the other.


Wednesday, December 10, 2014

Coding on a Snow Day!

















I spent most of my day puttering around in the basement, trying to figure out how to add a temperature sensor to the project that I've been working on.

Today marks the third official work day that I've spent, attempting to learn how to code a Lily Pad Arduino. After a great deal of trial and error, I was finally successful!

Here is a link to the code that I used.  I wrote part of this code (the notes for "Baby, It's Cold Outside" and the code for the motor and sensor), but I borrowed HEAVILY from an Instructable that I found in order to get my to sync up with my music.

Saturday, December 6, 2014

Lily Pad Coding Day 2: My Music and Lights are in Sync!

The video below might not look like much, but I spent nearly all day today getting my Lily Pad to sync up with flashing green and red lights!

Here is a link to the code that I used, which is a combination of the music I coded last week (see previous post) and someone else's code for the lights.

The biggest problem that I am having at the moment is that there is a long pause at the end of the song and a couple of lights are flashing for reasons I cannot figure out.

My next step is to figure out how to get the music to turn on with a temperature sensor.