When I was a kid there were no iPhones, internet, home computers, or Arduinos. Sure, we had TV and radio, but — believe it or not — we had fun with flashlights too. They often came with colored lenses, or we made our own with paper or plastic. Over the years flashlights seemed to lose their fun. These days they’re mostly for practical purposes and they usually only make white light. Even high-end flashlights are pretty much the same thing, just super bright and rugged for inspecting the levee during the hurricane. Bright and rugged is great, but a one-button, small, efficient, vanilla light isn’t much fun, is it? Lets bring the fun back to flashlights …

The HSL Flashlight

In this project we hack an old 6-volt lantern to become our Million Color HSL Flashlight. It’s big and bulky and different. Not quite as bright as some, but it has crazy color that’s so easy to set — just dial your way around the rainbow. Lots of knobs and modes, and you can write code for it too. Build it, turn it on, and experience its endless fun. Heck, if you take some time to make it watertight, you can inspect the levee with it too.

The great thing about HSL is that it’s an intuitive way to select a color. HSL stands for Hue, Saturation, and Lightness. This is like the 360-degree color pickers available in many computer applications. Our flashlight has a knob for each of these HSL components. Hue selects the color by allowing you to dial your way around the rainbow. Saturation selects how deep and rich the colors are: fully desaturated is white, fully saturated is pure color, anywhere in between is just that. Lightness behaves like a dimmer.

Our flashlight also has a 10-position mode switch. This is where the most fun comes in. You can select between 10 modes; check out the video for a demonstration:

  1. White
  2. Manual HSL
  3. Auto Hue: The light rotates automatically through the color spectrum (hue knob controls speed)
  4. Multi-color all-pixel auto-rotate
  5. Multi-color tri-pixel auto-rotate
  6. Cylon (aka Larson Scanner)
  7. Full-color strobe
  8. Alternate pixel multi-color 180-degree color alternation
  9. Half moon multi-color 180-degree color alternation
  10. Alternate pixel pair multi-color 180-degree color alternation




Arduino: It’s a great platform for prototyping your projects. Once I’m ready to build, though, the standard Arduino board is kind of big, its jumper wires provide only fragile connections, and I want to free it up for my next project. Designing a custom board is time-consuming and expensive. The solution for many projects is to use one of the small Arduino boards available. I used the Arduino Pro Mini and it was perfect for this project. It’s inexpensive, very small, and reliable.

NeoPixel NeoPixel: In my search for bright RGB LEDs, I came across the Adafruit NeoPixel family. Two things make them perfect for this project. First, they’re available in different sizes and shapes, including the 12-element ring used in this project; it fits perfectly in the reflector bowl in most old-school 6V lanterns. Second, NeoPixels come with an Arduino library that’s easy to integrate and use for a project like this.

hslflashh6V Lantern: The old-school 6-volt lanterns provide a perfect platform for this project because the reflector bowl and the battery compartment are both huge. Cool old lanterns are fairly easy to find and inexpensive at flea markets or eBay, but you can also buy new ones.


Project Steps

Prepare your work area

Gather your materials and tools into a clean work area.

Install the headers on the Arduino Pro Mini

I used a right angle header so the Arduino will fit easily into a Tic Tac mints box.

First tack only a single pin of the header. Then check to make sure the header remained flush. If it didn’t, gently push on the header while reheating the single, tacked pin with your soldering iron (be careful not to burn yourself).

Once it’s tacked, put it in a vise and solder the other pins. After the other pins are soldered, rework the tacked pin and add solder if necessary.

Program the Arduino Pro Mini

Download the project code, an Arduino sketch called HSLFlashlight.ino. Attach the Arduino Pro Mini to your computer using your FTDI cable or other compatible device. Open the Arduino IDE software and select the correct board from the Tools–>Boards menu. Then open the sketch and verify/compile/upload it to the Arduino.

This tiny board has an LED attached to pin 13. The HSL program will flash it 5 times when it starts, then turn it off. This is a good way to verify that the program has been properly uploaded. (Note that the upload process itself will flash this LED a couple of times before our 5 flashes.)

Once programmed, disconnect the Arduino from your computer and from the cable and set it aside for now.

Solder 10-position switch to breakout board

This step is optional but it does make attaching and managing the wires easier. Just like you did with the header, tack one pin first, then make sure it is flush, and adjust if necessary. Then solder all the connections.

Wire the 10-position rotary switch

Cut eleven 8″ lengths of 22-gauge wire. If possible, use different colors to keep track of which wire goes to which pin position. If you don’t have that many colors of wire, use a light color and mark the wires to indicate the pin number. Strip about 1/8″ of wire from each end.

I always use black for common/ground and use red for the raw power. Here I attached black to the common pin, then used a different color for the first few positions. After that I used all gray, then marked the other end of the gray wires with a Sharpie (4 dots for position 4, 5 for position 5, etc.). Except for common, it doesn’t really matter if you lose track of which is which. It will simply be an adventure when you switch through the modes on the flashlight.

Tame the mess of wires with some heat-shrink tubing. I covered about 60% of the wires.

If you omit the breakout board, attach the wires directly to the 10-position pot.

Prepare the 3 potentiometers

Cut three 8″ lengths of wire for ground (black), 3 more for Vcc (I used orange), and 3 for analog input (I used blue). Attach one set of wires to each potentiometer as shown.

First make a mechanical connection by wrapping the wire around the post, then solder it.

TIP: Use a dental pick or similar tool, to wrap the wires around the posts.

Mark the potentiometers as 1, 2, and 3 with a Sharpie. Also mark the other end of each of the analog input wires with 1, 2, or 3 dots to indicate which pot it’s connected to. Later you’ll use those marks to determine which pin to solder to the Arduino.

Prepare the NeoPixel ring

The NeoPixel ring requires 3 connections: Power, Ground, and Signal In. Cut about 12″ each of black, red, and white wire and solder these to the NeoPixel ring as shown. You need to insert the wire from the top and run it through the middle of the ring because you’ll be hot-gluing the ring to the reflector bowl of the flashlight.

CAUTION: Some flashlights (especially old ones) use metal bowls, so it’s important to insulate these connections from potentially shorting out in the bowl (I speak from experience). I simply covered the connections with small blobs of hot glue to guard against this.

Once you’ve soldered the wires to the NeoPixel, hot-glue it to the bowl of your light and route the wires through the old bulb hole.

Solder the 300Ω resistor to the other end of your signal wire (I used white). Insulate it with some small heat-shrink tubing. Leave about 1/8″ exposed to connect it to the Arduino (Digital input 12).

IMPORTANT: Before connecting a NeoPixel strip to any source of power, it is strongly recommend you add a large capacitor (1,000µF, 6.3V or higher) across the + and – terminals. This prevents the initial onrush of current from damaging the pixels.

Prepare the Arduino: power and Vcc

Solder a 12″ red wire to the raw power input pin.

Solder a 12″ black wire to the ground pin next to the raw input pin.

Solder a 12″ orange wire to the Vcc pin.

Prepare the Arduino: analog inputs

Solder the 3 blue wires from the potentiometers to Analog 1, Analog 2, and Analog 3. Use the dots on the blue wires to match them up properly. A1 is for hue, A2 is for lightness, and A3 is for saturation.

IMPORTANT: The HSL code uses Analog 1, 2, and 3 but not 0, so be sure to connect to the correct 3 pins on the Arduino. If you get the blue wires mixed up, it’s OK. Just be sure there’s a blue wire attached to analog pins 1, 2, and 3.

Prepare the Arduino: digital inputs

Solder the 10 signal wires from the switch to the Arduino. Use digital inputs 2 through 11. I matching position 2 on the switch to Arduino digital 2, position 3 to digital 3, etc. I matched position 1 to digital 11.

Solder the 300Ω resistor at the end of NeoPixel signal wire to digital input 12 on the Arduino.

Manage power, ground, and Vcc wires

Find your battery pack and include it in the mix. Tie all three raw power wires (red) together as shown, then solder and finish with heat-shrink.

IMPORTANT: Red is for raw power. You should only have 3 red wires — one from the Arduino, one from the NeoPixel, and one from the battery pack/connector.

Tie the Vcc wires together (mine were orange) just like you did the raw power wires.

Tie the ground wires together (black) in a similar fashion.

Integrate the flashlight's on/off switch

This will take a little bit of investigation on your part. Find the wires that go to each side of the switch in your flashlight. Cut those wires, and strip about 1/2″ from the ends. If necessary, test the switch with your DVM in resistance mode.

IMPORTANT: Leave the switch in the OFF position for now.

Find the red wire that attaches to your battery pack and cut it, with enough room on each end to strip about 1/2″ of insulation.

Now tie this red wire into the flashlight switch by soldering one end of this red wire to one side of the switch and the other end to the other side of the switch. Patch in more red wire as necessary to give you some flexibility.

You have put the flashlight’s switch in the middle of the power wire that feeds the entire system.

Mount the Arduino in the Tic Tac box

Go to your kitchen, wash your hands, and clean the Tic Tacs out of their box. You may eat a few while you’re at it.

Bring the empty box to your bench, remove the white plastic dispenser and cut it down a bit to accommodate the bundle of wires, then insert the Arduino into the box and seal it with strong tape because it will try to come apart when you tuck it into the lantern.

The purpose of this box is to insulate the Arduino from any metal that it might come in contact with inside the flashlight.

Verify functionality

No doubt you’re anxious to see if this thing is going to work. Now is a good time to check. First, center all 3 pots. You want to be sure the lightness is not all the way down — centering all of them is a good way to be sure.

Load the 4 fully charged NiMH batteries into your battery pack. If your battery pack has a switch, make sure it is in the on position.

Power up the electronics by turning on the flashlight switch. Watch for the 5 flashes on the onboard LED. Shortly after that you should see some activity from the NeoPixel ring — it should do something no matter where the mode switch is set.

If you see no activity on the Arduino, then there’s probably a short somewhere — turn off the power right away and find the short. In my case it was the NeoPixel ring shorting against the metal bowl of my flashlight.

Prepare the flashlight case

The flashlight needs 3 holes for the pots and one for the rotary switch. I put the HSL controls on one side and the rotary switch on the other. Check the size of the hole by first drilling some scrap. Make sure your pots and switch fit properly.

If you use a metal case, first use a center punch to keep your drill from wandering (if using a plastic case, you can do the same thing with your soldering iron tip).

Mount the pots and switches into the case.

Final assembly

Now all you need to do is get it all into the flashlight. If you have a unit that was built to hold a 6V lantern battery you should have plenty of room. You might find that all your heat-shrink is making the wires hard to bend. Just go slowly and it will all work (believe me, it’s better than a rat’s nest of wires).

Congratulations, you’ve built a Million Color HSL Flashlight that will keep you (and maybe even your kids) entertained for years.

Share it!

Here’s my final build using the retro lantern, plus a new build using a brand-new yellow lantern, by the Maker Media Lab.

Show us your build and share your code hacks in the comments below!