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

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

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.

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?

well, with some bending of the contacts it could work as expected :) it seems to me, that the build quality could be better ;-)

Please :)

and to BLF Benik3 and cloudforce!

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.

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.

Thank you very much Sixty545

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

[quote=Benik3]

Thank you very much Sixty545

[/quote]

You're welcome, Benik3!

[quote=Benik3]

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).

[/quote]

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 ) 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.

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?

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.

3 and 4 they are. Thanks for the info

Pictures...pictures...We need Pictures!! :)

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?

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).

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.

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.

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.

Awesome thanks for all the details :)

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

I am always impressed with endeavours like this.

pushingtheenvelopeFoy