Getting That Hack On Pt. 3 – Going Pro with the Lilypad Mp3


**The following posts outline experiences with the Lilypad MP3 over about a one-week period. So much work went into it, that I forget how quick a week is!**

So before getting my hands on the LilyPad MP3, I assumed programming for it would be pretty straightforward and similar to the Arduino UNO. I mean, I expected a learning curve since it was still a different form factor, but I figured that the code would be more streamlined since lilypad projects seem to have simpler tech (as a whole).

Boy, was I wrong.

Standard Lilypad

Standard Lilypad

Special Lilypad MP3

Special Lilypad MP3

Lilypad MP3 != Lilypad

Maybe if it was the Lilypad, minus MP3, things would have been a lot easier. But the moment I loaded the sample “Trigger” and “Player” sketches, I knew it was going to be a long day.

And if you notice the scrollbar on the side of the screenshot, the “Player” sketch went on and on with what looked like cryptic code. I have no doubt that if I had a strict CSE background parsing through the code would have been much easier. And to make things worse, Sparkfun’s website was no help either since documentation is scarce and not so newb-friendly. Even Google, who’s been savior to many a project for me, could barely find information about it since the LilyPad MP3 is relatively new to the market!! But I’m not one to give up and tried my best to understand what was really going on.

What's a volatile boolean and why are there so many of them?!

What’s a volatile boolean and why are there so many of them?!

To be honest, I felt pretty intimidated and was scared that I wouldn’t be able to figure it all out. But there was no way I was going to let the team down, especially since throughout the quarter I had told them to be positive because all the tech was possible. It was just that now it was time for me to eat my words.

Flash forward 2 days later, and I was able to understand and modify the code to work with our zipper potentiometer and preliminary switches! Finally! I had to painstakingly piece together the similarities and differences between the Lilypad MP3, Lilypad, and Arduino UNO. For example, like the Lilypad, the triggers of the sewable pins work by completing a circuit to ground, meaning that the way you read the state of a button is to check if it’s LOW. But the way it’s programmed is just like the Arduino UNO, meaning that defining a pin as “A4” is just stating to look at data from Analog pin 4, “D2” to look at Digital pin 2, and so on.

Comparison of datasheets from all three boards. A little bit from the UNO, a little of Lilypad…

Arduino UNO

Arduino UNO

Lilypad MP3

Lilypad MP3



Always remembering that the code was just like the Arduino UNO was key for me. I may not have a CSE degree, but I have pretty good fundamentals and the scientist in me kept experimenting along the way.

Code-side, it turned out that the length of the “Player” sketch was mainly due to whitespace, lines dedicated to debugging code (Serial.println’s), and functionality related to a rotary encoder. Once I looked past those things, I was able to merge some of the “Trigger” sketch code to make it do what I wanted. WHEW!!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s