Saturday, 19 January 2013

Electronic Textiles with Geek Gurl Diaries & LilyPad Arduino


What you will need:

Sewing:


First decide on your design and create it using felt and fabric. I decided to use the Geek Gurl Diaries logo and recreated it by printing a template onto paper first, cutting it out, pinning it to felt before cutting it out and gluing it together. I also sewed a background star shape cut from cotton fabric onto the cushion cover.

Once your cushion cover is prepared sew the LilyPad Ardunio Simple Board to the inside of the cushion cover using conductive thread and the Lilypad coin cell battery holder from the ProtoSnap kit. It's very important that you sew a connection between the coin cell battery holder's minus (-) ground to the LilyPad Ardunio simple board minus (-) ground and again for the positive (+) between both boards. Once you have finished sewing you can test that the connection is good by putting your battery into the battery coin cell holder. Your simple board should flash to indicate that it is working.

The next step is to decide where you want your LED lights to be and sew them in place. Much like producing a standard circuit, you must connect the positive (+) of the LED to a number on the LilyPad arduino board and the negative (-) or ground to the negative (-) of the LilyPad simple board. Once you have sewn one LED you should test to ensure it is working by placing your coin cell battery into the holder, and the light should come on if your circuit is good. Continue to sew all your LED lights onto your cushion cover being careful not to have the threads crossing each other or touching as it will short the circuit. Sometimes it's just best to sew the long way round!

Connecting to a computer to program the lights:


Now that all the sewing is complete and we have tested that our circuit is good and the lights work, we need to connect the Lilypad board to a computer using the FTDI Basic breakout and a USB cable. Once connected you will need to install the Arduino software to be able to program the lights. This tutorial explains how to install and configure the software for your Lilypad. Once installed run the arduino software, and select Tools, Serial Port, COM3 and then select your ardunio board from Tools, Boards. We want to test if we can upload a program to our board. Click on File, Examples, Basic, Blink. When the example code loads you will need to make sure that you change the number of the LED pin to match the numbers on the Lilypad board that you have sewn the leds to. Then compile the code and upload it to the board.

Once you are happy that your LEDs are working, we can start to generate our own code. In a new Arduino window write the following:

void setup() {

pinMode(19, OUTPUT); 
pinMode(17, OUTPUT); 
pinMode(10, OUTPUT); 
pinMode(6, OUTPUT); 
pinMode(5, OUTPUT);

}

Making sure to change the pin numbers to match the numbers on your Lilypad board that you have sewn the LEDs to.

Now we have told our program which pins to use we need to tell them what to do. I want mine to come on in order one after the other so underneath the first part of code I need to add:

void loop() {

digitalWrite(19, HIGH);     //This turns on the LED
delay(1000);                //Waits for a second
digitalWrite(19, LOW);      //Turns of the LED
delay(1000);                //Waits a second

}

Now I've written it for one LED, I can copy and paste the code, changing the number of the pin as I go along, so that finally all my LEDs connected to the Lilypad board will come on in sequence. Compile the code and upload it to the Lilypad.

Ta da, your very own electronic textile project! Now you know some basic tips and tricks you could work out how to program the Lilypad to have the lights come on for a second randomly rather than in sequence or you could add more functionality with sensors.

Have a go and see what fun you can have! Please support my work getting more teenagers (especially girls) into tech, by watching, liking, commenting and sharing my videos

Thanks,

Carrie Anne.

No comments:

Post a Comment