## Step 3: Sewing Electronics

The MakeZine has a really great video tutorial by Becky Stern on getting started with the Lilypad. This is what I referred to when I got started with this project.

As you can see in the first picture, I had the power circuit board too close to the Lilypad. I later had to move this once I started sewing my circuit traces.

The actual circuit is pretty simple. Connect Positive Power and Ground from the Battery to the Lilypad. Then the pin outs are as follows:

int statusPin = 13;  // onboard status LED is connected to digital pin 13
int redPin    = 11;  // R petal on RGB LED module connected to digital pin 11
int greenPin  =  9;  // G petal on RGB LED module connected to digital pin 9
int bluePin   = 10;  // B petal on RGB LED module connected to digital pin 10
int sensorPin =  5;     // IR phototransistor connected to digital pin 5
int irPin     =  6;     // IR LED connected to digital pin 6

NOTE: complete Arduino sketch is at the end of this Instructable

TIP: You can use some of your scrap pieces of fabric to hold down your circuit traces. It's important that they do not cross or touch each other so that you do not create a short.

TIP: As you can see, the underside of your scarf will look kind of ugly with the circuit traces running through. You can cover this up by either sewing another scarf on top (leaving an opening to program your Lilypad) or by cutting out a scarf from the extra fabric you used for your pattern shapes.

This circuit will damage your arduino. <br>It has an arduino output pin effectively shunting current across the LED. With a resistor of 56R and a voltage of 5V this will cause a current of 90mA to flow through the arduino pin. The limit for such current, that is the value where it will start causing damage is 40mA, so it is almost twice overloaded. Even if you run the lilypad at 3v3 you are still going to pull 59mA and exceed the damage threshold. To keep it safe the 56R resistor has to be at least 125R but better would be 133R.<br>You might not notice the damage straight away but exceeding the manufacturer's ratings is a sure way to shorten the like of any electronic component.
have you heard of light wires?&nbsp; Ive seen them a lot at raves and night clubs.&nbsp; you can program them to go off on certain cycles.&nbsp; if you could weave it into the scarf&nbsp; your&nbsp; entire scarf could light up that chosen color.or even just the patterns. its a very flexable wire and there are many types on the market.&nbsp; its basically fiber optics.&nbsp; i think it would go very well with your scarfs<br />
do you mean EL&nbsp;wire? If so, EL wire give a nice accent - however its not that great for getting wet and I&nbsp;feel a scarf may get wet. Anyone know of good ways to seal in EL&nbsp;Wire out there? <br />
Love it love it. I&nbsp;am re-blogging this to my site today! Great job and thank you for sharing your code. The hardest part in teaching newcomers sometimes is that people hide all their code and then they become discouraged when they have to learn it fast. This gets them up and running making something quickly... Thank you! <br />
Nice instructable, thumbs up.<br /> Btw, if you need flame designs for free then take a look at <a href="http://www.dragonartz.net/2008/04/21/vector-flames-set1/" rel="nofollow">Dragonartz</a><br />
Thank you, and thanks for the graphics link!<br />
hmmm... I got a mind flex for christmas (EEG games are cool) and i think maybe if you were to add some sort of EEG/brainwave reader so that the LED would shine according to the actual mood of a person, that'd be cool.&nbsp; Or have it work like a mood ring does, the body temperature!&nbsp; and since the scarf is super close contact, then that'd be no problem!<br /> <br /> I think a hat would work better for the EEG idea tho.&nbsp; closer to the brain and all...<br /> <br /> great idea tho! really love it!<br />
I like the body temperature idea! That is something I would like to explore further.<br /> <br /> The mind flex game looks really cool.<br />
&nbsp;I like the idea, but why an IR transmitter? &nbsp;Especially with something like a scarf, it would be limited by outside light and by lack of line of sight. &nbsp;What about a cheap RF transmitter kit? Longer range and no worry about line of sight, plus you can get a kit for about 5\$.<br /> <br /> Still though, really sweet idea!<br />
Thanks dark... that's a great idea that I will have to pursue!<br />
&nbsp;It should be a drop in that'll act like a serial cable replacement, but if you need any help, feel free to shout out.
Awesome!&nbsp; I've been wanting to make something similar ever since I&nbsp;saw the <a href="http://www.thinkgeek.com/tshirts-apparel/interactive/a090/">8-bit Dynamic Life Shirt</a> on thinkgeek.&nbsp; I think this is a very sweet gift and far more subtle than the row of giant hearts that light up :D<br />
<strong>Thanks scoochmaroo!</strong> I made the pink scarf for my wife for Christmas.&nbsp; I want to figure out how to use the sewing machine we have and work on some more ideas.<br />
I'll be doing a bunch of sewing projects featuring the <a href="https://www.instructables.com/id/How-to-unpack-5-Singer-sewing-machines/">great machines Singer sent us</a>.&nbsp; You've given me the idea to include a basic tutorial as well!<br /> <br />
That would be great! I anxiously await for it :)<br />
That's <em>exactly</em> what I thought of when I saw this! <br />