Flashing LED Top Tube Pad for Your Bike

About: I am the Technical Support Manager for Sparkfun Electronics. If you have needed some help with your widget at Sparkfun, you have likely talked to me at one point or the other. I'm a tinkerer by nature. For a...

Well it's that time of year again. That's right, the sun is going down early, and it's getting hard to avoid logging some miles on your bike after dark. You likely have great lights front and rear already, but what about on the sides of your bike? When crossing intersections, and cruising down those long stretches of unlit roads, a biker can be easy to miss.

Say hello to the led clad top tube pad. Not only does it provide a little protection for your bikes paint job. It also provides a lot of protection for you when riding in the dark. When I sought out to build this project, I had some simple goals in mind.

1. It needs to be self contained
2. It needs to bring lots of attention to the bike with out distracting the cyclist.
3. It needs to look clean

With this in mind it was time to put together a shopping list.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Time to Pick Up Some New Toys.

Here is what we need to put this together.

We can get all of our parts from Sparkfun. I have also included the code for this project later in the instructable.

Arduino Pro mini x1
If your new to the Pro series Arduino, you will also need an FTDI basic. This let's us program the Pro mini over usb.
LEDs x11
Resistors x 11
Wire Wrap Wire x  an assortment of colors. Probably no less than 4 colors.
Battery x1
Don't forget a charger. Lipos need a special charger to keep them from exploding.

Step 2: I Hope You Have Your Thinking Caps On.

Let's take a moment to explain exactly what is going on under the hood. This step is going to be a bit of a data dump, but this will be very useful information when your putting this together, and working with the code. This is important to understand before going further. We'll get to the fun part soon enough.

I have used tri color leds so that we can use a whole variety of colors to match your mood, and your bike. The system is a bit complicated because of these leds though. Tri color leds have 4 pins. 1 is ground, and the other 3 are color pins (Red, Green, Blue). In a normal set up you would usually connect the ground to the Arduino ground, and pull each color pin high to change colors. In this system that would mean with 11 leds, 3 colors each, we would need 33 I/O pins!

Unless we strap a Arduino Mega to this thing, there's no way that we can make that work. So here are a few tricks that I pulled to get the pins down to a more respectable number.

Let's look at the layout. Instead of wiring it like this


We will wire it like this.


By strategically wiring two leds to act as one, we cut down that initial 33 to 21. But that still won't cut it, we need to bring that down even more. So the next trick, instead of giving each led it's own I/O pins for color, we will make all 11 leds share the same I/O pin for each color.

Why you ask? This way we only need 3 pins. This brings down that 21 to 3. Much better, But wait... If they all share an I/O pin won't they all just turn on and off at the same time?

Remember that tricolor leds have four pins? 33 pins only considered the color pins. We still haven't done anything with the ground pins.

We will give each ground pin an I/O line of it's own. This will let us control which leds are on and off by toggling the Ground pin low, when a color pin is high. We change the color by toggling different color pins high.  If Blue is HIGH, green and red, are low, and 1, and 3's ground are low, and 2,4,5,6,7's grounds are high, only 1, and 3 will be on and will be blue.

If you want all of the leds off, you can simply pull the 3 color I/O's LOW.

Make sense? I hope so. Make sure to look at the schematic below, it should help some.

Step 3: Let's Get to Building This Thing!

Did you manage to make it through that last step? It takes a little brain digestion, but it's nothing you can't handle. Right? So let's have some fun now.

I found a vinyl top tube pad works best for this project. The leds are the same size as most solder tips. This is great because we can grab an old solder tip, and simply melt the vinyl and foam for our our led holes. Just poke your tip through in the pattern that you want your leds. And you'll be set to place your lights right in to the pad. It gives a nice clean look when it's done, and is just about a perfect fit. Be sure you use a lower temperature on your soldering iron as the foam will melt quickly, and you don't want your holes loosing their snug fit.

Step 4: Time to Get Soldering.

There's no turning back now. We have burnt holes in our pad. Now it's time to break out the iron, and get down to work. There are 44 pins to solder wires to. I found the best way to get this task done is to work on one pin at a time. Start with the Red, and do all of each color as you go. There will be a mess of wires by the end of this. You will want to keep the wires organized.

In my photo below of the Arduino all wired up, you may notice Green, Red, Yellow and Black wires. Pretty simple stuff, Green to Green, Red to red, Yellow to Blue, and Black to the individual I/O line to control the specific led.

Remember that layout we were looking at earlier?

When soldering your wires you will want  to link 4 leds in pairs. This will allow 1 control pin for both leds.

When your done soldering wires you should end up with 7 ground wires, and 3 bundles of 7 color wires.

Step 5: Attaching the Leds to the Arduino

I soldered the resistors directly into Arduino pins 2-8. These will be your control pins. The color wires are attached to Arduino10-12. Solder it all up, and your ready for code.

Copy and past the code below into a Sketch in Arduino. There are a few notes in the code to help you modify the colors, and patterns if you would like to.

/* Source code for top tube bike light.
Written by Timothy Holmberg

int l1 =2; //gnd control pins
int l2 =3; // that is a lower case L not a #1
int l3 =4;
int l4 =5;
int l5=6;
int l6 =7;
int l7=8;

int l8=10; //color
int l9=11;
int l00=12;

void setup()
pinMode(l1, OUTPUT);
pinMode(l2, OUTPUT);
pinMode(l3, OUTPUT);
pinMode(l4, OUTPUT);
pinMode(l5, OUTPUT);
pinMode(l6, OUTPUT);
pinMode(l7, OUTPUT);

pinMode(l8, OUTPUT);
pinMode(l9, OUTPUT);
digitalWrite(l8, HIGH);  
// By pulling this high, we are keeping the color green.
// If you want to change colors in your pattern, you will want  to pull
// these pins (l8,l9,l00) high and low in the void loop, not the void setup.
pinMode(l00, OUTPUT);

Serial.begin(9600);        }

void loop()

{ test();


void test()
 digitalWrite(l1, LOW);  // all I am doing here is calling individual leds to turn on and off.
 digitalWrite(l1, HIGH);
 digitalWrite(l2, LOW);
 digitalWrite(l2, HIGH);  
 digitalWrite(l3, LOW);
 digitalWrite(l3, HIGH);
 digitalWrite(l4, LOW);
 digitalWrite(l4, HIGH);
 digitalWrite(l5, LOW);
  digitalWrite(l5, HIGH);  
  digitalWrite(l6, LOW);
 digitalWrite(l6, HIGH);  
  digitalWrite(l7, LOW);
 digitalWrite(l7, HIGH);

//Try changing things up. See what happens.

Step 6: Go for a Ride.

It's all up and running. Now just wait for the sun to go down, and head out for a ride!

Light Up the Night! Contest

First Prize in the
Light Up the Night! Contest

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    16 Discussions


    8 years ago on Introduction

    I really like this idea, I'll definitely try it at some point!

    I absolutely LOVE your instructable and it would betotally rad on my bike. The only drag about it is the cost. I priced out the items from sparkfun and it seems to run up to 100 dollars (I don't have colour wire wrap). Any advice on other places where I could find a better price?

    2 replies

     Hey there. I am sorry to leave you hanging for a reply for so long. I think that you could do this project for a lot less now. There are two tricks for you. If you just want to power the leds, you could wire all of the leds directly to a battery. This would only be one color. I wanted 3 colors that were programmable. If you are ok with it only being one color, it would be really easy, and you could cut out the cost of the Arduino, and the extra price, and complication of working with the tri color leds. From there, I would recommend you check out an item we just started selling, it is a 25 pack of leds for $8 bucks. Not bad. You could get the whole project done with a 25 pack, a lipo battery, a power switch, and wires. And a top tube pad of course. ;) I hope this helps, and lets more people get at it. I will right a new instructable in the next week or two.


    9 years ago on Introduction

     Great Job. This is a great beginner-to-intermediate electronics project. The perfect project from someone who wants to take its skills to the next level.

    Good luck in the contest!

    2 replies

    9 years ago on Introduction

     I'm suprised about the rating too... I think it's a very good idea but it is one of those that does take someone that knows about electronics and parts to buy.. I would be interested in this if it was easier. It's kind of like Christmas lights!

    1 reply

    Reply 9 years ago on Introduction

    It is a bit complicated of a project, I tried to make it as simple as possible. But it is definitely a bit of an intermediate project.

    If you are interested in getting started with Arduino, there is a ton of information out there to help you.

    I have some beginner tutorials on my website, www.badfrank.net

    Also there is lots of projects, and information available at www.arduino.cc

    Sparkfun has a great Arduino starter kit also.


    Reply 9 years ago on Introduction

    Thank you for your support. I see your instructable is in the lead. Good luck. It's a nice idea, I will be sure to give you a vote too.


    9 years ago on Introduction

    I think this is a great ible. Some of the electronic diagrams can seem daunting, but this was well documented in a manner that is easy to follow.

    I don't quite understand the low rating. It would be nice to know why.

    1 reply

    Reply 9 years ago on Introduction

    Thanks for the complement, and for checking out my instructable. The low rating bugs me. Seems a bit unfounded. But what can you do. Any way, glad you enjoyed it.
    Thanks again.


    9 years ago on Introduction

    The rating on this is surprisingly low for something published today with no comments (was 2.11) - I'd suggest some deliberate down-rating from multiple accounts - post a Forum Topic if you agree.