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

but considering I don't do "reprograming", they should be fine for me since the functions are similiar...

I wonder if we can post them a note to request for "specific" models instead of waiting for lottery for 105A, 106 and 105C[I have not seen this,but I heard the stars have no functions]

FYI, I ordered 3 x SKU 6190 from DX. Took almost a month to arrive from the shipping date, but they are all Atmel ATtiny13A's :)

I'm very much interested in this topic, being a Computer Science major and a flashaholic. I'm curious to know if anyone has used this programmer: http://www.solarbotics.com/products/50844/. The price is good. Of course, I would have to get an 8 pin cable for it. It's based on the USBtinyISP, so I would think it would work with the ATINYs. Great work, guys. It's impressive what can be done with a little curiosity and some ingenuity.

Welcome to BLF bmmeadors

Have a good time here.

Thanks, Don. I have viewed many threads on this site. Finally became a member now.

By the way, I found another source for AMTMEL driver boards (supposedly, since they're the same ones as ShiningBeam's). There's a 3 mode 1.4A and a 2.8A version. Craig at IlluminationSupply has them, along with XM-L emitters and various other DIY pars. Already received an XM-L along with an empty P60 module and some teflon coated wire. Great stuff.

http://illuminationsupply.com/mod-parts-c-12.html

I've got two of the 1.4A drivers and an XM-L on the way. Maybe I can order that USB programmer now that I have an excuse.

Thanks for the link bmmeadors. It's good to have another US supplier.

So, I'm done programming. The 8 pin clip is giving out. After connecting it to a MCU probably 20-30 times, it's falling apart. I tried fixing it, but there's nothing that can be done now. Is there any place to get a higher quality clip? The only other way I can see doing this is soldering 6 tiny wires to the pins on the MCU just for programming, then removing once I have the program I want. That would be really tedious though. For now I'm just going to stick with the program that came on the boards to build lights :(

Aloha and welcome to BLF bmmeadors!

Is this with the chip in the circuit or loose? I suppose the clip is the only way once the chip is soldered down - my first thoughts ran to a ZIF socket. When I have fiddly things like that to repair, I consult my dentist - dental casting resins are amazingly useful. They are not cheap but you don't need a lot.

The people who make false teeth might be worth consulting too - dental technicians they are called here - they are used to fabricating small items with very high precision. And work a lot cheaper than dentists.

Hi bmmeadors, welcome to the BLF.

I'm currently using the Bus Pirate for programming ATMELs. It's a really handy tool that can do much more than just flash-program MCUs. As for the debugging clip, I use one like this. It may cost twice as much as the cheaper ones, but mine has been in use for a few months now and is still in good shape.

Tido, that Bus Pirate looks pretty cool. Looks like I'd have to break out an Ubuntu live CD(or other distro) to use it. I used to dual boot with Ubuntu, but I eventually gave up that partition, as I found that I didn't use it very much.

Have been thinking a long time of how to make the best mode arragement (for me). The last one I made was 4 lm - 16 lm - 64 lm - 250 lm with memory (XP-G in WF-502B) where modes repeated in ring: verylow -> low -> mid -> high -> verylow etc.

The memory was handy but the number of tabs to reach a certain mode from turn-on of course depended on the memorized mode. The goal is to reach the most used modes with the fewest tabs.

A light with no memory would fullfill that and always have the same number of tabs to reach a certain mode and disco modes could even be added at the end:

low -> mid -> high -> verylow -> strobe -> SOS -> Beacon -> low etc.

For a XM-L light this could be:

32 lm -> 125 lm -> 500 lm -> 4 lm -> strobe -> SOS -> Beacon -> low etc.

I think that 32 lm would be a fine standard level for close use and the light would always start in that level. But for other uses it would be better to start in another level. That gave me the idea to combine the no-memory list with a memory giving this mode array:

last_mode -> low -> mid -> high -> verylow -> strobe -> SOS -> Beacon -> last_mode etc.

When the light is turned on it will start in the memorized mode. One tap wil bring it to low, two taps to mid and so forth. If the last_mode was low, one tap of couse should go to mid but that is easy done in programming.

The memory could kick in after staying a few secs in a mode or 1 sec after switch-off.

If memory is made after switch-off it opens up for an alternative arrangement with normal modes in one chain and disco modes in another:

Turn-on, wait 1 sec -starts in normal modes chain:

last_mode -> low -> mid -> high -> verylow -> last_mode etc.

Turn-on + fast tab -goes to Disco modes chain.

strobe -> SOS -> Beacon -> strobe etc.

Now I "only" have to modify Tido's program to test all this.

EDIT: For implementation: Look at post #254

Just to update you guys, I took your advice and ordered the 3M clip from here...

http://search.digikey.com/scripts/DkSearch/dksus.dll?KeyWords=923655-08-ND

They are only a state away, so it arrived really fast and shipping was cheap. The clip really locks on to the chip tight, but the contacts just barely didn't reach. So I had to trim the plastic down a bit, and then it wouldn't stay on :( After trimming it down multiple times, I think I have it working. However, I don't have a working chip anymore to test my latest program. Hopefully the shipment from Kaidomain will arrive shortly and they will have the Atmel chips.

...just really busy.

I started at a new job last week and I'm still looking for a flat. So it might take a few weeks before I find time to hack the driver code again.

We apologise for the inconvenience.

I'm glad you can find some time to be around here - thanks for all you've contributed here.

And good luck with finding a place to live, that is just about my least favourite task.

Hop it doesn't take too long.

ordered: 16 Feb 2011

Recieved 04. March.

5x 105C ATtiny13A


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. It finally came down to 1018 bytes mainly by rewriting the delay code and avoid using sleep_ms() and sleep_sec().

What about a light that tells the battery voltage?
It could certainly save a lot of unscrewing the tail cap to check the battery. Well, it is here now.

My wish list was:
1. Most used levels first. No need for programmable.
2. Many modes including flashing modes at the end of menu.
3. Memory, but no tapping through disco modes to get back to the first levels.
4. Battery read-out.
5. Shall decrease output gracefully at about 3.0V (for non protected cells)
6. Beacon mode should be the soft on, soft off type (byte-hungry).

The solutions:
1. Start with 'low' which is 44lm for this XM-L based light. Then higher plus a low-low.

2. Se mode list in point 3.

3. It memorizes a mode when used 2 secs.

[EDIT apr.15-2012] Memory can now be switched off, look here.
At turn-on after being off for more than 1 sec it starts in the memorized mode which alway has the first place in the menu which can be tapped through:

Last_mode ->
44lm -> 168lm -> 690lm -> 6lm -> strobe -> police strobe -> Beacon -> SOS -> (folds back to 44lm, NOT Last_mode)

By tapping from Last_mode it always go to 44lm*)
*) skips to 168lm if Last_mode was 44lm

4. Battery read-out is build into the Beacon mode. One second after the full power beacon-flash the light makes a number of countable blinks, separated 0,5 second. The level is 1 (1/255 of full power), the lowest possible.
examples: Vb= 4.2V -blinks 12 times
Vb= 3.8V -blinks 8 times
Vb= 3.2V -blinks 2 times
Vb= 3.0V -blinks 0 times
It is very stupid to look into the light to count pulses, the beacon flash each 8 secs is formidable, but using the reflection from close distance from a wall gives an easy count.

5. Output is cut in half in all modes each time battery voltage sinks to 3.0V until only the driver uses (a very little) current. This process can take 2-3 hours and optimizes output.

I have build this into a Solarforce L2 copy with XM-L and driver 105C plus into two WF-502B with XP-G R5 and driver 101-AK.

I'm a little euphoric about that L2 and it shows how far Tido's initiative from nov.2010 can take you.

Very nice. And all in 1018 bytes!

Hi all, first post here. I was just directed to this post and found it quite an interesting read.

I did the same thing nearly a year back now (doesn't feel that long ago) rewriting the uCs on the 7135 drivers. I am in the position of using various Cree LED emitters of different max current ratings (XRs, XPs, XC-E and hopefully I’ll get my hands on an XM-L soon) always with single Li-Ion voltages (though usually a few cells I've welded in parallel and wrapped, for increased run-time). This meant it was just as efficient to use these linear drivers as making a buck driver, though not as flexible.

I must admit that I found programming PICs in general to be much easier and user friendly than the Atmels. I ended up getting the basic software PWM down to around 22 bytes and the entire program down to around 210 bytes. My uC was independently controlling 2 different LEDs by monitoring 2 input switches, allowing the user to program up to 10 modes per LED. Of course changing this to just one LED and one input would be easy enough.

Of course this was all in assembly which I'm surprised to see has not been used by anyone on this thread. Given how basic the chips are, and how simple the program is it would seem an ideal place to use it.

Personally I do hope the drivers start using PICs again :p But I have seen that the couple of people who are doing the programming in this thread didn't get on with them so I guess its swings and roundabouts.

Actually, I have successfully ported the driver to the PIC12f629, I just didn't have the time to clean up the code enough for a release. I hope I'll come around to it once I'm settled down again.

Welcome to BLF Subterranean.

Good to have you here.