Introduction: Light Bike

Hello everyone,

My name is Jeremy and I am doing my first instructable which is a Arduino powered LED light bike as pictured above. This project was both challenging and fun but I will say upfront that it did not go as planned. Because of time constraints and lack of more money to put into it I must deem this project on hold until I can figure out a better way of powering it. This is not to say it didn't work, no what I am stating is that it didn't work the way I had planned.

My intention was to string 120 LEDs around the frame of the bike to create a visible bike at night. I also wanted to make the LEDs turn from a solid green to flashing red when the bike was not in motion. My first thoughts were to see if I could get some kind of motion sensor attached above the back wheel but then remembered I am still in early phases of knowing how to code and really get the best experience out of the Arduino, but if you see this instructable and know how to do this please feel free to add your experience to my project. What I ended up with is when the bike handle is pulled the lights change using a small button, some wire, an Arduino, 3 feet of neopixel strip and lots and lots of batteries.

Step 1: Build Materials

Build Materials(this can be slightly different depending on fabrication):

1. 3 feet (could probably be 2.5) feet of NeoPixel strip (I got from Adafruit).

2. 1 DC female power connector for the 9volt battery

3. 1 9v battery and connector and 4 double a batteries with 1 connector.

4. 1 Momentary button.

5. 1 1000uf capacitor.

6. 1 switch

7. 1 10k resistor

8. Jumpers (I used about 20 but some of these were destroyed from testing certain things) also various sizes.

9. 1 prototype board. (I used a small one) but the size depends on the casing.

10. Velcro (depends on how excessive you are with it) but I used 6 feet of it).

11. Screws ( I use the size of 6-32" to screw in my proto board and Arduino)

12. Tape (it fixes everything)

13. 1 small spring

14. Solder and Solder Iron

15. Last but most important a bike. \

Step 2: Fritz

First things first we need to know how to wire our neopixel strip and button.

For this I went to the internet and found fritz's for both wiring up the neopixels to the Arduino and the momentary button. The first one I got off of and the button fritz I got of a Google search.

This seemed simple enough and I even took Adafruit's advice to power the strip separate from the Arduino itself. This left me with my first challenge how to power the Arduino separate from the strip. Since this project is on a bike which is mobile it also had to be a portable power source.

Step 3: Powering the Project

After reading on Adafruit they recommend using a 1000uf capacitor attracted to the DC power adaptor attached to the Neopixels because the Neopixels are very touchy and have a tendency to burn out if you throw too much power at them. Better safe then sorry so I did as they said and so far no problems with burnt pixels so I as well recommend it.

Now was the time to attach my power to my Arduino and neopixels. I used the battery holders and attached them both to the Arduino (4AA) into the Vin and ground and the 9v into the DC power adaptor which was connected the Neopixels.

Side not make sure you attach all the grounds first before you attach any of the power to be safe from overcharging the pixels.

(I apologize for not having pictures of this process, I got into the zen of building and forgot to document.)

Step 4: Testing the Lights and Button.

First I breadboarded the button from the fritz I got and powered both the Neopixel and Arduino and it worked like a charm. I then proceeded to move my breadboarded button onto the protoboard. At first I had problems (mainly because I am still learning) but my soldered protoboard was not working. The reason behind this is because I was not connecting my points, which after being shown how to do my non working button became a thing of dreams. Now with the push of a button my lights could change the flow of the lights.

Of course I wanted to strip the strand test from the sketch provided by Adafruit to only show green and red lights. Easy right... well not so much as I have no idea what I am doing when it comes to coding . Lucky for me I'm in a class of peers where they really now what they are doing. So with the help from a peer I finally stripped away all the layers in code to simply show only red and green LEDs.

Step 5: Sketch Used for the Light Patterns With Button


#define PIN 6

// Parameter 1 = number of pixels in strip // Parameter 2 = pin number (most are valid) // Parameter 3 = pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) const int buttonPin = 2; int buttonState = 0; Adafruit_NeoPixel strip = Adafruit_NeoPixel(120, PIN, NEO_GRB + NEO_KHZ800);

void setup() { strip.begin();; // Initialize all pixels to 'off' }

void loop() { buttonState = digitalRead(buttonPin); // Some example procedures showing how to display to the pixels: if (buttonState == HIGH) { colorWipe(strip.Color(255, 0, 0), 1); // Red colorWipe(strip.Color(0, 0, 0), 1);

} if (buttonState == LOW) { colorWipe(strip.Color(0, 2555, 0), 1); // Green



// Fill the dots one after the other with a color void colorWipe(uint32_t c, uint8_t wait) { for(uint16_t i=0; i

// Input a value 0 to 255 to get a color value. // The colours are a transition r - g - b - back to r. uint32_t Wheel(byte WheelPos) { if(WheelPos < 85) { return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0); } else if(WheelPos < 170) { WheelPos -= 85; return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3); } else { WheelPos -= 170; return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3); } }

Step 6: Button Problems

Now I needed to figure out how to reach a button from a seat of a bike to the handle bars.

Solution was to attach/solder many jumper cables together to daisy chain up to the handle bars and then figure out a way to make the break handle reach the tiny momentary button.

My solution was to wrap a makeshift button I conceived from a plastic container, a small spring, some velcro and some fabric. The idea behind this thinking would be to wrap the velcro around the break handle and the handlebar with the plastic container resting in between. When pressure is put on the handle it presses the container with spring in it down onto the button thus pressing the button. It's not perfect but it works... even better now that i added stability on the sides of the container with more velcro.

Step 7: Containing the Arduino

I encased my Arduino and protoboard with screws into an old case I had lying around the house. Then drilled out some holes for the cables to go out of. I then attached the AA battery container to the bottom of the Arduino therefore making the Arduino completely portable.

After that I drilled a hold for the 9v adaptor to connect to the power supply which resides on the bottom of the case. This will change in later designs but for easy access to the 9v which drains very fast powering 120 LEDs needs to be changed constantly thus easy access is key.

Side Note: the final picture was the first design before I moved the AA power pack inside and the 9v power pack on the bottom.

Step 8: Adding a Switch

To move the AA power supply into the case I had to add an on/off switch.

These things are pretty simple. I simply connected the wire from the power supply & the Arduino, soldered them together and then soldered them onto the switch. The same goes for the ground side (negative).

I then cut out a crude hole for where the switch would go and fit it into place.

Step 9: Attaching Everything.

Unfortunately I don't have many photos of attachment. But I did go for a revision, the reason being that I was still working on getting the lights to function well and my first set up made it a pain to pull out the container to fix.

The pictures above show my first try at attachment. I bought a light attachment for a bike and tried to repurpose the clamp to hold the case. Like I said it was functional but cumbersome in accessibility. Therefore I had to change the design with velcro strips along the frame to hold the case.

Step 10: Working Sort Of....

You can see project was successful.

But there needs to be change.

1. Need to find a better power source.

2. Need to regulate power better(picture above the battery got so hot that it burnt through the casing)

3. Need to get a better attachment of the casing.

Thank you for taking the time to look at my first real experiment made by me and please feel free to add if you want to or can!

Here is a video of my project!