I have a Convoy S3 flashlight and after following directions from various sources including this forum (for example), I think I finally got my flashlight working in a way that I like. Its still not perfect but its fine for now. If I have time again I might try some more changes.
The flashlight has a ATTiny13A microcontroller. I got the cheap $10 SOIC clip from Ebay and the USB programmer also from there for the same price.
The features are, as mentioned in the code:
// Made for Convoy S3 flashlight; should work on others with the same processor.
// Has 3 modes (low, medium and maximum) which can be changed.
// No stars. No memory. 3 seconds for saving mode. Always starts up in lowest mode.
// To use medium, click 2 times within 3 seconds. To use the max mode, click the button 3 times within the same time period (3 seconds). — Edit this to 2 seconds, it will be better.
// Light has a fade effect when turning on a mode so it turns on gradually. Its not too slow; takes just about half a second for the fade effect. Its not possible to fade out. I like this effect.
// No annoying blinky/flashy/blinding/SOS modes whatsoever.
// Low voltage code and Turbo timer was not tested after the changes
I would have done more but there’s the data and program memory limit. I’ll see how this goes but I may buy another flashlight in the future with a control ring to have an extra control option for convenience. I think I would like to see if there’s a driver with a bigger microcontroller so I can make a bigger program with more fancy features. I havent looked at what other people with a lot more flashlight programming experience have done. For example one thing I would like to do is to make the flashlight programmable with just clicking the buttons (number of modes, their brightness levels, turn on/off memory, direction, time periods, turbo/max mode time limits, use fade-in effects, some kind of gentle fluctuating power level change to show Max mode has been reached …… etc). I think I saw some programs that made the light programmable with clicks.
I wish all these flashlight manufactures could work on one nice program and use it on all their products so everyone could customize their lights easily. Better companies will start doing this first and the rest will try to follow.
I’m new to flashlight programming so whatever I say may have some errors or it could be improved so please do your research carefully to make sure you do the right thing.
Here’s the code (C language) in case anyone wants to try it out. This code is a modified version of someone else’s program (found in the unzipped directory: JCapSolutions-blf-firmware-a30f090 / Star). Copy from: http://pastebin.com/CMTg1UKn
There’s some junk old code or comments that I did not clean up in case I might need to reuse or refer to it later. Some comments are not valid so if you make changes you’ll have to see what its actually doing.
Here’s the Hex file generated from that code in Atmel Studio 6.2. Download at (click the blue “slow download” button): http://www.speedyshare.com/SDYbU/flashlight-1.hex
If you have that SOIC clip and the USB flasher and are able to talk to your device, you can just program the flashlight using the hex file.
As mentioned on the wiki, this is the command for checking if you have a working connection to the flashlight: avrdude -p t13 -c usbasp -n
This is the code for programming the light using the hex file:
avrdude -p t13 -c usbasp -u -Uflash:w:flashlight-1.hex:a -Ulfuse:w:0x72:m -Uhfuse:w:0xFF:m
If you have a hex file with another filename you have to change the name in the command. Also note the values of the fuses. If you have not programmed that specific flashlight before, you can run the command described in the Download Settings section on the wiki just so you download the original data before overwriting it.
Thanks to everyone who has made guides on how to do stuff.