A Smart Bike Lighting System Using Arduino

Arduino bike lighting

Arduino bike lighting

How To Make A Smart Arduino Bike Lighting System

This Arduino bike lighting project upgrades your bike’s light and takes it to the next level so that the backlight of the bike automatically notifies others when you are turning.

We used Arduino UNO as our main microcontroller (use Nano or Pro mini to shrink the size if needed), Accelerometer to detect the 3 axis directions and Neopixel to blink the LEDs in the corresponding direction of movement.

Description

  • Blinks toward the direction you are turning in green (e.g. Turning to the left or the right)
  • Turns to red when you are riding forward.

Components used

Hardware components:

  1. Arduino Microcontroller (e.g. UNO or Nano, Pro mini)
  2. Accelerometer (e.g. Sparkfun MMA845Q)
  3. Adafruit Neopixel stick (or you can build one on your own using ws2812b LEDs)
  4. Resistors (e.g 330 ohm)

Software components:

Arduino IDE

Milestones

Read Arduino Basics (Level: Beginner)

1. Define the range of the results out of the accelerometer
This step is where you should find out the X, Y and Z direction of left and right. Take note of the position of the accelerometer while testing, since you have to place the sensor in the same position later on the bike.

You can simply upload the .ino sketch to your Arduino and open your Serial monitor and notice the flow of numbers of the 3 axis (X, Y and Z ). Make sure that the baud rate is set to 9600 so you can see the actual results.

arduino bike lighting

These numbers correspond to X, Y and Z respectively, experiment with the change of numbers when you turn right and left and when you keep your Arduino bike lighting straight forward.

arduino bike lighting

These were my values when I connected a pullup resistor of 330 ohm on pins A4 and A5; you will get different values if you use other resistor values.

2. Create your own Arduino bike lighting pattern with the addressable LEDs
One of the advantage of these pixels “WS2812b“ is that they are addressable which gives you a wide range of getting creative ideas of lighting. I’ll discuss how to build your own pixelstick using ws2812b LEDs in a follow up post.

arduino bike lighting

I have only chosen 2 colors (green and red) for my Arduino bike lighting system, but you can add more colors to your pattern by mixing the value of RGB as shown here.

arduino bike lighting

arduino bike lighting

Get creative with it!!

3. Connect the two codes together

Simply connect the codes together, identifying which pattern to start with for each direction.

Hardware connections

arduino bike lighting

Sketch

arduino bike lighting