Remember part 1, with the 3x3 LED matrix? That was practice, for this, a 7x7 matrix, on a functional, wearable, piece of clothing.

1. Regular LEDs are too big, and I want a nice blue colour. So I made 49 surface-mount LED beads, instructions here.

2. I need a piece of clothing to act as canvas for my LEDs. This top will preferably be mostly straight, flat, and won't have much stretch. (So all the LEDs are visible, the traces won't be likely to cross unexpectedly, and the geometric shape can be used as part of the design.) These are not good or easy things when it comes to covering the human body. I choose a crepe-backed satin material with no stretch, as it is heavier than cotton, and the shiny metallic sheen is suitable for the look I'm aiming for. You could use a garment you already have, or follow a pattern, or anything you want, but I ended up draping and pinning a top together on myself, as I looked in a full-length mirror. It was tricky, but the only way I could get the hang to sit right. It came together looking very blocky and unappealing, certainly not my usual cup of tea. But I'm glad I kept it simple, the details from the LEDs added so much interest that anything extra would have risked being too much.

(I'm actually very proud of this top. It's the first garment I've made completely by myself, and that I've finished all the seams/edges of.)

3. Mark out the traces for your grid. I separated the LED-grid-lines by 1.5", and the edge traces towards the microcontroller at 0.5". If you're smaller than me you'll have to use smaller gaps, but if you're bigger you get more room to play. The lines with the conductive thread on the outside will be most visible, due if nothing else to contrast. So these have to be done well. I placed these lines (and thus focus) in the usual place, across the chest, but you can put them anywhere you want. As the conductive thread will be in your sewing machine's bobbin these horizontal lines will be sewn with the inside of the garment face-up.

Pull a long tail of conductive thread out, knot at the end. Start down at the end towards the microcontroller (so that you have extra thread to make the final connections by hand), and just sew all the way along. Repeat for all seven.

Despite having chosen a heavier fabric than last time the conductive thread still got partially pulled through. To make well and truly sure that no shorts would be created I covered each intersection point with two layers of fray-stop glue. (Having remembered what happened to the satin bracelet I took a fabric scrap and tried a few different sealants. Black and silver fabric paints, clear nail polish, and fray-stop glue. The nail polish dried fastest, but the glue stained the fabric least so it was my winner.)

Turn the garment right-side-out, and mark the vertical traces. This is easier if you are using measured increments than arbitrary design, but both are possible with patience.

Sew the lines as you did for the horizontal ones, but when you approach an intersect point slow down (use the hand-wheel if needs be) and make sure not to stitch through the other piece of conductive thread. You can increase the length of your stitch, or just lift the presser-foot and shift the fabric a little bit, until the needle comes down the other side clear of the conductive thread. Take care doing this. And as you finish each line it's a good idea to test with a multimeter to make sure that you haven't created any shorts.

When all the machine sewing is complete pull all the threads through to the inside of the garment, and finish off (I tied the top and bottom threads together a couple of times and sealed with a drop of fray-stop glue). Trim the tails of the threads farthest from the mirocontroller area.

4. Attach the LED beads. With conductive thread, positive ends to positive/horizontal lines, negative ends to negative/vertical lines. This will take a surprising amount of time. There may be faster ways to do this, but adding them one-by-one will allow you to replace them individually should anything happen. Seal and trim the ends to avoid shorts. When lit up there is a variance in brightness, depending on the quality of my soldering and connection made, for that bead. It gives a nice, natural diffusion, like anything handmade. But it means if you're depending on regimented consistency to pull off your patterns you might find yourself frustrated.

5. Microcontroller section. The area where the Lilypad microcontroller will go, where you currently have long tails of conductive thread, will be built up in a couple of layers. The first exists simply so that my hand-sewing won't be visible on the outside of the top and spoil the geometric exactness, so you can skip this layer and attach directly to the top if you wish. The second layer is added so that the Lilypad components can be removed when washing. If you take the battery out the rest is supposed to be washable (hand wash, gentle detergent), but I think it's best to avoid such risks if possible. The two layers are attached with plastic snaps to avoid any possible shorts.

Layer one: I simply couched the conductive thread to the fabric, ending in a silver jump ring (the kind used in jewelery). The idea being that the ring will allow the crocodile clips, conductive thread, whatever, to connect easily.

Layer two: I added strips of conductive fabric, aligned with the jump rings of the layer below, with lines of conductive thread leading into the petals of the Lilypad microncontroller. I tested leaving it like this, but the layers weren't tight enough against each other and kept breaking contact. So I added a couple of stitches through the conductive fabric/thread sections, then wrapped around the other half of each of the jump rings.

(Half way through I realised that using metal snaps would have been a much simpler idea, but I didn't have any small enough. Next project I'll use metal snaps to make the connections instead of the jump rings, and will leave the conductive fabric out altogether. Speaking of which, if your conductive fabric is as papery and prone to fraying as mine you'll need to edge each strip with non-fray glue.)

Strong connections having been made from each of the LED rows and columns into the Lilypad, all that remains is to add a push button and a battery power source. I actually waited to add the battery pack until after I'd programmed the Lilypad as my space was limited and they got in the way of each other. When I'd finished everything I put in my battery, switched it on, and watched unimpressed as nothing happened. In my excitement and haste I'd managed to loop a length of conductive thread around the positive end of the battery holder. As this thread came from the positive petal of the battery board I didn't think it would cause a problem, but it did. With the loop there, as soon as I added the battery the power supply light came on faintly, getting brighter if you switched the board on. With the loop removed (simply cut out, and glued in place) there was no light until the board was switched on, and then all my LEDs lit up beautifully!

6. Programming. I stuck to the basics here. I used the switch to increment a global counter, which represents a different pattern. I named my LEDs, then kept them in row and column arrays. This makes referencing them much easier than the way I used in the 3x3 matrix.

int ledPosArray[] = {row0, row1, row2, row3, row4, row5, row6};
int ledNegArray[] = {column0, column1, column2, column3, column4, column5, column6};

In setup() set all the LEDs to OUTPUTs, set the switch to INPUT, and set the switch's initial state: digitalWrite(switchPin, HIGH);

In loop() assign the current value of the switch to be the old state, then get the new state from the switch itself.

oldValue = switchValue;
switchValue = digitalRead(switchPin);

If the switchValue is LOW, and the oldValue is HIGH, it means that the button got pressed. So increment the pattern counter. If the switchValue is HIGH, and the oldValue is HIGH, it means the button is still being pressed (held down for a while). This might be behaviour you want but I do not want to count this as a press, otherwise the longer the button is pressed, the more we would cycle through the patterns.

if((switchValue == LOW) && (oldValue == HIGH)) //pressed
    if(numOfPresses < NUM_PATTERNS)
      numOfPresses = numOfPresses   1;
      numOfPresses = 0;

Then just check what pattern number you are on, and display that pattern. I only have three, all off, all on, and a single, random, LED lit up. Because we are using the arrays you only need one method:

void on(int row, int column)
  digitalWrite(ledPosArray[row], HIGH); 
  digitalWrite(ledNegArray[column], LOW);

Now, to turn on an LED you just call the method like: on(0,0); This will light up the top-left LED only. There is a nice random function built in, supply it with a max number and it will return a random value in the range of 0 to max-1.

if(numOfPresses == 0)
  else if(numOfPresses == 1)
  else if(numOfPresses == 2)

And that's about it. I am intending to add more patterns, and play around with adding recognisable graphics in the next version. I also have an idea or two for further enhancements. But more about that later. Now, I'm thinking it'll be a good idea to add a protective panel between me and the top on the inside so that I don't short anything, and that my sweat doesn't soak the thread. Then, I simply need somewhere to wear it :)

Oh, by the way, if I did nothing but work on this top, stopping only to eat and sleep, it would have taken me a solid week. As it is it took me many weeks. The cost of materials used is less than €100, but if I was to add in the cost of labour, this top would be closer to €400/€500.

Credit for the surface mount LED top project: Leah Buechley's LED-top project in Craft magazine, volume 1. From back before she came up with the Lilypad system. A version of which you can find here.

Anonymous (will be screened)
OpenID (will be screened if not validated)
Identity URL: 
Account name:
If you don't have an account you can create one now.
HTML doesn't work in the subject.


If you are unable to use this captcha for any reason, please contact us by email at

Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.