Introduction: Light Up Bike Basket

About: Just a college student trying to make a bunch of stuff.

No need for a tiny bike basket and a utilitarian bike light! This bike basket is a nice bike light and a basket all rolled into one cool looking unit. A nice touch to this design is that there are no buttons or switches that needed to be pressed because the bike lights will turn on when it is dark out and the bike is moving. With the addition of a tilt sensor, you can even have a turn signal!

Supplies

  1. Large Picnic Basket- I found one off of amazon, just be sure the basket will fit between the handlebars and front tire with at least an inch to spare
  2. Neopixel waterproof LED strip- For my picnic basket I got one that is 16.4 feet long, but you may need more or less depending on the design you want of the bike lights.
  3. Arduino UNO
  4. Jumper Cables
  5. Breadboard
  6. Short USB to A cord
  7. 5Volt Cellphone Powerbank - this will be the battery so to speak for the lights, make sure it has 5V of output.
  8. Tilt Sensor (optional if you want the lights to change as you turn)
  9. Photoresistor
  10. 110 Ohm resistor
  11. Electric Tape
  12. Gorilla Tape
  13. Hot glue gun
  14. Zip ties
  15. Measuring tape and/or ruler
  16. solder kit
  17. 2 Belts or 4 weldable and flat pieces of metal- The metal would be much more stable, but it requires a forge and welding to make them.
  18. Exacto knife
  19. Cardboard or light wood- The wood must be lightweight yet sturdy enough to protect the electronics from stuff put inside the basket.
  20. Stiff wire- Preferably from a wire coat hanger as it helps support the bike basket
  21. Flat Pieces of Metal- This can be any kind of metal you can wield with, but the metal pieces must be long enough to support the bottom and backside of your bike basket.
  22. welding tools- We will do a simple welding technique called a line to attach two pieces of metal together
  23. Forge- The Forge is used to create a hook for the metal support to attach the bike and the support together
  24. metal grinder- Used to smooth out any rough edges on the metal
  25. drill press- Used to drill holes into the belts and/or metal

Step 1: Modifying the Basket (with Zip Ties and Belts)

The first step is to modify the picnic basket into a bike basket. There are technically 2 ways to do this, and each way has its pros and cons. The first way is with zip ties and belts, which is much easier to make and put on multiple bikes, but it is not as stable as with metal supports.

  • The first way is to simply measure where you would want the basket to attach to the handlebars. Remember to have the bottom of the bike basket be at least 3 inches away from the front tire so that when the basket sinks it will not touch the tire.
  • The attachment site must be before the bike brakes to ensure that you can always use the bike brakes.
  • Once you have measured, make 2 parallel holes horizontally on the left and right back side ( facing the rider). This is where you will attach the zip ties to the basket.
  • Thread the zip tie through the two holes on each side, This is where the belts attach to the basket so when tightening the zip ties, ensure that a belt can slide through the zip tie.
  • Measure the diameter of the handlebar, and then drill a hole through the belt about a quarter of an inch before the belt can circle around the diameter of the handlebar to ensure a tight fit.
  • Cut off any excess belt.

Step 2: Modifying the Basket With Metal Supports

This is the more complicated way of creating supports, but it much more sturdy so you can put heavier objects in it. The supports are essentially a large L- bracket but with hooks on the end, so creating this requires some cutting, welding and even forging.

  • The first step is to measure and cut out your pieces of metal. The bottom pieces can be slightly shorter than the width of the basket, but add at least 3 inches to the metal pieces that will go on the back of the basket
  • Next, clean the metal with a grinder and then measure the circumference of your bike handlebars. Take that circumference and calculate the diameter of your handlebars.
  • Then take the longer pieces of metal and place one into the forge. Make sure the metal is a nice uniform orange color before forging the extra inches of metal into a hook. While creating the hook, keep the inside of the hook at least 1/2 of an inch bigger than the diameter of the bike handlebars and make sure that the end of the hook is at least 1/4 of an inch bigger than the diameter of the bike handlebars. Repeat this step for the other long piece of metal and make them as similar as possible.
  • Once the long pieces have cooled, weld the shorter pieces to the bottom side of the long piece. Make sure the opening of the hook faces outward( opposite of the short piece) before welding the pieces together. Repeat this process for the other pieces to end up with 2 L shaped pieces of metal with hooks on the end.
  • With a heavy-duty drill press, drill holes in the bottom pieces where the support touches the bike basket. add at least 4 holes on each bottom piece, making sure that you could thread a zip tie between each pair. Do the same for the other L bracket, making sure that the holes are parallel to the other holes in the other L- bracket.

Step 3: Aligning the Basket

The next thing to do is to drill holes in the bike basket that line up with the holes drilled on the metal support.

  • To do this place the metal supports onto the bike, and then place the basket on top. Make sure that the bike basket does not interfere with pressing the front breaks! The supports should be evenly spaced from the middle of the bike handlebar.
  • With a marker or chalk, look underneath and place a large dot where the metal supports have holes. This is so you can align the holes with the basket and the metal support.
  • With a drill, drill holes where you marked on the bottom of the basket.
  • Cut a small hole in the back to thread the Neopixels through the bike basket
  • Now take the Neopixel lights and place them on the basket where you would like. Use either packing tape or painters tape to easily change the design until you see fit. ( I just wrapped the lights around starting at the back and made parallel lines).
  • Then glue the Neopixels on the basket with hot glue.

Step 4: Setting Up the Electronics

Now for the fun part! This part requires some soldering and electrical know-how, But I have a reference picture for the breadboard and Arduino.

  • First off, you may need to solder some jump wires to the Neopixels. Try to match the color of the wires on the neo pixels to the jump cables, then Place the Ground, Data, and Power cables to the Arduino. (Put the data cable on Pin 6). Place the ground cable on the right - 53, and the power cable on right + 65.
  • Now you want to make the photoresistor long enough to go through the top of the basket. Measure the distance from the breadbox inside the basket to the top of the basket and subtract from that measurement with a jumper cable. Poke a hole to let the photoresistor through the basket. Using spare insulated wire, solder the photoresistor to the wire, and insulate the remaining metal with electrical tape. Now solder the wire to jump cables and then insulate the exposed metal with electrical tape.
  • Next, use the pictures as a guide to where to place the Jumper cables on the Arduino. Take a jumper cable put it in the 3.3v and place the other end to the right +31. take another cable and place it in the 5v on the Arduino and put the other in the right +49. Place yet another ( longer) and place the jump cable on J1, and the end on A0.
  • Place the tilt sensor on B24 through B37. Attach the Ground (GND) cable to the right -64 hole. The SCL and SDA cables go on the two uppermost holes right below the reset button.The VCC wire goes to the right + 42 cable.
  • Now take another jumper cable put it in the 3.3v and place the other end to the right +31. take another cable and place it in the 5v on the arduino and put the other ind on the right +49.
  • Place the photoresistor jumper cables onto F1 and F6. Then place the 110 ohm resistor on H1 and the third hole on the - line. Next take a shrt cable and place one end at J6 and the other end at right +9. Take another jumper cable and place it on J5 and the sixth + line.

Step 5: Programming

Luckily this step is practically already done for you all since I have created the code with the help of other programmers. If you do not have Arduino installed on your PC, then install it and open up a new project (delete extra stuff in the programming area. and then copy and pace the entire thing, starting at #include

  • If you want to change the number of lights lighting up alter the number in the line below:

// How many NeoPixels are attached to the Arduino? #define LED_COUNT 150

  • If you want to change the colors then alter the numbers where you see:

strip.setPixelColor(i, 128, 128, 128) (All same numbers=white)

The leftmost number is Red light, the middle is green light, and the rightmost is for blue light.

Here is the code:

[code]
#include "MPU9250.h"

MPU9250 IMU(Wire, 0x68); int status;

#include

#define LED_PIN 6

// How many NeoPixels are attached to the Arduino? #define LED_COUNT 150

// As usual, we'll create constants to name the pins we're using. // This will make it easier to follow the code below.

const int sensorPin = A0;

// We'll also set up some global variables for the light level:

int lightLevel, high = 0, low = 1023;

boolean lightUp = false;

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_RGB + NEO_KHZ800);

void setup() { // We'll set up the LED pin to be an output. // (We don't need to do anything special to use the analog input.)

strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) strip.show(); // Turn OFF all pixels ASAP strip.setBrightness(50);

Serial.begin(9600);

// start communication with IMU status = IMU.begin(); if (status < 0) { Serial.println("IMU initialization unsuccessful"); Serial.println("Check IMU wiring or try cycling power"); Serial.print("Status: "); Serial.println(status); while (1) {} } }

void loop() { IMU.readSensor(); // display the data //Serial.print(IMU.getAccelY_mss(),6); // Serial.print("\t"); // Serial.print(IMU.getAccelX_mss(),6); //Serial.println("\t"); float tilt = IMU.getAccelY_mss();

lightLevel = analogRead(sensorPin); Serial.println(lightLevel);

//autoTune(); // have the Arduino do the work for us!

if (lightLevel < 250) { lightUp = true; } else if (lightLevel > 250) { lightUp = false; }

if (lightUp) {

//Serial.println(tilt); if (tilt > 2) { Serial.println( "left"); left(); } else if (tilt < -2) { Serial.println( "right"); right(); } else { Serial.println("straight"); straight(); }

} if (!lightUp) { for (int i = 0; i < 150; i++) { strip.setPixelColor(i, 0, 0, 0); strip.show(); //delay(50); } } }

void autoTune() { if (lightLevel < low) { low = lightLevel; }

if (lightLevel > high) { high = lightLevel; }

//lightLevel = map(lightLevel, low + 30, high - 30, 0, 255); //lightLevel = constrain(lightLevel, 0, 255); }

void straight () {

for (int i = 0; i < 150; i++) { strip.setPixelColor(i, 128, 128, 128); strip.show();

} }

void left () {

for (int i = 20; i < 37; i++) { strip.setPixelColor(i, 0, 0, 255); strip.show(); } for (int i = 59; i < 76; i++) { strip.setPixelColor(i, 0, 0, 255); strip.show(); } for (int i = 100; i < 115; i++) { strip.setPixelColor(i, 0, 0, 255); strip.show(); } for (int i = 139; i < 154; i++) { strip.setPixelColor(i, 0, 0, 255); strip.show(); } } void right () { for (int i = 0; i < 18; i++) { strip.setPixelColor(i, 0, 0, 255); strip.show(); } for (int i = 39; i < 57; i++) { strip.setPixelColor(i, 0, 0, 255); strip.show(); } for (int i = 78; i < 96; i++) { strip.setPixelColor(i, 0, 0, 255); strip.show(); } for (int i = 117; i < 135; i++) { strip.setPixelColor(i, 0, 0, 255); strip.show(); } } [/code]

  • After you have copied and pasted the code in Arduino, use a USB to A cable to attach the Arduino to the computer and hover over the tools tab and then over the port subheading. Click on the bolded port that the Arduino is attached to the computer. Under the same tab, look at the board and make sure it says Arduino/Genuino UNO.
  • Now click on Upload to program the Arduino.
  • After it uploads, the NeoPixel lights should light up if the photoresistor is touched and the basket is moved. If not unplug the Arduino and then double-check the wiring. If the program fails to upload make sure you have copied and pasted the entire code onto the Arduino program.
  • After the program works to your satisfaction, unplug the USB cable and plug that in the portable phone charger.

Step 6: Painting and Attaching

We are almost done!

  • Next, you want to paint the support beams the same color as your basket with spray paint and let it dry
  • Hook the support onto the bike, then assemble the basket and the support, make sure that the holes are aligned
  • Once the basket and the support are aligned, thread 2 zip ties through the 2 pairs of holes and cut off any excess zip tie.
  • Once the bike is secure, use gorilla tape to adhere to the power bank, breadboard, and arduino to the bottom of the basket. Test out the tilting of the bike to make sure that the turn signal turns on when you tilt the bike; you may have to try different spots on the bottom of the bike.

Step 7: False Bottoms and Painting

The very last step is not the most important but it will protect the electronics and wires from stuff you put in the basket.

  • First, measure the bottom and use cardboard or wood as a base. Add notches to let wires through.
  • Next measure how high off the wires go from the breadboard, and use wood or styrofoam to support the false bottom from the real bottom. I used cardboard and 1.5-inch styrofoam hot-glued together to keep the basket lightweight.
  • Paint the false bottom. Do not use spray paint on styrofoam as it will melt it.
  • Enjoy your cool new basket!