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

Nyt huudetaan! (a Finnish shout of joy, often used when we score against Sweden in hockey)

I finally got the driver to work as I want. I don't actually know what I did, but it involved editing Tido's code in AVRStudio and some crazy amount of pin soldering and unsoldering (see my posts above). As I have no idea how that code or programming in general work it took some trial and error but it was worth it. Now my camping light is officially perfect. 4 modes including SOS. No memory so I don't have to worry about blinding myself if it was on high last time I used it. Starts with crazy low, which must be like 0,00something lumens as my 4Sevens Quark in moonlight seems like a car headlight compared to it and the Quark is ANSI rated as 0,2 lumens. Still enough to read map or navigate in dark indoors. Then low, high and SOS. Or, being programmable, If I don't feel like needing the SOS I can change it to 4 constant modes in couple of clicks from tailcap. This is the best thing ever. I'm at loss of words.

That's great news! Congratulations on getting everything working the way you want. I think that's the great promise of Tido's programs and why I haven't given up on the whole concept despite a few setbacks.

I got my brown clip in from eBay. I had a hard time getting a connection with the chip on the driver, I'm not sure why. It seems better made than the blue ones, but not as easy to line up with the leads from the chip. I was able to flash a new program into the chip eventually, but when I attached a spare LED to test it out, I got nothing. No light whatsoever (LED works; I checked). At one point in trying to communicate with the chip AVRDUDE gave me some kind of error about the fuses being reset to 0 and did I want to reset them. I think I said no because the command to upload the program already includes fuse settings, but I think the chip may be burned out. Or I could have burned out the chip with some bad soldering, but I checked everything I could for shorts and continuity and couldn't pin anything down. Seems like if there was something wrong with the chip that AVRDUDE would let me know.

That was my last spare driver, so now if I want to try anything I will have to take a driver out of an existing light. I did just this with my Mr.Lite BLF-Y4E but when I saw the board and tried to hook up the clip, I remembered reading about a capacitor or something in the way. I repaired the inductor that I accidentally knocked loose and the light still works at least.

I may order some new drivers. Still not sure how I will be able to rewrite and compile the BLF-VLD to get my "perfect" light: 2-mode with a programmable Low (no sense in programming High; I think having 1 programmable mode should make things a lot easier), but can't really play around with it until I get a driver connected.

If the fuses are erased, the chip won't start up on its own and therefore can't be programmed via the serial protocol any more. You would need a high voltage programmer to revive this one.

I'm not familiar with C so wanna ask for help. How can I change total number of modes in group? For example, I want to have less then 9 constant modes in extended menu, I removed unnecessary "MODE_LVLxxx", left only 3, but when switching through the modes, I still have to cycle through disabled six modes, difference is diode doesn't light up on them. And can I change the order of modes in extended menu? I'd like strobes to go first, then constant modes

Good question and welcome to BLF! I'm still trying to figure out Tido's program too, so I can't give you an answer. Hope that someone will chime in.

To change the number of modes in the extended group, you will have to change the '#define NUM_EXT_MODES 12' accordingly. You can reorder the modes by re-arranging the order in the array 'const uint8_t EEMEM eeprom[64]'.

If you delete mode-lines, you will have to adjust the array size accordingly (4 bytes per mode), otherwise the compiler may complain. But the best way to "remove" modes is to move the ones you want to the front of the array and set NUM_EXT_MODES to their number.

Tido Aha! That really works :) Thank you! And is there a way to start extended mode not from mode# 0x00, but from another one? To start extended mode from strobes

No, but you can just re-order the array so that the strobes are in front.

But in this case main mode would start from strobes too, and since I have only 2 modes in it, it wouldn't be very useful to have both of them strobes :) or there is a way to set different order of modes for main and extended?

The main group consists of indices into the extended group, you can't have modes in main that are not in extended. Let's take a look at the configuration array:


const uint8_t EEMEM eeprom[64] =
{   0x00, 0xFF, 0xFF, 0x00,
    0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00,
    // initial mode programming, indices to mode lines in the following array
    0x03, 0x06, 0x08, 0x00, 0x00,
    // mode configuration starts here. Format is:
    // offset in mode_func_arr, func data1, func data2, func data3
    MODE_LVL001,    // 0x00
    MODE_LVL002,    // 0x01
    MODE_LVL004,    // 0x02
    MODE_LVL008,    // 0x03
    MODE_LVL016,    // 0x04
    MODE_LVL032,    // 0x05
    MODE_LVL064,    // 0x06
    MODE_LVL128,    // 0x07
    MODE_LVL255,    // 0x08
    MODE_STROBE,    // 0x09
    MODE_POLICE,    // 0x0A
    MODE_BEACON     // 0x0B
};

The main group is configured by the line:


    // initial mode programming, indices to mode lines in the following array
    0x03, 0x06, 0x08, 0x00, 0x00,

These are offsets into the extended group. The first mode is at offset 0x03 (MODE_LVL008), the second is at offset 0x06 (MODE_LVL64) and the third is at offset 0x08 (MODE_LVL255). The fourth and fifth slot are not used because NUM_MODES is set to 3. If you re-arrange the modes in the extended group, you will have to adjust these indices.

Oh, that's my bad, I just forgot about this line. So, I start the extended mode from strobes and arrange main to start from constant - that's what I needed so much from bicycle light. 2 constant modes with option to adjust brightness of "low" and hidden police strobe. Great respect Tido for your work, chinese engineers never would make something as exciting :) Only sad thing that ATTiny13A has as low as 1kb of memory, that is not enough for battery mon and programming, but that's I can stand with

edit: Redundant. :P

I am thinking to write the BLF-VLD-0.4 to another driver with an Attiny13A. The program seems to suit changing modes by the power on/off switch. Can I use an additional momentary contact switch to change modes without modifying the code ?

Thanks in advance,

AFAIK, no, this program doesn't support external switch to change modes

Hi Folks,

I tried to build a version 4 BLF-VLD with 3 modes + battery monitor from the Driver.c file by AVR Studio. The Studio failed to build the files because the contents of the object file exceeded the maximum program monery of the device. So I deleted the lines from 88 to 140 to save space.

The Hex file and the eep file can be built and run. However, the LED will be slow flashing after the light is switched on for a while. When the light is switched on at high or at Med, it will rampdown to low. Also, no response to the change of the voltage of the voltage divider. I would like to ask somebody to help me fixing the issue. Thank you.

I see that people are having trouble connecting to the chip. Which clip is the most effective one?

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=140572159337&ssPageName=STRK:MEWAX:IT

http://cgi.ebay.com/ebaymotors/ws/eBayISAPI.dll?ViewItem&item=400171159037&viewitem=&sspagename=STRK%3AMEWAX%3AIT

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=120703298973&ssPageName=STRK:MEWAX:IT

I had that one in the middle. That's crap. I've heard the 3M should be better, but cannot confirm by my own account. My advice? Go direct drive.

I vote for HID45-style too. It's not so hard and if you are flashing well-known 8x7135 driver, it has only 2 pins of MC need to be soldered directly on it, other pins have connections on PCB. So even wife is not necessary :)

Guys I really want to use a clip I don't want to risk damaging the drivers by extra soldering. I found these but they only show two attachments top and bottom will they still work the price is good.

http://www.hmcelectronics.com/product/3M-Interconnect-Solutions/923650-08?refer=peoplebought

http://parts.digikey.com/1/parts/389607-8-pin-test-clip-gold-soic-15-923655-08.html

http://parts.digikey.com/1/parts/389604-8-pin-test-clip-alloy-soic-15-923650-08.html