Plain white light isn’t quite awesome enough, so I needed to add red, green, and blue. I wasn’t willing to give up one of my XM-Ls for a color multi-die emitter, so I milled spots for the extra emitters in the gaps around the edge of the reflector piece, and drilled wire conduits down to the back of the reflector. There wasn’t enough room to put any kind of optic in there. I had to cut out some tiny circular star boards from full-sized ones.
There was enough room inside the driver cavity to add my own board above the stock driver. I used one of my simple flashlight boards that has an 8-pin micro (PIC12F615), 4 FETs, and 4 current-limiting resistors. For this light I only use three of the FETs and route PWM from one of my micro pins down to the driver board to run the white LEDs.
The color LEDs are a royal blue XT-E and red and green XP-Es. There was a ton of wiring coming out of the back of the reflector but I managed to fit it. I wrapped my added board with electrical tape to prevent shorts. I had all kinds of problems with shorts on the XM-Ls that I fixed with a bunch of carefully cut kapton tape on the underside of the reflector.
The finished product came out great. The code is a modification of my flashlight driver code that I use with color MC-Es, so some of the modes are hilarious with the white so much brighter than the colors. Mode selection is done with a half-press on the switch, and it times out after about 4 seconds and reverts to the first mode. Here are the modes:
High white – the 3 XM-Ls run at 1.5A
Low white – 3 XM-Ls at 10% duty
Low red – the red at 25% duty
RGB stunner – my imitation of the DHS Dazzler. Strobes R, G, B, and combinations at randomized time intervals
Color shift – gradually fades through colors made from combinations of R, G, and B
Color freeze – pauses on a color selected in color shift mode
Firelight – mixes white, red, and green to create light that flickers and imitates fire light
Red –
Green –
Blue –
Police – alternating strobing white and blue
Red beacon – briefly blinks red about twice a second
All on –
Here’s the code. A side note on software: This uses a neat trick I developed for flashlight drivers—instead of the normal means of detecting power loss to cycle modes (with a diode and a big cap), I use RAM retention. When each mode is entered, a RAM location is written with a value that will send the light to the next mode. When power is lost, the micro stops running when its cap drains below 1.8V. RAM is retained until 1.0V, and the power draw is miniscule once the oscillator stops, so this RAM location stays valid for quite a while. When the micro boots up as power is restored, it checks the RAM location for the direction to go to the next mode. If power is left off for a while, the RAM location gets wiped and the micro starts back at mode 0.