Introduction: LilyPad Arduino Blinking Bike Safety Patch

Picture of LilyPad Arduino Blinking Bike Safety Patch
I made this embroidered patch in a different instructable, but here I'll show you how to add flashing LEDs to your backpack for fun and safety. I used a LilyPad Arduino with a rechargeable lithium-polymer battery for flatness and re-usability. The LEDs blink in a marquee pattern, two at a time, in patriotic red, white and blue, in fitting with this year's "Re-Make America" Maker Faire theme. Check out this project on Make: Projects and the video from CRAFT.


Step 1: Materials and Tools

Picture of Materials and Tools

Materials and Tools:
-scissors
-needlenose pliers
-sewing needle
-LilyPad Arduino with programmer and USB cable - Maker Shed

Power:
-LiPower board - Sparkfun
-lithium-polymer battery (and charger) - Sparkfun
OR
-LilyPad AAA battery holder (comes with the Maker Shed kit linked above)

-conductive thread - Lame Lifesaver
-conductive velcro - Less EMF
-sticky-back velcro (I got mine at Michael's)
-bag or backpack
-fabric patch to mount circuit
-small scrap of fabric for switch
-thread
-source code and schematic

Coil the leads of each LED: make the longer lead (positive) into a square spiral, and the shorter lead (negative) into a round spiral.

Step 2: Sew the LED Grounds

Picture of Sew the LED Grounds

Check out the schematic. Using your conductive thread, sew a line around the perimeter of the patch, stopping to sew the round leads of each LED into the line. Leave a space on one edge for the conductive velcro (don't sew the velcro yet).

Step 3: Sew the Power Supply and LilyPad

Picture of Sew the Power Supply and LilyPad

Cut one side of the conductive velcro in half, and sew the bottom half over the edge of the patch where you left that space earlier. Sew it down and sew a line over to the + on the LiPower unit (you can also use the LilyPad AAA battery board). The picture shows it sewn to ground, but don't pay attention to that! =]

Sew the other conductive velcro tab down next to (but not touching) the previously-sewn tab. Stitch a line to the + on the LilyPad Arduino. I reinforced these two power leads a few times to reduce the resistance of this switchable area.

Stitch the ground of the power supply to the line of grounds around the edge. Same goes for the LilyPad Arduino. Look at that schematic for help placing the traces.

Step 4: Sew the LilyPad Pins to the LED Positive Leads

Picture of Sew the LilyPad Pins to the LED Positive Leads

This part can take some time. According to the schematic, sew the positive (square-coiled) leads of the LEDs to their respective pins on the LilyPad Arduino. Be sure not to cross any threads, and tie tight knots with close-trimmed ends to prevent fraying fibers from shorting your circuit. I stopped often to let the needle dangle and untwist the thread as I worked, as it likes to get tangled and caught.

At this point you can plug the battery into the LiPower and turn the thing on. Use the other piece of conductive velcro to bridge the two patch tabs and see if your LilyPad boots up. Press the reset button a few times and watch that little green LED on board blink a little. Now you know it's working!

Step 5: Program the Board

Picture of Program the Board

Here's the Arduino code! Load it on your LilyPad by hooking up your programmer and USB cable (or FTDI cable if you have a newer LilyPad). For more info about getting the code onto the Lilypad, check out this page at the Arduino website: http://web.media.mit.edu/~leah/LilyPad/04_lights.html

--begin code

int timer = 100; // The higher the number, the slower the timing.
int pins[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; // an array of pin numbers
int num_pins = 12; // the number of pins (i.e. the length of the array)

void setup()
{
int i;

for (i = 0; i < num_pins; i++) // the array elements are numbered from 0 to num_pins - 1
pinMode(pins[i], OUTPUT); // set each pin as an output
}

void loop()
{
int i;

for (i = 0; i < num_pins/2; i++) { // loop through each pin state (there are six)
digitalWrite(pins[i], HIGH); // turn one LED on,
digitalWrite(pins[i+num_pins/2], HIGH); //then turn its opposite LED on (six positions away)

//now turn the previous LEDs off:

if (i == 0){ //turn the last LED off from the previous go 'round
digitalWrite(pins[num_pins-1], LOW); //
} else{
digitalWrite(pins[i-1], LOW); // turn off each previous LED
}
digitalWrite(pins[(i+num_pins/2)-1], LOW);

delay(timer); // pausing

}

}

Step 6: Affix With Velcro

Picture of Affix With Velcro

I decided to affix the entire circuit patch with velcro instead of sewing it down to my bag, with air travel in mind specifically. It's easy to remove, inspect, and replace. I live in Arizona, so rain isn't too much of a concern, but it should also be removed during rain. You can choose to just remove the battery, as the rest of the circuit won't be damaged by water, so long as you wait for it to be completely dry before plugging the battery back in.

Sticky-back velcro is easier, but any kind will do!

Step 7: All Done!

Picture of All Done!

Now go ride your bike!

Comments

HendrikB7 (author)2017-04-25

As always an EXCELLENT Tutorial from the MISTRESS!!!

Just a question about the FTDI interface. I see that there are FTDI Boards and then there are separate FTDI Cables. My question is this. Can one use an USB to FTDI cable only between the computer and the LilyPad or does one have to have the FTDI board?

HendrikB7 (author)2017-04-24

Awesome!!!!

frankhorvat (author)2016-11-21

Nice project.

Just wondering where you sourced the line drawn Lilypad & other modules

ingamarie (author)2011-03-08

Awesome, that was a fun project. I ended up using the 'Simple' Lilypad and only 8 lights, lining the back to protect the electronics, and making it snap on instead. Thanks so much!

hadimatin (author)2010-08-06

You are great. Excellent.

James Haskin (author)2009-06-15

Watch your patch animation while listening to Franz Ferdinand's Take me out. After the Ritardando at about 1:00 the LEDs sinc up. The same two blink on the quarter note and then it moves on counterclockwise.

BTW this instructable inspired me to make this...
https://www.instructables.com/id/Make-an-LED-Bow-Tie/

mbainrot (author)2009-06-01

Very nice Instructable :)

rolandblais (author)2009-04-13

Based on your cool tutorial, I cobbled together a marquee with my Duemilanove. Thanks for the inspiration!

bekathwia (author)rolandblais2009-04-13

looks great! I also <3 animated gifs. =]

miked123 (author)2009-04-12

Loved this instructable, especially the video. Hope you start making a lot more. (oh and awesome music at the end of the video)

biphenyl (author)2009-04-10

This is so cool! (and a fantastic animated gif, haha) The velcro was a great idea for removing at the airport or on a rainy day!

whopoder (author)2009-04-10

Very COOL!

randofo (author)2009-04-10

Where is the rap music?

About This Instructable

19,631views

56favorites

License:

Bio: Becky Stern is a content creator at Instructables. She has authored hundreds of tutorials about everything from wearable electronics to knitting. Before joining Instructables, Becky ... More »
More by bekathwia:3D Printer Filament Dry BoxSolar Soil Moisture Meter With ESP8266Solar Engraving
Add instructable to: