This is a fun project that uses an Arduino Lilypad along with a light sensor and buzzer to play the star wars theme when the collar of a Chewbacca coat is flipped up, and then stops when the collar is put back down.
I'm going to split this into 2 different parts, the coat (a knit Chewbacca themed star wars coat) and then the electronics. Of coarse this same thing can be put on any coat with a collar and any song can be programmed into the arduino, but I will only be detailing the Star Wars coat and song I made.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Star Wars Chewbacca Knit Sweater Pattern
Download the pattern attached to this instructable to knit this sweater. This isn't a knitting tutorial, so you will have to be able to knit to make this sweater. I am just providing the pattern for the Chewbacca sweater, and you will need the following items:
- Size 6 knitting needles
- Size 9 knitting needles
- Brown yarn (chewbacca fur color)
- Black yarn
- White yarn
Double up your yarn to knit this (just buy 2 skeins of each color and place 2 strands together as one when knitting). For all of the items in the pattern (except for the collar) you will need to start by knitting a 2 inch band of ribbing with the number 6 needles (you use the smaller needles on the ribbing so that it is tighter and snugs up compared to the rest of the sweater that is knit with the size 9 needles). You can do whatever type of ribbing you like (k1p1 or k2p2 etc...), doesn't really matter, just has to be about 2 inches wide when you are done. The ribbing is to be done in the brown color. Then when you get to the patter, just knit a row and then perl a row, adding the colors when they appear in the pattern (x is black, o is white, and blank square is brown). The only exception to this is for the front panels, they have a grey area on the front that should be done in the garter stitch, and this is where you will attache your zipper at the end. The collar is also done in the garter stitch.
Once you have all of the parts made, just lay them out and sew them together with the brown yarn. You can then add a zipper on the front panels, and you're all done. This pattern is labeled as a size 6, but the end size will of course rely upon how tight your stitches are and what size needles you use (if you change from the ones I've listed).
Step 2: Wiring the Arduino Lilypad
You will need the following items:
- Arduino Lilypad Simple
- Lilypad Buzzer (this is the "speaker")
- Lilypad Light Sensor
- Small LiPo Battery (can use other power supply, but these are handy and small)
- ~3' of conductive thread
I got all of my parts from the Lilypad Protosnap Kit (https://www.sparkfun.com/products/11262). You don't have to buy this kit, each of the components can be sourced by themselves. You also don't have to use the lilypad sensors, but they are easier to sew to with the big pads, and they are the ones I used and will reference.
As you can see, the circuit is pretty simple, just find where you will place the components on your sweater. Make sure the light sensor will be completely covered when the collar is flipped down, and sufficiently exposed when flipped up. This is what triggers the music, if the light is bright enough, the music plays, if the collar is flipped down and covers the light sensor, the music stops. The buzzer can be anywhere, but I kept it close to the main lilypad as it's easier to sew it close by. You don't have to use my pins or my layout, that is just what worked for me. I diagrammed it first, and when I started to sew, I realized I didn't have to go all the way around with the light sensor positive (the blue dotted line), so I ended up putting that on the top pin of the actual arduino, but feel free to wire it any way you see fit (as long as it works, it's all good).
Step 3: Coding the Star Wars Theme and Light Sensor
Before I sewed anything to the coat, I used some alligator clips to hook everything up and then tested the code, this is a good thing to do if you have the clips (makes sure everything works and the code is set to the correct pins etc... helps catch any problems before you do too much work).
You will need to download both the arduino sketch and the pitches.h file, and load that pitches file into your sketch so that it can reference the code (the pitches define the different musical notes so that you can reference them by more familiar names instead of having to call them by their exact frequency).
Make sure and update all of the pins to use the ones you actually use in your arduino. You may also need to adjust the light sensor sensitivity increasing or decreasing the "sensorValue" value (in this code it is set to 40, increase it to make it less sensitive, or decrease it to make it more sensitive).
Essentially, this code is constantly checking the light sensor, and if the appropriate level of light is sensed (i.e. the collar is flipped up to expose the sensor), then it starts going through the star wars theme one note at a time, after each note it checks to see if the light sensor is still sensing light, and if so, it continues to the next note, if not, then it stops playing the music (there is no pause for this, it does this check so quickly that you won't notice the loop checking).
You can play with the notes, and make different songs etc. Everyone other Star Wars arduino sketch I found either had the darth vader march song, or the cantina music, I couldn't find the actual Star Wars theme, so I found some basic notes online and got this working, but I have very little musical talent, so please don't complain to me that I didn't use the correct timing or key etc... sounds ok to me and is instantly recognizable as Star Wars, but it can easily be adjusted and changed if you need.
Hope you have fun making this, good luck and post pics of your finished projects!