Introduction: Mood-Dress

I made this mood-dress for the "If This Then That" project for the HKU. The concept is a dress with lights in it that change based on your body temperature, so like a mood ring but as a dress. I am no seamstress so it is a bit messy and I made a lot of mistakes, but please bear with me!


LilyPad 328
Main Board ATmega328P

LilyPad Led – RGB

LilyPad Temperature Sensor

Conductive Thread

USB to TTL Serial Cable

Alligator Clips

A Piece of Clothing of Your Choice

Step 1: Design Process

As with any project it is important to think about what exactly you want from your project and how you want it to look like. Think: how many lights do I want? Where do I want to put the lights? Do I want it to be subtle or more flashy? etc. These are all things I considered. Personally, I got 5 RGB led's to start with. While I had more on my way they didn't arrive on time before the end of the project so it stayed at 5. Personally I made the dress myself by putting two other pieces of clothing together, but if you want to use an existing piece of clothing, or make something from scratch that is all fine!

A very important step, that I didn't realize at first, is to really plan out your circuit as well. For RGB led's you will have 4 points of input, meaning your stitches and wires are most likely going to have to cross over each other at some point. Conductive thread all looks the same so this can get confusing quick. Also it is imperative that your thread does not touch other thread unintended. Not only will your dress not work this way, it might even start burning so be careful! This is another benefit of planning out, that way you can leave enough space to have your thread cross over another without touching it.

Step 2: Mess Around With Some Code

Now that you know what you want, I'd advise messing around with some code. I advise doing this before you start sewing as you can just get a feel for things with the reversible alligator clips before committing to anything. Be careful though as the alligator clips can leave scratches on your parts. In my case the scratches haven't interfered with the performance of anything, but keep it in the back of your head just in case.

To get to know my individual parts these tutorials helped me a great deal: (Temperature Sensor) (RGB Led Lights)

Since nothing is permanent, have fun with this step! Just mess around with things, see what works for you, go crazy. You'll never know what you'll find.

Either way, here is my code for reference:

//Determine your temperatures and give them names you will remember.
int cold = 20; int chilly = 25; int ok = 30; int lukewarm = 35; int warm = 40; int hot = 50; //Name your pins, makes it easier to remember what's what. In my case I put red on 8, blue on 9 and green on 10, but it really doesn't matter where you put them. tempPin is for the temperature sensor. int redPin = 8; int greenPin = 10; int bluePin = 9; int tempPin = A1; void setup() { // Set the color pin's as OUTPUT, and the temperature sensor pin as INPUT pinMode( redPin, OUTPUT); pinMode( greenPin, OUTPUT); pinMode( bluePin, OUTPUT); pinMode(tempPin, INPUT); // You can replace the + and - fuction by setting another pin to OUTPUT, and then digitalWrite High for +, and LOW for -. This way you leave your + and - tab free for a battery. //In this case A3 and 12 are my + and - respectively, for the temperature sensor. 7 is the + for the RGB led's pinMode(A3, OUTPUT); pinMode(7, OUTPUT); pinMode (12, OUTPUT); digitalWrite(A3, HIGH); digitalWrite(7, HIGH); digitalWrite (12, LOW); // Initialize Serial, set the baud rate to 9600 bps. Serial.begin(9600); } void loop() { //Basically, convert the reading to voltage, and then from voltage to fahrenheit and then to celsius. If you only need fahrenheit then you can leave the celsius option out of it. Just make sure to replace it later in the if statments long rawTemp; float voltage; float celsius; float fahrenheit; rawTemp = analogRead(tempPin); voltage = rawTemp * (3.3 / 1023.0); fahrenheit = (voltage - 0.5) * 100; celsius = (fahrenheit * 9.0 / 5.0) + 32.0; // Print celsius temp to serial monitor Serial.print("celsius: "); Serial.println(celsius); Serial.println(); //The if statements that determine what temperature shows which color. if (celsius <= cold) { analogWrite(redPin, 255); analogWrite(greenPin, 200); analogWrite(bluePin, 0); Serial.println ("It's cold"); //The delay is here to prevent the light from flickering back and forth too much. Temperature doesn't rise (or sink) steadily but switches back and forth a lot which would result in blinking lights. delay (2000); } else if (celsius <= chilly) { analogWrite(redPin, 255); analogWrite(greenPin, 0); analogWrite(bluePin, 0); Serial.println ("It's chilly"); delay (2000); } else if (celsius <= ok) { analogWrite(redPin, 255); analogWrite(greenPin, 0); analogWrite(bluePin, 255); Serial.println ("It's ok"); delay (2000); } else if (celsius <= lukewarm) { analogWrite(redPin, 0); analogWrite(greenPin, 100); analogWrite(bluePin, 255); Serial.println ("It's lukewarm"); delay (2000); } else if (celsius <= warm) { analogWrite(redPin, 200); analogWrite(greenPin, 255); analogWrite(bluePin, 0); Serial.println ("It's warm"); delay (2000); } else if (celsius <= hot) { analogWrite(redPin, 0); analogWrite(greenPin, 255); analogWrite(bluePin, 0); Serial.println("It's Hot"); delay (2000); }

Step 3: Start Sewing!

If you don't know how to sew there are plenty of tutorials on the
internet, and a simple stitch will do just fine. You'll want to start with sewing the LilyPad itself, preferably on a place where it isn't in the way too much but still convenient to reach. Everything you sew on later will connect to the LilyPad one way or another so keep that in mind. Personally, I attached it with normal black thread first using tabs that I knew I wouldn't be using for code anyway. This is not necessary, you can attach it when you need to connect it. However I found that it is easier to connect when the LilyPad stays in one place. When attaching something I usually loop it 3-4 times just so I can be sure it's properly attached.

The first step in my case was attaching the temperature sensor, which I put under the arm. You can also easily start with the led's if you want, it doesn't really matter. Once again, planning is important when attaching something so keep an eye on your schematics. Use your conductive thread, and secure it around whatever tab you need. Then using a basic stitch, stitch it towards your second element (in my case the temperature sensor) and do the same there to the right tab. When attaching to the LilyPad or sensor there are a couple of things to keep in mind:

  • Make sure the thread really touches the conductive (silver) part of the element, and that the connection is sturdy. If it's not touching, it won't work.
  • Make sure loose thread is not touching other parts of the element, especially not other conductive parts. Again if the wrong wires cross, bad things happen.
  • If you run out of thread, or need to connect two threads this is simple. Just make sure the new piece of thread is properly touching the old one, in a way that it will stay attached.

Step 4: The Elusive Battery

This step for me went very wrong, and my project does not have a working battery at the moment. All I can give here is advise from my experience:

  • Take into consideration how much voltage the project will take, and then consider the best battery option.
  • Test your battery with your full, complete code before sewing it in. In my case I tested it with just the led's and thought it worked fine, but as soon as I added the temperature sensor it started acting up.
  • A coin cell battery is not enough (this may be obvious to a lot of you, but I had thought since it's just powering some led's it would be enough, and well the previous point shows how that worked out.)

Step 5: Enjoy Your Project!

With that all done, you should now have a working mood-dress (or whatever you made of it in the end)! Good job! Pat yourself on the back for all the hard work you've done and go out and enjoy your amazing electronic clothing!!

Thank you for reading my instructable, and good luck on your project!