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

Aloha and welcome to BLF kingkong!

Post #54 can be a big help!

Hi everybody.

On our czech forum forum.fotonmag.cz we would reprogram this driver: http://www.kaidomain.com/ProductDetails.aspx?ProductId=9906

But, we don´t know if it´s possible and also we don´t have this driver at home, because we don´t know it :(

And the second thing is, that we don´t know, how to make a program But if the ATMEL is some and the connection is some we could use your program.

Do you have someone this driver?

Thanks :)

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.

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

Aloha and welcome to BLF Benik3!

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.