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

863 posts / 0 new
Last post
HID45
HID45's picture
Offline
Last seen: 7 years 6 months ago
Joined: 04/13/2011 - 03:45
Posts: 291
Location: Finland

HID45 wrote:

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?

Quoting myself here. Does not work. That goddamn solderblob between the legs very effectively prevents the Soic clip of getting contact on that side (legs 1-4). It's just not possible to get the connection with that stupid lump on the way. No way no how. I got my clip today and arranged the wires accordingly. I've DMM:ed all the wires and the clip and all of them shows they have contact to programmer. But still, no connection to the chip. 

Funny thing is, not only I have couple of those pre-blobbed buggers (both 1,4 and 2,8 amps) here that are now about as useful to me as penis-flavoured lollipops, I have also more of them on the way. Splendid. Well, guess I'm off to KD or DX or MF to order more same drivers, only ones that are not ruined in advance.

Too bad just about the only thing exceeding my lack of soldering skills is my lack of un-soldering skills. But I might still try that, after good nights sleep. After all, I have plenty of them to practice with. 

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

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

I've never had any luck unsoldering with copper braid, but recently got a solder sucker. Tried it out and didn't seem to do much better, but I was worried about melting the plastic tip. After watching a YouTube video of a guy using a solder sucker, that doesn't seem to be a big worry because it looked like he put it right on there (though he also went very fast; video wasn't zoomed in enough to get a lot of detail and doing it fast from the same angle over and over again added very little to my understanding).

I've added a lot to the Wiki page on this topic lately, though I'm stuck again now that my clip isn't working.

http://flashlight-wiki.com/AVR_Drivers

Don't think I will every try another lollipop. Thanks for that image . . .

 

Don
Don's picture
Offline
Last seen: 1 year 5 hours ago
Joined: 01/12/2010 - 16:32
Posts: 6617
Location: Scotland

HID45 wrote:

penis-flavoured lollipops. 

 

You need to get a copy of Nick Earls' "Batchelor Kisses".

It seems to be out of print everywhere except Australia where the author comes from. Nick seriously gets it about what I do for a living.

Buy it. Read it.

Laugh a lot!  I just about wet myself.

Then ask me about strawberry jam....

:bigsmile:

 

The numbers from my light tests are always to be found here.

https://spreadsheets.google.com/ccc?key=0ApkFM37n_QnRdDU5MDNzOURjYllmZHI...

Match
Match's picture
Offline
Last seen: 5 years 6 months ago
Joined: 11/14/2010 - 11:57
Posts: 1488
Location: South Carolina, USA

HID45,

  I've had good success by using a very small razor blade to carve away solder (exacto-style blade).  May be worth a shot.

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

Match wrote:

HID45,

  I've had good success by using a very small razor blade to carve away solder (exacto-style blade).  May be worth a shot.

Try heating the joint then sticking the razor blade between the pins.  Solder does not like to stick to razors.  Treating the joint with liquid solder flux first really helps to clear the solder bridge.

I would also try the solder wick.   Place it over the offending pins.  Stick the soldering iron tip on the wick until the solder flows.  Wipe the wick/iron tip down the length of the pins.  Voila...  no more solder bridge.  I solder fine pitch SMT IC's this way all the time.  Helps to use a real (temperature controlled) soldering iron with good tips.

Better yet,   use what  I use...  a Pace PRC400/PPS2000 solder rework station.  Retails for well over $6000 with a good assortment of accessories.  Can be had,  with luck,   for considerably less on Ebay (or PM me if you are REALLY serious about your slobbering equipment and have about a tenth of that burning a hole in your pocket ...  sorry Eurofolks,  they only work on 120V and weigh about 30 pounds)

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

Thanks texaspyro, but no thanks. I'm not that serious with my soldering equipment, even for the tenth of the tenth. Actually I'm pretty sure one could buy similar setup that I use for about ten bucks nowadays from ebay or chinese online shop.

brted: You're welcome. I heard that expression somewhere some years ago. It got me thinking could there be any more useless thing than the mentioned item. After thinking really long and hard (pun not intended) I came to conclusion that nope, there is none. I mean most useless stuff can be either destroyed in a funny way - let's say by shooting it or blowing it up - for brief amusement or sold online. But I coulnd't imagine a way to destroy a lollipop in very spectacular manner. And I doubt that there is much demand for that particular flavour either, even among ebay users, who are notorius for buying just about any useless crap imaginable. And about that Wiki-page... It's the best thing ever. I could not have even get the drivers or other software sorted without it. It's just amazing. Thank you for doing it and if you ever come to Finland, I'll buy you a beer.

Match: Yeah, I think I'll try a combo of wicking and shaving the blob with a knife. I think by weekend I have gathered enough motivation to continue the pursuit of getting that connection working. It was like 1.00 AM here yesterday (or actually today, to be exact) when I finally gave up and went to bed. Had some serious frustration accumulated at that point. The connection was not working. We lost to the Czechs in hockey. I ran out of beer. I knew I'll have to wake up in six hours to get to work. Etc etc. 

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

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

After some tinkering, I got connection to chip. Downloaded the settings and uploaded new ones (BLF-VLD). Everything went ok according to AVRdude, but I can't change modes. It's on high and does not change modes no matter how I click it on and off. What could be the problem?

I' want to set it up to 3 modes (lo mid hi) + sos without memory. There was that fine post #281 (or something) which described how to set up a 4 modes and no memory, which I have used as a base. I'm just unsure how to activate sos. Do I just use #define func_sos in build_simple? 

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

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

Clip? What clip? Come on now... That's so last season. And not a genuine budget solution. This is how we flash chips HID45 style.

 

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

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

Hmm. Seems like I'm hijacking this topic... But could someone help me out with setting the modes. With the light itself. I flashed the fixed modes version of Tidos driver. Didn't change it at all. 3 modes etc. I'm able to enter the extended modes no problem, but can't lock the mode settings.

I've followed the instructions on the readme, but no luck. So let's say I want the normal low replaced by crazy low from extended modes. I'll go to low. Hang in there for over 2 seconds. Then click 6 times to enter extended modes. Then select the crazy low. Hang in there for more then 2 secs. Then turn off. What next?

Should I start tapping short short long short from there? Or should I first turn the light on to get that blink and then turn off and then start tapping s-s-l-s? Does it make any difference how long the pause between taps are?

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

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

I tried soldering to the legs like that, but I couldn't do it. You've got better eyes, a steadier hand, and better soldering skills than me. Are those the only 4 pins you have to have connected? Looks like you don't have 6 or 7 (SCK and MISO). When I was playing around I didn't think I needed 5 (SCK) which you are using.

On drivers with stars, I'm guessing you could solder to the stars instead of the IC pins or pads for some of them, but I don't know if the ones connected to the stars are needed for communication.

Can't be of help on setting modes right now. I was thinking the extended modes UI wasn't programmable, it just gave you a way to get to additional modes if needed. I thought only the programmable was user programmable.

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

brted wrote:
Can't be of help on setting modes right now. I was thinking the extended modes UI wasn't programmable, it just gave you a way to get to additional modes if needed. I thought only the programmable was user programmable.

Hmmm... Yes... that would make sense. I think it said that there are no blinky modes in programmable? I'm trying to set up a dedicated camping/tenting/trekking light and it would be nice to have some kind of SOS or other distress signal.

Soldering was actually not very hard. If you have someone to push enter, you only need to solder those 4 pins. That's what I did. My soldering skills are not so good that I would tried soldering those 4 pins on the upper side of the chip. It would have been one messed up driver after that. What I did was solder only the corner pins, which is no big deal, and then write (or copy/paste from flashlight-wiki) the command needed to command prompt. Then I stick the remaining 2 pins to the driver legs with my bare hands and ask the wife to come and push enter. Sorted Smile

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

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

HID45 wrote:

Then I stick the remaining 2 pins to the driver legs with my bare hands and ask the wife to come and push enter. Sorted Smile

I need to get me one of those. The dogs are absolutely useless at that kind of thing.

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

Lol... Wife is not exactly a budget item, that's for sure. But it can be done without one. I've tried it with success but it's quite a hassle. You have to put the driver with all the leads on top of the keyboard, near the enter (well, depends on the keyboard you're using but that's the case with my laptop). Then connect the last two pins while not pressing hard enough for any other keyboard buttons to engage and try to hit the enter with your pinky. It's difficult and requires some precision. But after the wife has gone to bed saying something like "that's just stupid, go to bed, you have work day tomorrow and it's already 1 AM" there's really not many options but to cope with it. 

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

Tido
Offline
Last seen: 3 years 3 months ago
Joined: 05/28/2010 - 15:28
Posts: 189
Location: Berlin, Germany

HID45 wrote:

Lol... Wife is not exactly a budget item, that's for sure. But it can be done without one.

More proof that too much internet makes you think in strange ways. The first thing I did after reading that sentence was to check whether budgetwifeforum.com was already registered.

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

I flashed the programmable today. Now I'm one step closer to my dream light. 

One problem. I can't get the nomemory-function to work. I have defined it on lines 44 and 92, yet the light still remembers the last mode it was when turned off. How can I disable it for good? And seems that it's 3 modes, even when I have defined NUM_MODES 4 and also edited line 192 accordingly. And I can't seem to get the SOS to function. Strobe, police strobe and beacon are there, SOS is not.

But, even with these minor flaws, it's closer to perfect light than anything I can buy from any store or online. So big thanks to Tido and others for making it possible, and giving so good instructions that even noob like myself can successfully flash chips and program modes and do all kinds of HC stuff. 

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

Tido
Offline
Last seen: 3 years 3 months ago
Joined: 05/28/2010 - 15:28
Posts: 189
Location: Berlin, Germany

The predefined build settings 'Programmable', 'Fixed' and 'Simple' will override any configuration set in the block of #defines above. Those are reasonable default settings that will produce a driver image fitting into the ATtiny13's 1k program memory. If you want to build with your own configuration, you'll have to use 'Default' as the built option.

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

I got to test my Bridgelux LEDs last night on an integrating sphere light meter.   Their raw output is spot on to the specs (try that with a Chinese LED).   Unfortunately,  you  do lose about 25% of the light in the beam forming reflector and front glass.

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

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.

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

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

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.

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

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.

Tido
Offline
Last seen: 3 years 3 months ago
Joined: 05/28/2010 - 15:28
Posts: 189
Location: Berlin, Germany

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.

shatz
Offline
Last seen: 10 years 3 months ago
Joined: 06/28/2011 - 18:44
Posts: 6
Location: Moscow, Russia

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

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

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.

Tido
Offline
Last seen: 3 years 3 months ago
Joined: 05/28/2010 - 15:28
Posts: 189
Location: Berlin, Germany

shatz wrote:

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

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.

shatz
Offline
Last seen: 10 years 3 months ago
Joined: 06/28/2011 - 18:44
Posts: 6
Location: Moscow, Russia

Tido Aha! That really works Smile 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

Tido
Offline
Last seen: 3 years 3 months ago
Joined: 05/28/2010 - 15:28
Posts: 189
Location: Berlin, Germany

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

shatz
Offline
Last seen: 10 years 3 months ago
Joined: 06/28/2011 - 18:44
Posts: 6
Location: Moscow, Russia

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 Smile or there is a way to set different order of modes for main and extended?

Tido
Offline
Last seen: 3 years 3 months ago
Joined: 05/28/2010 - 15:28
Posts: 189
Location: Berlin, Germany

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.

shatz
Offline
Last seen: 10 years 3 months ago
Joined: 06/28/2011 - 18:44
Posts: 6
Location: Moscow, Russia

Tido wrote:

The main group is configured by the line:

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

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 Smile 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

devman
Offline
Last seen: 4 months 3 weeks ago
Joined: 04/27/2011 - 06:24
Posts: 825
Location: Hong Kong / Vancouver, Canada

edit: Redundant.  Silly

Pages