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

Hey cessna,

That's a good idea to summarize this thread. It's always a pain digging through all posts. So here's my summary of what I have been able to do.

Programmer: USBTinyISP - it's a parts kit, but the assembly is quite easy as long as you have a soldering iron with a small tip and thin solder.

Clip to connect on the microcontroller: http://search.digikey.com/scripts/DkSearch/dksus.dll?KeyWords=923655-08-ND - however, you will NEED a ribbon cable to hook this up to the programmer. I used one from the cheaper clip (blue one) I had which broke, otherwise you can find combo deals on ebay by looking up "SOIC clip", just make sure it's an 8 pin.

AVR Studio if you want to write your own code: http://www.atmel.com/microsite/avr_studio_5/default.asp

AVRDUDE program Tutorial for flashing the chip: http://www.ladyada.net/learn/avr/

From there I was able to buy some 7135 based chips with the Attiny13A chips from Deal Extreme or Kaidomain, download Tido's code (which includes a great README and pre-configured builds all set to flash), simplify his code to remove voltage monitoring and implement my own UI (and to understand what it's doing), connect the programmer up to the chip using the 3M SOIC clip, flash it, then solder it up and test it out.

Hopefully that helps?

- Jon

Maybe we could write a Wiki for how to do this? I have set up a page and done a rough draft. Since I've never actually gotten this to work (I think I need to buy a new clip, but maybe a new programmer as well) I won't be able to offer a lot of expertise.

Anybody can sign up at Flashlight Wiki for an account and then PM me to activate it so you can actually edit things:

http://flashlight-wiki.com/AVR_Drivers

sixty545,

can you share your code?

kong.

Of course I can share the code. I have DropBox, but have not tried to share files before, so I have to try first.

I use both kinds of memory that Tido's program support, memory after 2 sec on to remember the last used mode, but to distinguish tapping from longer_time_off I use memory_after_off which Tido calls "pin switching" because the function depends upon a capacitor connected to a pin of the MCU. At short "taps" the pin voltage is high, at longer "off" the voltage has bleeded away through a resistor. This function is discussed from post #166 onwards and calls for mounting 3 small components on the driver like this:

The 3 tap-detector components mounted on an AK47. Notice also how I connect the driver to the pill with a piece of multi-strand wire. I can then easily access the component side for re-programming by lifting the driver opposite the wire which is twistable.

I think it should take only a small modification to the program to avoid the additional components and use the 2 sec timing also for tap-detection. Of course the benefit of pin-switching will then be lost. I will try making such a version before sharing so it will take a while. But I will report back here when ready for sharing.

[EDIT]

Unfortunately it seems to be quite difficult to avoid having to add the 3 SMD components to the driver as the program code grows to be 48 bytes too big by omitting pin-switching. It think part of the programme has to be written in assembler to fit the available space of 1024 bytes.

For those still interested in my 8 mode driver with special memory and battery read-out I have made a zip-file here.

sixty545,

Thanks for sharing your code. I have an on STK500 dev kit with some spare Atmel 12 and Atmel 13. I can try to convert the code to assembly. I will need some help with the electronic..

kong.

is this clip sufficient? (12 dollars shipped) It looks like it has a nice small head for tight spaces, and it comes with a cable with a 10 pin female plug.

does this programmer look ok? (10 dollars shipped) It has a male 10 pin on the board, and the clip above has a 10 pin female. That should be a direct plug in right?

So with those 2 components in hand it comes down to software and the knowledge to do the programming? This is exciting!

ps great job on getting the wiki started brted!

Both those will work, they are both the cheapest (and most likely to break quickest) versions, but if you're going to flash a handful of drivers you probably don't need anything more expensive

.
However, it probably won't be a direct connection; you will need to change which pin on the clip each wire from the programmer connects to. To do this, find the pinout of the programmer (all similar AVR programmers will have the same pinout) and match it to the pinout of the attiny13 (and hence the clip). Depending on how the wires are connected to the clip you might need to desolder/solder but someone who’s done this already can better advise.

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!