Monday, December 30, 2013

Turn Signal Jacket: Added a Switch

The Lilypad Arduino main board for some reason doesn't seem to have a switch on it (just a reset button). And so, there is a need for me to remove the battery every time I'm done playing with using the jacket, which I find troubling (because, honestly, I'm lazy).

Thus, taking a little switch I found from an old child's starter kit to engineering, I added it to my jacket! A ton of those sets were for some terrible reason thrown out by a neighbor of mine... Needless to say, I took all of them home.
The switch looks kinda dorky. Haha, but it's absolutely perfect for its purpose!
I had to shorten the wire of the switch to conveniently place it where it is, and strip it to reveal the conductive wire. First time stripping wire (not too hard, but I accidentally nicked the wire once. Haha)! Then I cut away the conductive thread I had previously used to attach the positive of the battery to the positive of the Lilypad. There after, I used non-conductive thread to attach the ends of the switch to the positives of the battery and Lilypad. However, I did use conductive thread for attaching the wire and Lilypad together just in case.

No extra programming or anything was needed when attaching the switch. As when it's switched to the left (in respect to the photo), the circuit is disconnected as the little stubby piece of the switch connects to nothing. When switched to the right, it reconnects the positives and turns the jacket on.

The switch is like... the cherry on top, I suppose :-)

Further Advice:
If I could do this project a second time (which my dad is thinking about making me do...), something I would do different is possibly use speaker wire instead of regular conductive thread.

As the conductive thread is exposed, it very easily comes in contact with the other threads since clothing wrinkles and jumbles up together. It's very annoying since the LEDs will light up randomly. Speaker wire has the protective plastic over it, and won't have that problem. Non-conductive thread can be used to sew the speaker wire down. Using the non-conductive thread may be better as well since you can find a color thread that matches your clothing, whereas the conductive thread is dark gray and looks just ugly against my pink jacket.

If I redo the jacket, I may make a video instead of writing, so stay tuned for that! :-D

PS. Ms. Chipps, my mentor, says next time we meet, we'll probably start working on my Intel project. Yay!

Thursday, December 26, 2013

Turn Signal Jacket: Don't Short the Circuit

I am VERY happy to say that I have made the jacket work successfully; meaning the left arrow will blink when the left button is pressed and vice versa! It was quite difficult because there were several obstacles to overcome, and not only that, but the code found from the Instructables link did not seem to do the task I wanted it to do.

Now, in the post before this, I had mentioned that the LEDs were not blinking during the testing phase because there was a high resistance between the battery and the board. However, it turned out the cause of all my pain was that there was a short circuit that caused the battery to burn up and die before it could provide power to the Lilypad. My mistake was not cutting the loose threads around the battery short enough. After cutting off the extra strands, I put in a fresh battery... only to find a few more obstacles ahead of me.

Major problems encountered were:
  1. The LEDs of both arrows wouldn't blink at the same time
  2. The pins on the Lilypad board (specifically 9 and 4) weren't working.
  3. Insufficient power supply
Minor problems encountered:
  1. Unnecessary panicking from misreading the multi-reader due to lack of knowledge in different range settings. helpful link here.
  2. Program compiled and uploaded to board with no problem, but nothing happened... because driver wasn't installed for the FTDI. helpful link here.
The first major problem, was found when the test program was uploaded to the Lilypad board. It was to test if the arrows could simply blink on and off. No code for the buttons or anything yet.
Here is the test program for the jacket arrow LEDs: (retrieved from the same instructables link.

int ledPin = 13; // the LED on the LilyPad
int leftSignal = 9; // my left turn signal is attached to petal 9
int rightSignal = 11; // my right turn signal is attached to petal 11
int signalLow = 10; // the - sides of my signals are attached to petal 10

void setup() 
  pinMode(ledPin, OUTPUT); // sets the ledPin to be an output
  pinMode(leftSignal, OUTPUT); // sets the leftSignal petal to be an output
  pinMode(rightSignal, OUTPUT); // sets the rightSignal petal to be an output
  pinMode(signalLow, OUTPUT); // sets the signalLow petal to be an output
  digitalWrite(signalLow, LOW); // sets the signalLOW petal to LOW (-)

void loop() // run over and over again
  delay(1000); // wait for 1 second
  digitalWrite(leftSignal, LOW); // turn the left signal off
  delay(1000); // wait for 1 second
  digitalWrite(rightSignal, HIGH); // turn the right signal on
  delay(1000); // wait for 1 second
  digitalWrite(rightSignal, LOW); // turn the right signal off
  delay(1000); // wait for 1 second

Only the LEDs connected to pin 11 would work.  LEDs connected to pin 9 weren't blinking at all!

After a ton of trial and error (and much help from my programmer-savy dad!) that the short was found to have busted pin 9 on my Lilypad. When testing the conductivity between pin 9 (+) and pin 10 (-), there was no power from the battery coming through to light up the LEDs. While on the other hand, pin 11(+) and pin 10 (-) had about 2V lighting up the LEDs to make it blink.

Goal: find a pin that does work!
And so, luckily, pin 8 was able to conduct with pin 10. With just a little bit more conductive thread, pin 8 was connected to pin 9, and the code was changed from 9 to 8.

That seemed to work! ...but then LEDs connected to pin 11 stopped working. Now, that leads to the insufficient power supply. Whenever the board was connected to the FTDI cable, it seemed to follow the test program with no problem! Without the cable though, only one side could blink. The jacket was concluded to need at least 4.5V to work as each side needs at least 2-ishV to work, whereas the battery used only had 3V (this wasn't including the notifying LEDs on the shoulders). Thus, the entire time in testing the jacket, the FTDI cable was connected to it.

Me using my chopstick skills to measure battery voltage
while using the other hand to take a photo. Ha!
However, it is until much later did we realize that we were entirely wrong in the assumption that a better power supply was needed. 4V is needed to power both sides of the jacket. We only need one side to work at a time (since a turn signal shouldn't have both signals on at the same time), so a 3V battery should be enough. (and I've tested this, so no worries!)

the exciting moment when both arrows were able to blink!!
Once the arrows were able to work, next up was implementing the buttons! Since I connected my threads using the same pins as from the Instructables link, I thought I could just copy the same code. ...However, I'm not sure why, but the code seemed unusually complicated and was only able to make all the LEDs blink on and off randomly whether the buttons were pressed or not. So, despite how new to Arduino I am, I attempted to write my own code for this, and somehow, it worked!

My source code to make arrows blink according to which button is pressed:

int boardLED = 13; //LED on Lilypad
int leftSignal = 11; //LEDs for left arrow
int rightSignal = 8; //LEDs for right arrow
int signalLow = 10; //negative for arrows
int rightLow = 3; //negative for right shoulder LED
int leftSwitch = 7; //button for left
int rightSwitch = 5; //button for right
int leftLED = 12; //left shoulder LED
int rightLED = 6; //right shoulder LED
int x; //variable for for-loop

//setup copied from instructables link
void setup() // run once, when the sketch starts
   pinMode(boardLED, OUTPUT);
   pinMode(leftSignal, OUTPUT);
   pinMode(rightSignal, OUTPUT);

   pinMode(signalLow, OUTPUT);
   pinMode(rightLow, OUTPUT);

   pinMode(leftSwitch, INPUT);
   digitalWrite(leftSwitch, HIGH);
   pinMode(rightSwitch, INPUT);
   digitalWrite(rightSwitch, HIGH);
   pinMode(leftLED, OUTPUT);
   pinMode(rightLED, OUTPUT);

   digitalWrite(boardLED, HIGH);
   digitalWrite(signalLow, LOW);
   digitalWrite(rightLow, LOW);
void loop()
   if (digitalRead(leftSwitch) == LOW) //if left button is pressed
      digitalWrite(leftLED, LOW);
      digitalWrite(leftSignal, LOW);
   if (digitalRead(rightSwitch) == LOW) //if right button is pressed
      digitalWrite(rightLED, LOW);
      digitalWrite(rightSignal, LOW);
void left() //method for left turn signal
   digitalWrite(leftLED, HIGH); //left shoulder LED is on
   for (x = 0; x < 10; x++) //arrow will blink 10 times
      digitalWrite(leftSignal, HIGH);
      digitalWrite(leftSignal, LOW);
   digitalWrite(leftLED, LOW); //left shoulder LED is off
void right() //method for right turn signal
   digitalWrite(rightLED, HIGH);
   for (x = 0; x < 10; x++)
      digitalWrite(rightSignal, HIGH);
      digitalWrite(rightSignal, LOW);
   digitalWrite(rightLED, LOW);

This code seemed to work wonderfully for the right side!! It would blink 10 times once the button is pressed, and stop. When testing the leftside however, it would just blink on and off before even pressing the button, and stay that way. After testing the conductivity between pin 4 and pin 3, there seemed to be a negative polarity (which isn't supposed to happen). And taking a shot in the dark, it was assumed that pin 4 may have been busted like pin 9. Thus, taking some speaker wire, I jumped one end of the wire to the positive of the left button and the other end to pin 7 using non-conductive thread to sew it down. (that's why in the code, leftSwitch is 7 instead of 4).

After that, the sweater worked completely in every way!! Yay :-)

Lesson of the story: Don't short the circuit because it'll cause you more problems than you need...
Note: When washing, take out the battery first! It is also advised that the jacket be hand washed and hang-dried.

PS. Forgot to take a photo/gif of jacket working. Maybe I'll include it later because right now is 1:40am so... no.

Saturday, December 21, 2013

New Sweater. So Close to Finishing.

In these latest photos, you'll see that the sweater is different from my earlier posts. Unfortunately, I lost the first one on my way home from the subway. I don't even want to relive that moment, so let's move forward!

So far, I was able to finish all the sewing for this new sweater! I was able to do so by following the sewing instructions from Instructables. I sewn the different components together to the LilyPad using the same numbers as the link, so that I'm able to just follow her code. However, to make sure the conductive thread didn't cross, I switched 4 and 3 though.


Since this is my second time around sewing the jacket up, I was a little bit more accurate in sewing up this sweater. I used a piece of white paper to draw a chalk line of a nice perfect 90 degree angle. The ruler was used to specify the spacing between each LED so it'd be evenly done. And the pins were used to hold the LEDs in place. You can see this being done in the pictures below:

a safety pin was used to hold the paper down to it's desired location
all the sewing materials you see at the top left corner
(pouch, plastic container, needle holder, pins, thimble, chalk, etc)
was bought from the dollar store (except conductive thread of course)!
Great place to get supplies.

Used pins to hold the LEDs in place...
the pins were really big, but I'd try to find smaller ones if I were you.

I drew estimated chalk lines to help me sew a path to the Lilypad
However, despite how precise my beginning set up was.... the LEDs somehow became crooked anyways. It was mostly because I didn't place the pins precisely enough, and didn't make sure that the un-pinned side was sewn at the right angle. I just kind of sewn it without thinking, so one side was on the chalk line and the other was slanted. And so, maybe if you're to try this, you'd not follow my mistakes.

The sewing came up really ugly on the back (I'm new at this, sorry!) because the conductive thread was grey, and so very visible. If I did some more planning ahead of time, I would have probably been able to make some sort of decorative butterfly or something with the sewing! Oh well.

you can see all the LEDs connected to the Lilypad, and the buttons on the shoulder areas

A close up on the Lilypad and battery cell holder
I sewn the buttons (on/off switches) and the LED to notify you the arrow is blinking on to the outside shoulder areas of the sweater, as I figured it'd be the easiest way for the user to press the buttons and see the LEDs.

A close up of the button and LED on the shoulder
However, the sweater isn't finished yet! It was supposed to be today.
As we tried to upload the blinking light program for the Lilypad, the lights wouldn't blink! And, Ms. Chipps and I spent the afternoon trying to figure out why.
So far, we're thinking the problem is that the resistance between the battery and Lilypad is too high (greater than 10 ohms), In the instructables link, the author says to add more conductive thread to increase conductivity. And so, my little winter break project is to try to get the LEDs to blink, and possibly look at the code in the instructables and apply it to my own sweater.

To be continued!

Sunday, December 1, 2013

Day 2: Turn Signal Jackets

As I mentioned in the previous post, Ms. Chipps and I started to work with Arduino again. This time, we plan on  incorporating it into a sweater as the Arduino Lilypad is capable of being so. The idea is to make a sweater with turn signals on the back. It'd be useful in having it if you go biking... or if your just want to let the world know which direction you're turning while walking. I'm going to use it to show off to my friends at school of course since I don't go biking nor go out in general....

 Materials (for the beginning half of what we did so far)
  • Lilypad Arduino
  • 2x Lilypad Button Board
    • 2 orders needed so you can have a button for left and right arrows.
  • 2x Lilypad LED
    • the order comes with 5 pieces.
    • this link happens to be pink LEDs, but you can always choose different colors
    • you'll need at least 2 orders to have 5 LEDs per turning "arrow"
  • Lilypad Coin Cell Battery Holder
  • Conductive thread and needle
    • Note: make sure needle is large enough to fit conductive thread
  • Pins
    • enough for as many LEDs you are using
  • Sweater of your choice
    • For mine, I stole my sister's comfy, blue sweater
A neat work station is the best work station!
More LEDs so you can have a light to notify the user of when the lights are on or off. Also, more would be good if you want to make bigger turning signals.
The website we're following for instructions on our sweaters is from Instructables.
These are photos from the Instructables link of their versions

For my sweater, I chose to use the more angular arrow look (as in the photo on the left) rather than a curved design. Both of the arrows consists of 4 pink LEDs with a red LED for the tip of the arrow. Moreover, the Arduino and battery board was placed on the inside of the jacket underneath the tag. The buttons placed at the sleeves.

LEDs on the sweater

For the time being, safety pins were used to hold the LEDs in place. Later they will be sewn into the sweater.

I put on the sweater several times to make sure the hood wouldn't cover the lights, and also if the lights were in a favorable place or not.

I liked the idea of red tips for the arrows because it'd just add personal flare. 
Mainboard, battery holder, button

The button seem kind of small, but I think it's sufficient for it's purpose. I just put it at the end  of my sleeves where my thumbs can press it.

After pinning the Lilypad Arduino mainboard and battery holder to the desired place, we were able to finish sewing the conductive thread between the positive side of the battery to the positive side of the mainboard.

The sweaters aren't finished yet, but we'll be continuing work on it tomorrow.