chebe: (Default)
chebe ([personal profile] chebe) wrote2009-08-04 08:44 pm

My first Arduino Lilypad project

How It All Began:

In this world there a great variety of people, with vastly different skills, interests, backgrounds, and futures. But for the sake of this post I will concern myself with only two kinds. Those who know cool electrical stuff, and those who don't. I fall into the latter category. But when a friend told me about these pre-assembled circuit boards, that are used to rapidly prototype gadgets and inventions, that are so simple to use that artists with no technical background are able to pick them up and realize their visions, well, my first thought was, 'that's kinda cool'. So idly I browsed the interwebs, for this strange thing called Arduino, and discovered it's sleeker, purple-ier, sibling, the Arduino Lilypad. It offers a subset of the range offered for the Arduino, but washable, and redesigned for use on clothing. My imagination immediately filled with visions of me dancing, trailing swirls of colours. *ahem* And other less girly things. And I just knew I had to get my teeth into it. Afterall, if it was so simple to use then I could hardly fail.

I fell to the temptation, and bought two Lilypad kits: the e-sewing kit, and the deluxe kit with 328 board.*

*There are a fair few retailers selling this stuff, some like, that sell a larger range, so you don't have to splash out on the deluxe kit if you're just getting started. But these are the guys I ordered from, and I know they are good to deal with. Plus, I find it's a lot cheaper nowadays to order from within the E.U.

The first impression when you open up your package, full of ideals and excitement, is disappointment. The components are very small, and when grouped together fit in the palm of one hand. How did it cost so much? But that reaction is just social conditioning, where more often than we'd like, size does matter. Because when you do actually start using the components, it becomes apparent that they are worth every penny.

Install the Software:

First things first. The Arduino line are micro-controllers. Meaning, being more than simple electrical circuits, I can program certain behaviours into them. Making my circuits/projects smart, and through the use of sensors, partially aware. This means, I have a new programming language to learn. The Arduino language is very similar to a cross between C/C++ and Java. But isn't any of these languages, and assuming behaviours can lead to many hours of trying to figure why something isn't working.** I upgraded my EEE to Fedora 11. Which has the necessary libraries easily obtainable in their repositories. You do need to install a fairly new version of Java, because the IDE seems to be written in it. Then just downloaded the IDE and followed the instructions to install it and the drivers. Just make sure to tell the IDE which Arduino you'll be uploading to (under Tools>Board) and through what port (under Tools>Serial Port).

** I refer here to Serial.print() method. Trying to use it like:
Serial.print(variableName + " --- ");
will not work (at least not for the 0.16 version). But, it does compile, and while running you don't get any errors, you just either get nothing, or you get garbage characters. The + operator does not concat strings. It performs arithmetic on the operands. Do yourself a favour and break up the different strings to different print statements.

Gather the Hardware:

Quite apart from your Arduino/Lilypad components you will need other tools. So far I only use pieces from my sewing/clothing/embroidery kit and my jewelery making kit; and well, crocodile clips, and a multimeter. But I have designs on a soldering iron and other bits and pieces.

Figure Out What You're Supposed to be Doing:

I did this a few ways: YouTubed videos, joined Instructables, started tagging along with my friend to TOG meetings, and bought a couple of books.*** In the end, I decided to make a pair of gloves/hand-warmers, the left hand using the e-sewing kit (which does not come with the Lilypad controller), and the right hand using the deluxe kit components. The left hand has three white LEDs, a push button, and a battery. The right has the Lilypad controller, an accelerometer (the most expensive component in the Lilypad kit), a RGB LED (power hungry little thing), and a battery. The idea being that the RGB LED would change colour as I moved my hand around. (It's a condensed version of Leah Buechley's accelerometer shirt.) This, along with Leah's tutorials, I felt would give me a fair grounding in the use of the components before I moved on to something bigger, and much more complicated.

*** Namely 'Swith Craft' and 'Fashioning Technology'. 'Switch Craft' I like for the project ideas, and dislike for the pervasive attitude that girls don't really want to learn about how electronics work. 'Fashioning Technology' I really, really like, particularly for the clear and step-by-step descriptions of different electrical components, and ways to practice things like soldering. However, it should be noted that neither of these books actually deal with micro-controllers or Arduinos. They are more about mechanical circuits, and use very diverse materials like conductive fabric, photochromatic paint, and EL wire. Also, there is some overlap between the projects (phone-alert bags and headphone hats most notably).

Figure out How to Do It:

This is the fun/frustrating/time-consuming/ultimately rewarding part. I discovered that the 4-ply conductive thread is a nightmare to sew with. (However, there is a new 2-ply version that they say can be used with a sewing machine that's caught my eye.) So I run the thread through the eyes/connectors three, four times, and then just lay it across the fabric. I then use a regular thread and through couching secure it to the fabric. I'm also experimenting with laying the conductive thread on the top and undersides of the fabric, to different effects. And I'm still working on the logic for the accelerometer/RGB mechanism. This project isn't yet finished, but here's how far I've gotten so far:

The two unfinished gloves.

The two unfinished gloves, with no flash to show the LEDs.

And videos:

I've rambled on long enough, so I'll save the details for another time. Unless you have questions, I'm only too happy to help/explain further. Also, those photos are fairly good resolution, click on them to see the small details. For now, here are some notes of things I figured out the hard way:

Things I Learned:

- The Lilypad is more expensive than the Arduino, so unless you want wearable tech specifically, stick to the Arduino.
- The Arduino works in a three-dimensional space. You can build flat circuits, or giant cubes. The Lilypad, although it has to shape and conform to the 3-D form of the body, works primarily in flat planes. You are fairly limited to above the fabric, and below it.
- If you don't know much about electronics the Lilypad is easier to use and understand. As you learn more you start seeing how your projects would translate to the Arduino, and just how neat and clever (both intentionally, and coincidentally) the Lilypad is.

- I have installed the Arduino IDE on both Fedora 11 and Windows XP. Both are similar and very easy. Windows does have the disadvantage of offering you many COM ports, and you just have to try them all to find the one that's connected to your Arduino. Whereas on my Fedora machine I have to launch it from the terminal, and as root.

- When using the Lilypad you may notice a complete lack of resistors. This is because the power sources readily available are about 3-5V, which is the range the Lilypad likes. But also, despite it's name, conductive thread, while being conductive relative to ordinary thread, is a quite poor conductor with regards more traditional electrical items like wire. So in essence the thread is your resistor. If you need a greater resistance, simply create a longer path of thread between the power source and your components. Adding other pieces, like clasps and such can also add a decorative touch of resistance if needed.

- Conductive thread is like unshielded/uninsulated wire. It is very important not to cross the positive and negative strands. And seeing how easily the thread frays you will need a way to seal away the knot-ends at the very least. I currently use fabric paint, and find it very good, despite a quite long drying time.