workshoptechnology

Making motion activated bike lights

Using motion activated lights for your bike is a really innovative way of letting passer-by's know your presence, especially at night when riding a bike is not so safe. Riding with motion activated lights will also make you feel like you are in the movie ‘Tron’. 

Materials 

Arduino 101 

Lipo battery 11.1v 

Voltage converter 

Switch 

Perfboard

Zip tie

Step 1

For this project you will need an Arduino 101 board, this board has 14 digital inputs, an USB connector, a power jack, 12C dedicated pins and a sketch upload, it also has Bluetooth low energy. This board is crucial for this project as it will help with changing the brightness and colour based on the motion of the bike. 

You don't have any circuitry that you will need to put together, all you have to do is solder a few wires to some pins, solder the pinks to the end of the wires and insert them into a connector. This connector will then connect to the battery, this is done so that you get power to drive the board and the lights. 

Step 2

Most of the work for this project is in the code and not the circuitry. For the circuitry, you will need a lipo battery, the battery is one with 11.1v, the battery has to be connected to the breadboard with a switch so that it is easy to control, the breadboard handles the power, the power gets separated and goes to two different places. The first place is to the voltage converter, this converter reduces the 12v to 5v which is what the LED needs. Next is the Arduino 101, the board can handle volts ranging from 7 to 12 as a voltage input and therefore can withstand the volts directly from the battery. The LEDs are connected to the Arduino 101 too.

Step 3

Making the code (The link for the code is provided.). The light for the bike will have two lighting-states, one is when the bike is stationed it will have a parking light on and when the bike is moving it will have a different coloured light. There will be a small section of light behind the bike seat which will act as a tail light. 

For the code you will need to start out with the example program that gets downloaded when you install the libraries for the board. You will need to start with the example project called ‘motion detect’ this will detect motion, it has everything set up from the threshold to what it thinks is the motion, you can modify that by changing the numbers, it also has some basic setups for the call backs and prints all the information into the serial monitor. The loop just checks if it has been more than one second from the last motion which changes the LED on or off. 

Every time a motion is detected it is called ‘callback’, from this you can figure out which axis the motion is happening and the direction it is going, basically whether it is positive or negative on the X,Y and Z axis, you can start with this code and add some LED code over it. You can then take the ‘Adafruit Neopixel’ library and set up some basic information about which pin it was connected to, how many LEDs you have and how many lights to have as the brake light at the back. You have to change the ‘Time out’, instead of one second you can change it to 3 seconds or more if you want. 

At the end you will have to turn on the LEDs and then run the blink start-up, this will turn the light on for some time to let you know that it is ready. You have to make some changes on the loop option. 

Step 4

To test it up you will have to turn the switch on to see if the LEDs turn on. Move the Arduino 101 to change the light colour. To attach the wires to the bike more permanently you will need to remove all the wires from the breadboard and attach it to a perfboard. cut a small piece of perfboard, solder the wires to the perfboard. You can hot glue the pins to the Arduino. 

You then have to measure the size of the electronics and then make a box for it. You can use the website 'Makercase' to get a template, however, you can make or use any box that the electronics will fit in. You will need to cut holes into the box for the wires to pass through and the switch. 

Step 5

Next you have to mount the LEDs onto the bike. The way you want your LEDs to be mounted is up to you, if you want some temporarily you can use zip ties to attach them. The length of the LEDs will depend on the type of bike you will be using. While attaching the lights should be facing downward so that it won't be blinding you when you are riding your bike. 

0 Comments
    Leave a Comment
    Subscribe to our Newslatter

    Sign up for free and be the first to get notified about new posts.