Programming a Lilytiny (or LilyTwinkle)

Change of topics today, because I have a new job (yeah!) that requires me to work much more with arduino than with 3d printers. So I’ve been scouring the web in search of help for some of the most strange topics and I had my share of problems when trying to program the small lilytiny I bought some while ago.

I chose a Lilytwinkle, that is identical to the Lilytiny but just comes preprogrammed with some cute effects so you can choose on which pin to attach your led depending on the light effect you want to achieve.

Electric  Lily Tiny Monsters by Monica Norton on Prezi

But my LilyTwinkle turned out to be a non programmed LilyTiny, so I had to program the damn little thing…. And the problems started because I found no real guide on how to do it. So as a reminder for myself, and to help out any other lost soul trying to program these small cute little boards, here’s my guide.

I bought this Tiny AVR programmer at sparkfun, and added the ISP Pogo adapter

Photo 2

Photo 3

I use a Mac, so I don’t need to add any drivers but Windows asks for other stuff and you can find info about it on the High-Low Tech page at MIT Media Lab. The webpage is not working anymore (yuck) but the internet archive will help us out luckily. 

Now it’s time to have a look at our Arduino, because we need to add support for these teeny weeny boards that are not included by default. You can download it from GitHub, and it’s the attiny file. Be careful that if you have already installed the Gemma and Trinket boards they installed with the same name, so be careful and don’t mess up the folders. You now will have a nice new set of boards from which to choose from, and I found choosing ATtiny85 (internal 1 MH clock) works for me. If someone has a different setup that works better please tell me, I have to admit I chose trial and error system ;)

Menubar

And it’s time to write the code down, and start playing with the various effects. Map the pins like this (I know it’s obvious, but non the less someone out there will appreciate the obvious steps)

int led0 = 0;
int led1 = 1;
int led2 = 2;
int led3 = 3;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led0, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);

}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led0, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(led0, LOW); // turn the LED off by making the voltage LOW
delay(500);

……

}

And upload it! Choose the right board, don’t fuss with the serial port and check to have in the Programmer “USBtinyISP”. Now stab the small board being careful to align the contacts in the right direction (check the picture!) and while stabbing it upload the sketch. If it gives you an error try a couple of times because sometimes the connection is not that perfect, but be stubborn and you will end up with your small lilyTiny doing just what you asked her to do.

Photo 1

Yeah!!!!

This entry was posted in arduino and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>