How To Build a Flashlight With Perfect Modes (picture heavy)

863 posts / 0 new
Last post
brted
brted's picture
Offline
Last seen: 3 days 11 hours ago
Joined: 01/12/2010 - 19:44
Posts: 2371
Location: Atlanta

Welcome to BLF, Benik3! From those pictures I can't tell for sure whether it is an Atmel chip or not. My guess is that it is not. But I have never gotten that driver.

Benik3
Benik3's picture
Offline
Last seen: 9 months 1 week ago
Joined: 04/13/2011 - 14:30
Posts: 47
Location: CZ

Can you please someone chang the BLF-VLD program for me?

I would 4 mods - 4% 36% 68% 100%

            in hex - 11  92   174   255

No low battery warning.

After 2s off reset to 1. mod.

It´s possible?

Thanks Smile

Sorry for my English Sealed

fishinfool
fishinfool's picture
Offline
Last seen: 2 years 4 months ago
Joined: 03/09/2010 - 00:30
Posts: 4342
Location: Hilo, Hawaii

Aloha and welcome to BLF Benik3!

 

Don wrote:

"But as I said long ago, you are more likely to be killed by a dead fish dropped by a seagull in the Sahara Desert than by a lithium ion

cloudforce
Offline
Last seen: 10 years 7 months ago
Joined: 04/17/2011 - 06:25
Posts: 3
Location: Germany

Hello guys,

 

i´m new in this forum and i would like to ask which programmer tido is using or which one is the best bang for the buck. most of the time it would be used for attiny 13 and atmega 8 programming.

 

kind regards

cessnapilot
cessnapilot's picture
Offline
Last seen: 4 years 7 months ago
Joined: 02/28/2011 - 22:15
Posts: 159
Location: USA

check post #266 for cheap programmer and clip.  I bought both of them a couple of days ago and will take pictures and let you guys know how the clip fits when they come. 

cloudforce
Offline
Last seen: 10 years 7 months ago
Joined: 04/17/2011 - 06:25
Posts: 3
Location: Germany

I own exactly the same clip and... well... "You get what you pay for!" seems to be a suitable despcription for it.

cessnapilot
cessnapilot's picture
Offline
Last seen: 4 years 7 months ago
Joined: 02/28/2011 - 22:15
Posts: 159
Location: USA

cloudforce wrote:

I own exactly the same clip and... well... "You get what you pay for!" seems to be a suitable despcription for it.

 

so it doesn't work?

cloudforce
Offline
Last seen: 10 years 7 months ago
Joined: 04/17/2011 - 06:25
Posts: 3
Location: Germany

well, with some bending of the contacts it could work as expected Smile it seems to me, that the build quality could be better Wink

Benik3
Benik3's picture
Offline
Last seen: 9 months 1 week ago
Joined: 04/13/2011 - 14:30
Posts: 47
Location: CZ

Please Smile

Sorry for my English Sealed

fishinfool
fishinfool's picture
Offline
Last seen: 2 years 4 months ago
Joined: 03/09/2010 - 00:30
Posts: 4342
Location: Hilo, Hawaii

   and       to BLF Benik3 and cloudforce!

 

Don wrote:

"But as I said long ago, you are more likely to be killed by a dead fish dropped by a seagull in the Sahara Desert than by a lithium ion

sixty545
Offline
Last seen: 1 month 1 week ago
Joined: 10/25/2010 - 14:15
Posts: 702
Location: Denmark (GMT + 1)

Benik3 wrote:

Can you please someone chang the BLF-VLD program for me?

I would 4 mods - 4% 36% 68% 100%

            in hex - 11  92   174   255

No low battery warning.

After 2s off reset to 1. mod.

It´s possible?

Thanks Smile

Hi Benik3 and welcome to BLF.

What you want to do is both straight forward - and not!
You have to modify the file driver.c in Tido's package BLF-VLD-0.4.zip
The first thing to do is define the 4 modes and insert them in the setup:

line #39:
#define NUM_MODES 4         // how many modes should the flashlight have (1-5)

lines #155-159 (your levels are 0A,5C,AE,FF in hex):
#define MODE_LVL032 0x00, 0x0A, 0x00, 0x00  //      .
#define MODE_LVL064 0x00, 0x5C, 0x00, 0x00  //      .
#define MODE_LVL128 0x00, 0xAE, 0x00, 0x00  //      .
#define MODE_LVL255 0x00, 0xFF, 0x00, 0x00  // highest possible level

line #192-193:
    // initial mode programming, indices to modelines in the following array
    0x05, 0x06, 0x07, 0x08, 0x00, // your levels are at index 5,6,7,8

line #108 (activate nomemory as you don't want to have memory):
#define NOMEMORY

The function should now be:
1. The light will allways start in 4% mode.
2. A short tap on the switch will switch to next mode, but if the light has been in a mode for more than 2 sec it is necessary to start the timing first by tapping once. (This can be avoided by using what is called pin-switch in the program, but this demands the mounting of 3 components on the driver).

The file should now be compiled from the SIMPLE directory (after unfolding BLF-VLD-0.4.zip).


It will be necessary to have AVC compiler installed, look for this elsewhere in the thread. Furthermore you must have the programming equipment which can be hard to get running (bad connections) and of course a driver with Atmel ATtiny13.

I can have overlooked something so I can give no guarantee that this will work, but good luck.

kingkong
Offline
Last seen: 1 week 1 day ago
Joined: 04/07/2011 - 15:06
Posts: 50
Location: Houston, TX

Tido's,

 

Can you draw the diagram for the simple circuit in post  #21 with a resister, LED, switch, Atiny13 to test teh modes?

 

I'm still waiting for my board to come in from Kaidomain.  I have some  Atiny13 chip to test with the program...

 

 

kong.

Benik3
Benik3's picture
Offline
Last seen: 9 months 1 week ago
Joined: 04/13/2011 - 14:30
Posts: 47
Location: CZ

Thank you very much Sixty545 Smile

EDIT: After flashing the driver I must disconnect a star?

Sorry for my English Sealed

sixty545
Offline
Last seen: 1 month 1 week ago
Joined: 10/25/2010 - 14:15
Posts: 702
Location: Denmark (GMT + 1)

Benik3 wrote:

Thank you very much Sixty545 Smile

 

You're welcome, Benik3!

Benik3 wrote:

EDIT: After flashing the driver I must disconnect a star?

 

After flashing a driver with stars on it, the old program is erased and the stars have no function anymore.

(Myself, I use the star connected to the MCU pin2 to mount the 3 components for pin-switching mentioned in my former post).

 

texaspyro
Offline
Last seen: 2 years 5 months ago
Joined: 04/29/2011 - 12:43
Posts: 4593

sixty545 wrote:


This is a follow up on post #249.
I finally managed to squeeze the code for my dream light in. The space for code is 1024 bytes and I needed 1070. 

 

A very easy solution is to replace the Tiny13 with a Tiny 85...  it has 8K of code you can bloat in.  Life's too short to waste time squuezing bytes these days.   It does take some tiny soldering skills to do,  but is easily manageable.

Generally, the Tiny85 PWM and peripherals are compatible with the Tiny13.   One difference is the Tiny85 internal RC oscillator runs at 8 MHz (vs 9.6 MHz for the Tiny13).  Should not be a problem.

I converted my driver for the 5000/9000 lumen Bridgelux arrays (yep,  my flashlight is brighter than yours Cool) from a Tiny13A to a Tiny85 and all I had to do was recompile the code with the Tiny85 processor type flag.  There are a lot of enhancements in the Tiny85 that you can take advantage of if you want.

HID45
HID45's picture
Offline
Last seen: 7 years 8 months ago
Joined: 04/13/2011 - 03:45
Posts: 291
Location: Finland

Hmmm... Question. (tried to search, no luck)

I got couple of 101-AK:s from SB to take my shot in the flashlight programming. Still waiting for the SOIC8 clip. The right two legs of my drivers are bridged, just like explained in flashlight-wiki (to set to 3 modes from 5 modes). Do I need to un-bridge (separate) the legs before attempting to flash?

καὶ τὸ φῶς ἐν τῇ σκοτίᾳ φαίνει καὶ ἡ σκοτία αὐτὸ οὐ κατέλαβεν

texaspyro
Offline
Last seen: 2 years 5 months ago
Joined: 04/29/2011 - 12:43
Posts: 4593

If you mean pins 3 (PB4) and 4 (GROUND) then you should be OK.  Pins 2 (PB3) and 3 (PB4) are not used during programming.  All the other pins are used when programming.

HID45
HID45's picture
Offline
Last seen: 7 years 8 months ago
Joined: 04/13/2011 - 03:45
Posts: 291
Location: Finland

3 and 4 they are. Thanks for the info

καὶ τὸ φῶς ἐν τῇ σκοτίᾳ φαίνει καὶ ἡ σκοτία αὐτὸ οὐ κατέλαβεν

Piers
Offline
Last seen: 2 years 7 months ago
Joined: 01/18/2011 - 20:31
Posts: 896
Location: Bolton, UK

texaspyro wrote:
I converted my driver for the 5000/9000 lumen Bridgelux arrays

 

Pictures...pictures...We need Pictures!! Smile

brted
brted's picture
Offline
Last seen: 3 days 11 hours ago
Joined: 01/12/2010 - 19:44
Posts: 2371
Location: Atlanta

texaspyro wrote:
If you mean pins 3 (PB4) and 4 (GROUND) then you should be OK.  Pins 2 (PB3) and 3 (PB4) are not used during programming.  All the other pins are used when programming.

 

I got mine to work! I did too much research and thought only 4 pins needed to be connected, but once I added GND I was all set. I was able to download the 4 setting files from an AK-47. I haven't tried to upload anything yet. Are the fuse settings ever changed? Couldn't we leave those alone?

texaspyro
Offline
Last seen: 2 years 5 months ago
Joined: 04/29/2011 - 12:43
Posts: 4593

Ok,

The array mounted on a CPU heatsink.  This the the C4500 array.  Made in USA.  Has real, legitimate spec sheet.  Outputs over 5000 lumens at nominal drive (60 watts).  Can be pushed to over 1.5 times that.  At 60 watts in (26V, 2.3A) it puts out more light than any 100 watt Chinese array.   They have released a 9000 lumen/80 watt array (pushable to 15,000+) that is the same size.  I have them on order (delivery date has slipped three times now out to June).

Bridgelux LED array on P4 Heatsink

 

Here the array mounted on a cut down heatsink with 50mm fan.  28 degree Ledil reflector.   LED controller.  8S1P A123 battery pack.

 

The LED is mounted on a cut-down AMD CPU heatsink.  It fits in a 3 inch diameter tube that matches the reflector diameter.  That's a 50 mm 24V fan on the back.  The LED controller adjusts the fan speed depending upon the heatsink temperature.  If it gets too hot,  it will shut off the LED.  Fan comes on at 120F,  ramps up to full speed at 152F.  Shuts off at 110F.  At less than 8W or so drive,  the fan does not come on.

 

The controller is a modified LED dimmer from DALEWHEAT.COM   I rewrote the firmware (Atmel ATtiny13A) and changed the voltage regulator so that it draws less than 20 microamps when the LED is off.  It is analog dimmable with a pot from 0 to full power in 255 steps.  You can also use a pushbutton to step between light levels.  Added a second PWM channel to control the fan.  There is no power switch.  Just turn the knob down and it goes to sleep.  At 20 microamps it will drain the pack in about 10 years.

 

The 70mm Ledil reflector makes a VERY smooth beam with no hotspot.  28 degree beam width at half intensity.  I have the reflector mounted so that it can be removed for a 110 degree beam.  They also have a medium width reflector.

 

The battery pack is 8 A123 Systems  26650 2300 mAh LiFePO4 cells in series.  It will run the light for an hour at full intensity.  About 2 weeks at minimum.  Those cells are very deceiving.  They can put out 200 amps!   One of those 4 cell sub-packs will start a car 20 times in -20 degree weather!  Does your flashlight have jumper cables?   LiFePO4 chemistry is intrinsically safe.  Won't go into thermal runaway or burst into flames, etc.

 

The LED controller is essentially direct drive.  The LiFePO4 chemistry has a very flat discharge curve.  90% of the discharge is between 3.3V and 3.2V.  No need for a regulator.  The LED controller code does monitor the pack voltage.  Too high or too low and it shuts down.  A little high and it backs off the PWM to protect the LED and produce what appears to be a regulated output.

5000+ lumen flashlight guts

 

Beamshot down 100+ foot driveway (pitch black otherwise).  Hard to get a good exposure since the foreground overdrives the camera.  This thing will light up a 70+ foot wide tall two story house like it's daylight.   Without the reflector it is a 110 degree flood.  With the reflector it is 28 degree.

5000 lumen array beamshot at 100+ feet

 

Is it a budget light?  Yep,  for a portable sun.  LED is now $45.  Reflector 5 bucks.  Heatsink/fan 5 bucks.  LED controller 20 bucks (with mod parts).  Batteries can be had for around 50 bucks.   Free if you can find a "dead" DeWalt 28V pack with a bad cell or two.  Package it to suit your tastes.

Piers
Offline
Last seen: 2 years 7 months ago
Joined: 01/18/2011 - 20:31
Posts: 896
Location: Bolton, UK

Awesome thanks for all the details Smile

Foy
Foy's picture
Offline
Last seen: 6 years 7 months ago
Joined: 01/02/2011 - 17:56
Posts: 3009
Location: Las Vegas

"Does you flashlight have jumper cables?"  Nope.  You got me there.

I am always impressed with endeavours like this.

pushingtheenvelopeFoy

No referral links and nothing embedded . . . ever.

                      &nbsp

sixty545
Offline
Last seen: 1 month 1 week ago
Joined: 10/25/2010 - 14:15
Posts: 702
Location: Denmark (GMT + 1)

texaspyro wrote:

 

A very easy solution is to replace the Tiny13 with a Tiny 85...  it has 8K of code you can bloat in.  Life's too short to waste time squuezing bytes these days.   It does take some tiny soldering skills to do,  but is easily manageable.


I converted my driver for the 5000/9000 lumen Bridgelux arrays (yep,  my flashlight is brighter than yours Cool) from a Tiny13A to a Tiny85 and all I had to do was recompile the code with the Tiny85 processor type flag.  There are a lot of enhancements in the Tiny85 that you can take advantage of if you want.

 

              -------------------------------------------------

Tanks for the tip texas, a very tempting switch, but I wish I were at least 20 years younger. Can the job be done with an air blower, pliers and solder paste or are more sophisticated tools needed?

That is one awesome "flashlight" you made out of that Bridgelux, not for any kids to play with.

 

to brted: Congratulations with getting it to work!

I never managed to read stock drivers programs properly, only unusable code came out. I even tried to change fuse settings before reading to "unlock" the code. Only after flashing the driver I can read back my own program.

brted
brted's picture
Offline
Last seen: 3 days 11 hours ago
Joined: 01/12/2010 - 19:44
Posts: 2371
Location: Atlanta

sixty545 wrote:

I never managed to read stock drivers programs properly, only unusable code came out. I even tried to change fuse settings before reading to "unlock" the code. Only after flashing the driver I can read back my own program.

I don't know if I downloaded it correctly or not, but I did get the 4 files anyway.

I went ahead and flashed the programmable UI into a AK-47 that one of my lights uses. The Low is very impressive, about equal to the iTP A3 which is only 2 lumens. But I think the Low Battery is set too high or something because I was having a hard time with programming new modes. I don't think the Low Battery should be included by default since the settings involved are specific to whatever resistors the board is using.

I have no idea how to get started modifying and re-compiling programs. I had WinAVR and Eclipse installed, then decided that was too complicated, so I tried out AVR Studio 5 which people seem to like, but I don't even know what to do with it. There is only one driver.c program, but it seems to generate Simple, Extended, and Programmable?

I'd like to set up a 2-mode light with one of the modes being High and the other being one of several different lows: an indoor low of 1 or 2 lumens, an outdoor low of about 10 lumens, and a medium of maybe 50% in order to extend battery life. So what I'd like to get is set up some way of easily switching the Low mode only by tweaking and simplifying the programmable interface. With only 2 modes, I don't know that I would need memory, it could just always start in Low. Then I could single-click for Low or double-click for High. Or vice-versa, I kind of like the idea of the light not coming on immediately until you've had time to double-click, in which case a double-click for Low might work and you wouldn't be blinded by High flashing on first.

But right now I'd just settle for being able to turn off the Low Battery and recompiling the code.

. . . Think I'm getting a little closer. There was a "for" loop that AVR Studio didn't support (said to use c99, but I don't think that is supported), so I declared the variable before the loop and it seems to have compiled without any errors. I'm not sure what actually compiled though.

. . . 1 step forward, 2 steps back. Now one of the pins in the teeth of my clip has slid back, so the clip isn't making contact with the chip anymore. These clips are the worst pieces of crap I've ever had the displeasure of working with. Another $12 down the drain. I'll try to repair it when I'm less likely to throw it at a wall.

texaspyro
Offline
Last seen: 2 years 5 months ago
Joined: 04/29/2011 - 12:43
Posts: 4593

sixty545 wrote:

Can the job be done with an air blower, pliers and solder paste or are more sophisticated tools needed?

 

You can probably do it with just some small lead cutters,  a fine point soldering iron,  and fine point tweezers (and geezer goggles).   Easy way to remove the chip is to cut the leads to the chip.  Then use the soldering iron and some tweezers to pick off the lead nubs.  Easy on the heat...  most cheap boards have poor adhesive holding the pads down.  Refresh the chip pads with a small blob of solder.  Put the new chip down and reflow a corner pin.  Tweak the chip position and reflow the opposite corner pin.  Then do the other pins.  It helps to push  the pin down into the solder with the tweezers as you heat it.

Other useful things to have are liquid solder flux and/or solder wick.   The liquid flux helps prevent solder bridges.  The solder wick helps remove them.   I solder surface mount chips by flooding the pads/leads with solder.  Everything gets blobbed together.  Then I use a fairly wide tip and the solder wick to wipe down the length of the leads (from the package towards to tip of the leads).  This removes the solder bridges and leave enough solder to mount the leads.

kingkong
Offline
Last seen: 1 week 1 day ago
Joined: 04/07/2011 - 15:06
Posts: 50
Location: Houston, TX

texaspyro,

 

Where do you get the LED and the lens?

texaspyro
Offline
Last seen: 2 years 5 months ago
Joined: 04/29/2011 - 12:43
Posts: 4593

kingkong wrote:

Where do you get the LED and the lens?

 

DigiKey and Newark both have them.   The C4500 array runs around $45 and the reflectors around $5.   Bridgelux has recently updated the line with some new units (and some of the older ones no longer show up in their datasheets).  They now have an 8800 lumen array...  delivery date keeps slipping out on it.  Bridgelux parts are made in the USA.  They have proper data sheets and verified specifications (no Chinese bogo-specs and pseudo-lumens).  I get more light out of a 60 watt Bridgelux array than any Chinese 100 watt array.   

The older arrays have a volatge rating that is almost perfectly matched for unregulated direct drive with LiFePO4 cells.   The newer ones are a bit  problematic there.  That 8800 lumen array wants to be driven by a 9.5 cell pack.  A 10 cell pack might cause it to draw too much current.  I might need to add some diodes in series with it to tweak the drive level...  wastes a bit of power.

kingkong
Offline
Last seen: 1 week 1 day ago
Joined: 04/07/2011 - 15:06
Posts: 50
Location: Houston, TX
11976-1011-NDLED ARRAY COOL WHITE 5000LM 046.02000$46.02
21711-1077-NDREFLECTOR FOR BRIDGELUX BXRA 05.19000$5.19
31711-1078-NDREFLECTOR FOR BRIDGELUX BXRA 05.19000

$5.19you

 

The driver from here should work corret http://www.dalewheat.com/news/12v-dimmer-kit-v2-now-available/?

Thanks for your help.

texaspyro
Offline
Last seen: 2 years 5 months ago
Joined: 04/29/2011 - 12:43
Posts: 4593

Yes,  that is the dimmer that I started with.  I modified it quite a bit.  I replaced the voltage regulator with an LM2936 ultra low standby power device that also can work at a higher input voltage,  I changed the FET to a higher voltage one,  I added a second FET for controlling the fan,   I added an LM34  temperature sensor,  I added a voltage divider to measure the battery voltage,   I rewrote  the firmware.

It really is a neat little dimmer board.  You can't beat the price.  Buy a bunch...  Dale is a great guy and can always use the business (even if he hates to kit up parts).  I have modified them to do all sorts of things.   I even have one driving a 2000+ watt heater in a composite curing oven with millidegree level temperature control.  

Pages