Thursday, April 25, 2013

Convert Cheap 9 LED flashlight to PIC Controlled High Brightness LEDs


Flashlight in the packageA while back I needed a high power light for my mountain bike. I couldn't justify purchasing one, as they were between $100 and $500 at the time, so I decided to make my own.

I was initially going to fabricate the whole thing out of aluminum tube stock and a lathe, but that was going to require a lot of time and borrowed resources (I don't own a lathe :). So I started to look for suitable candidates that were 'close' to my design dimensions.

I ultimately chose a cheap, Chinese, nine LED flashlight that runs on three AAA batteries. Here is one that was purchased for around $1.50 (2 for $3) from Harbor Freight.

Let's open it up, shall we....

Three parts so far...
Removing the battery compartment.
Nothing warranty voiding here...
Trying for four more parts...
Removing the LED board with pliers.
That was easy....
Ah, the smell of aluminum and plastic....
The LED assembly, not much to it.

Time to upgrade!

The Switch

A big green button
I had to open up the hole a wee bit to get the new switch to fit.
Like a glove..
The first thing to go was the power switch. The original switch was turn on, turn off, but I thought a momentary button would be so much cooler and I also convinced myself that a button that cost more than the flashlight would be a longer lasting solution. Little did I know how many tens of thousands of switches and buttons there were at Mouser. I chose a nice bright green silicone one, for moisture reasons.

The Processor

Now I know why they switched to surface mount components....
Microchip PIC12F683 installed
Space is kinda tight in the case, so I decided to solder a PCB straight to the pins of the switch. Since the PIC chip only has 8 pins, I didn't have to create a lot of traces or add any discrete components.

For those not familiar with the Microchip PIC processor family, you are missing out. This particular unit has up to 6 I/O pins (on an 8 pin device!), goodbye my faithful 555. The clock is internal and the reset line can be made an input, but I chose to leave that alone to simplify programming and debugging. Another neat feature is onboard EEPROM that is writable from the running program. I use this to store the current brightness, in case power is lost momentarily. More on that later.

The LED Module

These high brightness LEDs come with a price, they must have a good heatsink. So what better way to sink some heat than to add more aluminum. Technically copper would be better, but aluminum is lighter and I had some laying around.
The motion stopping speed of my Nexus One camera
A friend has a machine shop in his garage :)
None of the scraps of aluminum I had would fit, without some minor machining. Once we had the right size heatsink (approximately 1" of material to be pressed into the case), we prepared the flashlight case by removing the paint, from the inside, with a Dremel tool. The LED mounting face height is a little more dimensionally critical, so it involved some trial and error fitting of the whole assembly. Once we were satisfied with the dimensions, the heatsink was permanently pressed into the case.

The smell of burning paint.....yum.
Removing the paint from the inside of the case.
Getting closer....
Ignore the LED module for now ;)

Stay tuned for more!

Look for the exciting conclusion soon....

1 comment:

  1. Jeez. It's been a long time I actually pulled out a piece of printer paper to take notes on a blog post lol. Thanks for this. You've earned yourself a new reader!