I Heart LilyPad Arduino

44
I <3 LilyPad Arduino Rain Ashford | http://rainycatz.wordpress

description

Short introduction to Arduino and in particular LilyPad Arduino. I describe two of my most recent (Sept 2010) LilyPad projects Twinkle Tartiflette and I

Transcript of I Heart LilyPad Arduino

Page 1: I Heart LilyPad Arduino

I <3 LilyPad ArduinoRain Ashford | http://rainycatz.wordpress

Page 2: I Heart LilyPad Arduino

Arduino is one of a number of PCB microcontrollers for rapid prototyping. They’re a fantastic gateway to learning programming & electronics for children and adults alike, because there is so much documentation and easy to follow lessons, examples and code libraries shared via open source licenses online and in books.

Page 3: I Heart LilyPad Arduino

The early seeds to this platform were born from experimentation at MIT Media Lab, in 2001, by Casey Reas & Ben Fry who explored ways of simplifying coding & electronics for artists & designers to prototype their projects – they came up with Processing, an open source, cross platform language & development environment - http://processing.org/

Page 4: I Heart LilyPad Arduino

It wasn’t too long before complementary open hardware projects came along building on the Processing language & environment – the Wiring project initiated by Hernando Barragán began in 2003, followed by the InstantSOUP project and first Arduino boards led by Massimo Banzi’s team at the Interaction Design Institute, Ivrea, Italy.

Wiring board image borrowed from, www.maartenlamers.com/ThisIsWiring/ borrowed Massimo Banzi's website www.potemkin.org

Digital Arduino (my first in 2008)

Page 5: I Heart LilyPad Arduino

My first Arduino & project!..was this ‘Digital’ Arduino, a gift in April 2008 and I was rather amused, a bit bemused, but a lot inspired with a simple sketch I had tentatively running an LED sequence on a solderless breadboard.

Page 6: I Heart LilyPad Arduino

..it did kick-off my interest in tinkering so I was very excited to attend Makers & Hackers, in February 2009, a one-day hack-a-thon where I first saw a sewing machine, soldering iron & Arduino side-by-side. It was a great day for sharing and learning for everyone.

Page 7: I Heart LilyPad Arduino

..the ideas and possibilities that blossomed out of that day filled me with joy and brought some lovely new friends too with whom I was part of a team and made a very strange Arduino alarm clock! Arduino is great for collaborative projects!

Page 8: I Heart LilyPad Arduino

..about 2 weeks later I attended the UK’s first Maker Faire in Newcastle where our BBC Backstage team built an even stranger RFID weather cock-bot tank and I met lots more ‘tinkerers’ with awesome and boggling projects - there was no going back!

Page 9: I Heart LilyPad Arduino

Anyway… Somewhere along the line I heard about this thing called a LilyPad which sounded like just the ticket for my interactive art leanings!

Page 10: I Heart LilyPad Arduino

LilyPad Arduino is a great platform… * Rapid prototyping* For my standalone interactive art projects * Wearable artworks* Learning about electronics and programming.

Twinkle Starduino 2009

Page 11: I Heart LilyPad Arduino

What is it? The LilyPad Arduino is a microcontroller & suite of modules designed for wearables & e-textiles that can be sewn directly to fabric with conductive thread. It was designed and developed by Leah Buechley of MIT & Sparkfun Electronics.

Page 12: I Heart LilyPad Arduino

Official Arduinos use the megaAVR series of chips, the first LilyPad board used the ATmega168V, the low-power version of the ATmega168, newer LilyPads have an ATmega328 chip, the difference is 16K vs. 32K. Arduino clones & other microcontrollers use various processors, e.g. mbed uses an ARM chip.

Page 13: I Heart LilyPad Arduino

The board runs on 2-5 volts from USB or battery. It comes pre-programmed with a bootloader that simplifies the uploading of programs to the on-chip flash memory, compared with other devices that typically need an external chip programmer.

Page 14: I Heart LilyPad Arduino

The LilyPad has 22 pads / pins *Pin 1 - TX/D1Pins 2,3,4 - D2, D3, D4Pin 5 - GND or "-" (ground)Pin 6 - VCC or "+" (power)Pins 7,8,9,10,11,12,13,14,15 - D5 through to D13Pins 16,17,18,19,20,21 - A0 through to A5 (analog pins)

Page 15: I Heart LilyPad Arduino

* It’s a good idea to familiarise yourself with what each of the pins are, their I/O and keep a track of what pins you are sewing to which modules!

Page 16: I Heart LilyPad Arduino

..some more specsDigital I/O Pins14 (of which 6 provide PWM output) Analog Input Pins6 DC Current per I/O Pin40 mA Flash Memory16 KB (of which 2 KB used by bootloader) SRAM1 KB EEPROM512 bytes Clock Speed8 MHzCircular, approximately 50mm (2") in diameter. The board itself is .8mm (1/32") thick (approximately 3mm (1/8") where electronics are attached)Wash at your own risk!

Page 17: I Heart LilyPad Arduino

LilyPad uses the Arduino IDE (integrated development environment) which is a cross-platform application for Linux, Mac OSX & Windows – the editor (above) allows you to compile ‘sketches’ in C programming language. Leah Buechley’s excellent tutorial to the whole process from installing IDE to basic programming explanations is here: http://web.media.mit.edu/~leah/LilyPad/index.html

Page 18: I Heart LilyPad Arduino

The Arduino IDE comes with access to tons of sketch libraries which are all open source and easily downloadable into your editor to use as they are, or customise to your specific needs and great for people just starting out with programming.

Page 19: I Heart LilyPad Arduino

Load your sketches via a Sparkfun Basic FTDI breakout which you attach to the six pin male header and then connect via mini USB cable to your computer of choice. It allows a sketch to be loaded without hitting reset.

Page 20: I Heart LilyPad Arduino

Sewing: to connect the modules, I use conductive thread from my Arduino supplier, though I’ve started looking at creating work with other conductive medium, such as safety pins, coloured metallic embroidery thread, hooks, silver conductive marker pens and paint!

Page 21: I Heart LilyPad Arduino

For a glimpse of what you can do with LilyPad Arduino I’d like to show TwinkleTartiflette – a smorgorsboard of schema and debugging examples - a wearable, interactive sound artwork!

Page 22: I Heart LilyPad Arduino

Inspiration - I recently played with a Stylophone BeatBox and pondered how one would make an interactive artwork using LilyPad and a stylus…

Page 23: I Heart LilyPad Arduino

..this lead to some head scratching over complex sewing schematics!

Page 24: I Heart LilyPad Arduino

I wanted to combine words, image and sound into an interactive experience, so created felt stars and began sewing my schema with conductive thread - I’m the first to admit I’m not great at embroidery!

Page 25: I Heart LilyPad Arduino

After what seemed like quite a while later (about a week of evenings fitted round the day job) I had two stars with conductive thread words in the right order.

Page 26: I Heart LilyPad Arduino

..which needed to fit the t-shirt, I was mindful to sew the words carefully so frayed thread did not touch and cause a catastrophe.

Page 27: I Heart LilyPad Arduino

It was now time to deploy the schema – I’d mapped notes to words and then back to pins on the LilyPad.

Page 28: I Heart LilyPad Arduino

A couple of weeks later I thought I’d sewn all the words to the right notes and pins, also adding buzzer and battery modules. There were some interesting insulations/bridging issues to be solved between the various paths of conductive thread too – but I was ready to extract code ideas from my brain to see if they’d compile!

Page 29: I Heart LilyPad Arduino

The code I have written uses the speaker module to produce simple musical notes from connecting to the words with a stylus. I used a chart to work out the frequencies of the different notes.

As I mentioned before, Arduino has various libraries and code examples that are released under open source licence.

Page 30: I Heart LilyPad Arduino

Code added and it’s time to test - annoyingly there was a problem! The buzzer is not playing notes correctly, after some thinking and testing with a multimeter, croc clips and a single resistor - a solution was concluded – I’d have to add some resistors.

Page 31: I Heart LilyPad Arduino

Unconnected the circuit is connected to high, but when the stylus touches a word it creates a simple circuit through the resistor and pulls it to low. Looking through a ton of resistors 10k ohm seemed like a good fit, but where and how to add them was another question!

Page 32: I Heart LilyPad Arduino

A small LilyPad protoboard was just the job to attach the resistors. I have six notes, so the protoboard was just right – but I only had 5 x 10k ohm resistors, but found another resistor that was near enough!

Page 33: I Heart LilyPad Arduino

After some soldering and complex routing of conductive thread for the resistors, I’d fix0red one problem, but then found I’d another to debug! Earlier, I said to be mindful of the pins, I had accidentally connected to pin 13 which is the LED pin, that has it’s own resistor and is too low for this project. This showed up in resistance testing with the multimeter.

Page 34: I Heart LilyPad Arduino

The fix for the wrong pin incurred some more unpicking and re-routing. I used an analogue pin (as it was nearer and the least hassle) this time which required to be reflected in the code. Yep, a crocodile clip is the best thing to use as a stylus!

Page 35: I Heart LilyPad Arduino

Yay, Twinkle Tartiflette lives! All that remains to do is tidy up a bit of sewing and try to ensure there are no trailing bits of conductive thread to cause shorts – textile glue is handy for this!

Page 36: I Heart LilyPad Arduino

Here’s what finished Twinkle Tartiflette looks like! Visit my blog http://rainycatz.wordpress.com/ for more info on construction, video and code.

Page 37: I Heart LilyPad Arduino

Finally, a quick look at my latest project I <3 0X0……an interactive artwork, game, musical fancy and experiment. * Created to test the usefulness of conductive Velcro* Wanted to make something that was both interactive and interesting

Page 38: I Heart LilyPad Arduino

* I wanted to create something both interactive and playful * Decided 3 x 3 grid system used for a game of noughts and crosses would be simple in terms scale - maximum number conductivity points* Square grid that would be easy to contain

Page 39: I Heart LilyPad Arduino

* My schematic design has 9 tracks of conductive thread stitches that lead back to 9 digital LilyPad Arduino pins. There are 22 pins on the LilyPad Arduino 12 of which are digital I/O * I <3 0X0 has stylised heart shape design, plus visible placement of components and conductive thread* At this stage I wrote the basic bones of the underlying code, as a ‘sketch’ in the Arduino integrated development environment (IDE)

Page 40: I Heart LilyPad Arduino

Considerable thought went into devising how to connect the objects that would become the physical noughts and crosses. * Needed a way of discerning noughts from crosses physically as well as in the code* 3 x3 grid for each placed nought or cross would be made up of three rails of connected, conductive Velcro* Noughts and crosses would have two corresponding rails of fuzzy Velcro on their undersides, but would join to two differing rails on the grid

Page 41: I Heart LilyPad Arduino

Debugging: noughts and crosses and Velcro rails with conductive thread* testing revealed that they cross-connected the rails in a bad way, which meant an effective circuit was created where none existed in the empty parts of the grid where no object was placed* After much testing and thinking, crocodile clips and diodes showed it was necessary to implement a diode in each of the objects to push the current in one direction* Setback project over a week as new noughts and crosses were needed

Page 42: I Heart LilyPad Arduino

Revisiting the code:* New code for checking rows, columns and diagonals* Music transposed for 3 different tunes - noughts, crosses & stalemate* Bespoke music routine written for me by hacker Ciaran Anscomb

Page 43: I Heart LilyPad Arduino

Testing & tidying:* Hardware and code running as expected * Test all the conductive thread tracks and respective knots were all working properly and not touching each other or fraying* Tidy artwork by backing it onto some coloured fabric * Embellish with star sequins, which also acted as a way of securely sewing the two fabrics to each other* Add regular Velcro to back for portability

Page 44: I Heart LilyPad Arduino

I <3 LilyPad Arduino

Thanks!

Rain Ashford | http://rainycatz.wordpress

@Rainycat