Welcome to experiment 6 of the LilyPad Design Kit, where you’ll dive into the design and creation of a microcontroller circuit.
A microcontroller is a tiny computer that can be programmed to intake information and regulate power to your circuit, letting you control lights, sensors, sound, movement, and a number of other factors. Ultimately this will let you make projects that are unique, customized to your needs, and interactive! We won't be programming this controller, it comes pre-programmed, but you'll learn how to connect the parts. When you're ready to program your own circuit, it will go together the same way!
Before we begin, here are a few resources you might find helpful:
To get started, you'll need these parts. If you're using the Lilypad Design Kit, you've already got them all!
Now is also the time to go ahead and get your fabric ready on the embroidery hoop, if you're using one.
To start, let's make sure we've got everything arranged to our liking. It's going to be important that one positive pin on the battery pack points towards the positive pin on the LilyTiny board. Likewise, one negative pin should point towards the negative on the board. You need room for both of these components as well as for the four LEDs to spread around the LilyTiny board with positive pins pointing towards the numbered pins on the Tiny board.
Once you know where you want to put the components and you're confident there's plenty of room for everything, set aside everything except your battery holder. Don't put the battery in yet! Sew down the positive pin furthest from where you want to put your tiny board, then sew several stitches to the closer positive pin. Sew that down as well. If you've been following along for the entire LDK series, you're probably an expert at this part by now! Don't cut the thread yet.
Continuing the trace from the positive pin of the battery, sew to the positive pin of the LilyTiny board and sew it down with several stitches.
Knot and cut your thread before the next step.
Starting with a new thread trace, sew down one of the numbered pins on the Tiny board. From that pin, sew a line of stitches to where you would like the LED to be, and sew down the positive pin of that LED. Knot and cut the thread, and leave the negative pin alone for now.
Repeat this process three more times, connecting each of the remaining numbered pins to the positive side of an LED.
This is the homestretch! The negative side of this circuit will be one long trace, so make sure your thread is long enough!
Just like you did on the positive side, sew down both pins of the battery pack, then extend that trace to the negative pin of the Tiny board. Unlike the positive side, you don't need to knot and cut the thread here; you'll be continuing this trace.
Extend the line of stitching from the negative pin of the Tiny board to the negative pin of the nearest LED, being very careful to parallel the positive trace without touching it. Continue this trace around the outer perimeter of the LEDs, connecting all of the negative pins as you encounter them. When you get to the last LED, knot and cut your thread -- there's no need to bring it back around to the battery pack.
This is it! Slide the battery, positive side up, into the battery holder, and turn the switch on.
Each light will display a different behavior. Pin 0 will do a "breathing" fade. Pin 1 will flash a heartbeat pattern. Pin 2 will blink on and off. And, Pin 3 will display a random twinkle. These are great examples of just a few of the light effects you can achieve with Arduino code. When you're ready to start programming for yourself, you'll find the code used in this board on the LilyTiny product page under "Documents"
If you love the LilyTiny circuit and want to try another pre-programmed microcontroller, check out the LilyTwinkle! It's the exact same board you've just used, but with different code. That means that you'll hook up lights the same way, but instead of performing 4 different behaviors, they'll all display a twinkling effect together. Cute!
Check out these cool projects made using this circuit:
Want to do more with your LilyTiny and LilyTwinkle boards? There are lots of tutorials out there to help and inspire you to get big results out of our little boards!
learn.sparkfun.com | CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado