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

Probably the easiest way to get started is to grab the common flashing hardware (usbasp programmer, ribbon cable, and a SOIC chip clip), get some common nanjg or qlite drivers to flash, and start messing around with JonnyC’s STAR firmware as a base. There’s one flavor for each of the most popular switch configurations, plus some derivatives if you want more features.

I’m using a 14-mode STAR derivative on my EDCs, each one tweaked individually for the best moon mode. Considering making some new additions to it too, like adding a battery check mode. I’m also using a STAR derivative on my SRK.

Oh yeah remember that thread… Let me go look :slight_smile: Thanks

I have the programmer- and got avrdude to confirm it works on the tiny13a. Had to solder it all onto the pins though- blf17dd. I have to check out Jonnys stuff though.

FWIW, a copy of JonnyC’s firmware (and a few others) is hosted here:
http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/files

Thanks Toy… Appreciate it :slight_smile:

Hy all,
I’m new in this forum. I try this programmable driver software and it is fine. But I have some problem with change the functions and levels in modes. Could any body explain how can i change the modes settings? My other question is that I can’t compile the driver.c software in winavr. I get always error with the message ‘PB1 undefined’. What can i do?

Thanks, Z

Does anyone know of a programmable buck driver to handle 2x18650?

No, I’m working dillegently on it tho.

Are you up for building a driver from individual components on an OSHPark board or you only want to flash a pre-built driver?

You could also piggyback an attiny13A onto a HX-1175b but that’s a fairly large driver and in no way a simple job.

When you say piggy back- is there a thread on this or is it a drop in replacing the one on the board.

This is a great source of information for a new guy like myself. I am continually finding reasons as to why my being introduced to this site was a good thing.

Soon you'll regret being introduced to this site as your wallet goes empty ;)

This first post is mostly pictures. Is there also a good step-by-step page/website on how to program a flashlight?
I have a flashlight with a driver that has an 8-pin Atmel tiny 13 processor.
I’m guessing I need to get an SOIC 8 pin clip from Ebay like this one

I have some embedded kits but it will be a pain to get them going. I will have to if thats what I have to do. I have programming/embedded experience so I can handle that.

So what do I need besides the SOIC clip and where do I start etc?

This thread might help:

All I needed was three parts (a soic clip, a usbasp firmware programmer, and a ribbon cable) and some software.

This might help too:
http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/view/head:/README

Thanks! Thats great. I bookmarked that thread now.

Hi :slight_smile:
This project has been developing for several years.
From Народный драйвер мод v2. Часть 2. | Мастерская: Tamagotchi и Rime
This firmware - as Lego
you can choose what you need
for thermal control you need to solder the NTC thermistor to 3 and 4 legs

http://109.87.62.61/uploads/LD_7135_v_2.6.5.zip

If you have any questions I will try to answer (but only with the use of Google Translate :slight_smile:

This is interesting, but the code is a little hard to follow in some places due to language differences, multi-layered #defines, and a lot of really low-level parts.

However, it appears to have an interface somewhat similar to my “s7” firmware, back when it used on-time instead of off-time… or the’s TheStar. Basically, the regular modes are first and the blinkies are later, and accessing the blinkies requires half-pressing the button a bunch of times quickly from off.

From what I can tell, it supports a lot of different configurations, including thermal step-down, multiple groups of 7135 chips for no-PWM medium modes, and a huge number of compile-time switches. Some odd things too, like moon is a hidden mode which requires tapping through higher modes first to get to… and a coarse ramp which (I think) configures something but I’m not sure how.

I think there are a few ideas I can learn from in this code, but it’ll take more inspection. If I’m lucky, I might be able to use some of the tricks to reduce the compiled size of some other firmwares.

Fortunately, the authors GPL’d it so I can include it in my repo without any need to ask first… but if you’d like to let them know about the code repo here (and efforts toward collecting and sharing code), please do so. You might also want to mention the IRC channel, #blf on IRCnet (open.ircnet.net:6667).

I’ll try to translate comments into English. A little later, we already night :slight_smile:

The author Tamagotchi does not object to non commercial use of its firmware. In the case of commercial use, it is best to discuss this with the author http://avr.tamatronix.com/

So I translated comments into English. Files in the archive.
http://forum.fonarevka.ru/attachment.php?attachmentid=134424&d=1428392392
Fuse Lo=79 Hi=FD

Modification of LED driver Nanjg 105C 8x7135. You must first modify the driver .

1. This method of determining short clicks remained from the old versions of firmware.
Soldered capacitor 5uF between the first leg of the MC and the ground.
In the 7135x8v2.h you need to uncomment #define CAPACITOR
In most cases capacitor is not necessary.
This is necessary if you have a button with LED lights. Or button FET and through it runs a small current (5uA)
In this case, the driver will turn on every time the new mode, unless you select this define & soldered capacitor.

2. Cut the track on the red line. Сonnected by a wire to the blue line. In the photo you can see the capacitor 5uF on the first leg of the microcontroller (old version).
Pin5 connected to the one chip 7135 and we get Lo modes (PWM 8kHz).
Pin2 connected to the 2*7135 chips
Pin6 connected to the 5*7135 chips
You can specify any value for PWM (0-255) and any combination for Pin5, Pin2, Pin6
In the file 7135x8v2.h

3. Mode Memory or No memory mode #define NOMEM

4. For thermal control you need to solder the NTC thermistor to 3 and 4 legs ore wires it in the right place.
Another way of protecting against overheating - use mode switching timer.
You can select a value in seconds here #define TURBO_TIME
After the timer mode will be reset to the previous one.
If the mode is selected with memory, after power off & turning it on will be used Max mode (TURBO).

5. Switching modes in one click.

6. Available up to five modes of operation with switching from Lo to Hi (#define REVERSE_SW), or Hi to Lo

7. Calibration of temperature control. After a set number of clicks (#define CALIBRATE_CLICKS 12) is heating. If you do a short click the temperature is stored in memory.
If you turn off lights - will reset (off) the thermal control.

8.Calibration Moonlight (ramping) the same way (#define RAMPING_CLICKS 8)
Short click is stored value in memory.
If you have a Problem with the entrance in the Moonlight - check the frequency of the slow strobe. Should be 1 flash per second. If faster - then most likely frequency of the microcontroller overstated. Check Fuse. Must be 4.8MHz
If you select (#define ONECLICKMOON) - exits by a single click. If not selected - three short clicks.

9. In no memory mode is possible to set the starting number mode
10. Option memory uses wear leveling. This means that our driver is not exhausted the resources of records in the EEPROM even with the most ruthless exploitation.
11. Option without memory does not use record in the EEPROM when switching modes.
12. Protection against contact bounce buttons - the driver will not randomly change modes and will not once again trigger protection against battery discharge or overheating.
13. “Sucker” battery - switching to a low-current when the battery is critically low on voltage, and then completely turning power off at Low Battery.
14. Displays the battery voltage is included 4 very quick click the power button. Fully charged - 5 blinks, unloaded - one flash (#define BATTERY_CLICKS 4)
15. You can select the number of short clicks to turn on the battery display modes, strobe, moonlight and ets.

To disable thermal control enter the calibration mode and power off for 2 seconds (or short-click to save the value).
If the thermal control is disabled - when displaying the battery at the end is a series of flashes.

I’m reading my way through this thread with the thought to getting the equipment needed to flash my own driver modes. I have come up with a question.

Is there a way to tell beforehand whether or not a driver is programmable or not? Are most reprogrammable or not?

Thanks very much.

Don

The drivers this thread is aimed at are the one's using the ATTiny 13a. A lot of development is also being done now on the 25/45/85 versions.

Basically, if your light has a "Nanjg xxx" driver, such as most of the Convoy's have, it has the ATTiny, & is capable of being re-programmed using the methods described in this thread.

If you look close, you should see the model of the chip printed on it;

Most other lights will use a different chip, they may even use the same footprint as the 13a, but are not programmable using this method due to using a different language.

- edit -

You may want to check out Hoop's guide, which contains everything you need to know to get up & running with flashing your own drivers.

Hi everyone,

it's a very long time since I saw this thread for the first time and this is my very first post.

This question caught my attention so I decided to give an explanation about modifying existing drivers in case someone is interested. I made an one-page document explaining the process, here you are the link to the explanation. I hope it could help understanding how tedious would be to make even just a small modification to the existing drivers compared to writing the firmware from scratch.