Project Lux – bike RGB

To make my bike much more conspicuous at night, I’ve created my own custom RGB lighting system for it. This operates in addition to a separate shop-bought front light.

There are three strips of addressable RGB LEDs on each side (on the front fork, top tube and seat stay), plus an additional strip on the rear “big reflector panel” (which only displays red, or sometimes also some flashing-amber for turn signals). There are two “dumb” white LEDs on the custom front reflector, which are not under software control – they just turn on when the main power switch is on, to provide a little extra front-visibility.


The big box mounted to the seat post (under the saddle) contains the batteries (2 x NiMH D-cells), power converter circuit (Adafruit Powerboost, which turns the battery voltage in to 5v for the Arduino, LED strips and plain white front LEDs) and the microcontroller (Arduino Nano clone, running my custom software). A key-switch on the side of the box is the master power switch for the whole lighting system.

The smaller box on the top of the top-tube (up front, near the handlebars) is where all of the other controls are mounted. There’s an on-off-on toggle switch for turn-signalling, a couple of LEDs for status feedback, plus two momentary push buttons for changing main animation mode (on the side panels), rear animation mode (for the strip on the rear reflector) and system brightness.

The addressable RGB LED strips are cut down from a 1m length of Neopixel-compatible strip from Cool Components (also not-sponsored, not an affiliate link). The FastLED library was used to drive the strip.


The animation modes for the sides of the bike make smooth changes or chases only and particular care has been taken to avoid anything which may look like a “blue flashing light” (of an emergency service vehicle).

The LED strip on the rear reflector panel normally only animates in Red – either “chasing” from side to side or a flash-and-fade effect.

A toggle switch on the control box allows me to use illuminating turn signals as an addition to making standard hand signals. When activated, the normal side-facing animations are disabled and all of the LEDs on the chosen side of the bike flash amber, along with the LEDs on that side of the rear-facing strip (the non-turning-side LEDs are off).

A Video

This video is more of a show-off and is not really a technical show-and-tell. Maybe I’ll make one of those videos in the future.

Where’s the build instructions?

Sorry, there aren’t any. I might put the Arduino source code up on Github, and/or share the CAD models for the 3d-printed parts (main-box, control box, front reflector+light, rear reflector+strip) on Thingiverse, but I wasn’t taking the relevant notes or photos during construction to enable me to do a full “here’s how you make this for your own bike” guide.

These bullet-points on relevant knowledge and details specific to what I’ve done might assist anyone who wanted to do something similar (if none of this makes any sense, you will need to do some background learning about electronics and programming – if it’s all blindingly obvious to you then you don’t need my help!):

  • I’m using Ni-MH rechargeable batteries and an Adafruit Power Boost, but that might not be a great way to go (have to remove them for external charging, they’re bulky). No reason you couldn’t use a USB power bank, or go with an integrated Li-ion cell
  • Apart from a ribbon-cable to the controls box (small thing up near the handlebars which has the mode-buttons and turn signal toggle), all the wires going in to the main electronics box (power and data for all seven LED strips) terminate at screw terminals inside that box, and that could be better somehow I am sure
  • The LED strips are Neopixel-compatible, but I’m using the FastLED library – I am indebted to this free ebook code example for the actual pattern-animations code (it’s a whole Creative-Commons-licensed book including stuff about 3d printing and Arduino)
  • FastEddy516’s ButtonEvents library is used for the Mode buttons, which made it VERY easy to get three functions out of each button (tap = change main pattern, double-tab = change Brightness, hold = change Rear Strip pattern – so I can go “up and down” on three different things with just two buttons)
  • I am using a unique Arduino output pin for the data for each strip of LEDs. This means there is no daisy-chaining of data from one strip to the next, but it does mean more wires going in to the main box
  • The Arduino code only thinks about THREE arrays of LEDs, however (left, right and rear) – this means the patterns for the side strips can flow across all three strips on each side. If you’re trying to do the same thing (LEDs on different Arduino pins being logically “together” in your code), then this example and this other example are your friends
  • I’m using one spare analogue-input pin to measure the battery voltage (on the positive rail, after the keyswitch, but before the Powerboost module), which gives me a very approximate approximation of state-of-charge of the batteries (there are absolutely Better Ways To Do This, but this one cost me one jumper wire and some code). As it’s Not Good to drain NiMH cells below a certain point, I have a hard “refuse-to-run” cut-off, and also automatic reduction in brightness level (hence reducing current draw) at a slightly-low threshold
  • Arduino Nano has bugger-all volatile RAM (2KB!) so always put your string-literals that you’re using for debugging and prototyping in to PROGMEM (which stops the strings being copied to RAM, they just stay in the EEPROM program storage) or you will be confused about where your free memory has vanished to
  • Don’t settle for crap solder. Your time and sanity are worth far more than that. If you look on Amazon for “60/40 solder”, it seems like you can still find juicy Pb-based stuff there.