Extended ver. 2.0 of Nanjg 105C driver based on Attiny25V

2 posts / 0 new
Last post
Bocian's picture
Last seen: 2 days 17 hours ago
Joined: 01/17/2014 - 13:12
Posts: 93
Location: Poland
Extended ver. 2.0 of Nanjg 105C driver based on Attiny25V

The new edition of extended software for Attiny25V. Below you will find the list of changes, updates and improvements in comparison with the previous version.

  • Controlling 2xAMC7135 (700/760mA) on a separate PWM channel allows a considerable extension of the current stability of the modes based on this channel. So called Mode of high efficiency. In practice, the mode 25% has a flat current regulation 700/760mA to about 3,15V voltage per battery cell and efficiency for the diode (for example XP-L V6) on the level of 170-180lm/W.
  • Two groups of modes added (besides the previous 4 mode group EDC, another 3 bicycle group modes have been added, just as well as two tactic group modes. All modes in every group are individually configurable from the palette of 15 programmable modes.
  • Different strobo speed (depending on the group we are in). For EDC strobo group 4Hz, bicycle group 2Hz, tactic group – about 16Hz (quite uncomfortable for a human eye). Intensity of the strobo mode depends, just as before, on the mode we have invoked 3-click (besides the tactic group).
  • Possibility of switching on/off the memory of the most recent mode by 7-click. The memory is on – as default. Memory off = starts always from the first mode in a group.
  • As per users’ suggestion a slowdown in visualization of voltage measurement.
  • Richer palette of available modes in programming process:



The ceramic capacitor is used as one binary digit memory with a limited time of holding information. It is used to differentiate short loss of power supply voltage (click) from switching off. Standard capacitor 470nF secures time, after which power supply loss is off for about 0,5 sek. Capacitor change to 1 µF allows the time extension (the length of a click) to 1 second. Hence every loss of power supply shorter than 0,5 second is treated as “a click”, each subsequent click after shining shorter than 0,5 second is treated as the next click of a multiclick.


Navigating between modes works two-way. One click makes you move to another mode in the loop, double click (2-click) takes you back to the previous one. It allows us to; for instance, reduce brightness without clicking through stronger modes in the loop. After reaching the verge of the loop, moving further will cause „a jump” to the next verge of the loop.

3-click Stroboscope (The strobo).
This mechanism makes the flashes have the intensity of the mode from which we have invoked the 3-click. Additionally, depending on the mode group we are in (besides the tactic group), it has assigned a default speed. 4Hz for EDC group, 2Hz for the cycling group, 16Hz for the tactic group. As for the tactic group the strobo has a default intensity set up for 100% and frequency 16Hz (a knock out for your eyes and senses).

4-click precise battery cell voltage measurment under full load.
I have approached the subject in my own way, assuming the following:
Practical band of discharging the battery cell Li-Ion under load ranges from 4.0V to 3.0V. After invoking a 4-click, the lamp flashes for a short moment in 100%, then the measurement happens. After that, with a number of flashes in 20% mode, the driver informs us about one tenth of V by 3.X. For example 8 flashes indicate the voltage of 3,8V; 5 flashes mean 3,5V, etc. The range is from 0-10 where 10 indicates 4.0V (the battery cell unplugged from the charger), while no flash (3.0V) means that in a moment you will be receiving a low voltage level warning. This way of measuring proves correct in diagnosing new lamps and an associated drop of voltage in the whole construction (a contact quality, etc.), since we are given the information which physical voltage is found on the driver level.

5-click mode group change
EDC (4-mode)-> Bicycle (3-mode)-> Tactic (2-mode)

Default (factory) settings for the given groups:
EDC: 0,03% – 2% – 25% – 100%
Bicycle: 5% – 25% – 100%
Tactic: 100% – 5%

A group change visual signalling:
EDC -> Bicycle – 2 twinkles
Bicycle -> Tactic – 3 twinkles
Tactic -> EDC – 1 twinkle

Let’s assume we are in EDC group. By invoking a quick 5-click we jump to the bicycle group. For example, we place a light in the bicycle handle and without the necessity of programming the brightness we are interested in, we move to the modes we usually use on a bicycle. Another 5-click means moving to the tactic (2-modes) group. Invoking 5-click one more time will move you back to EDC group.


The programming procedure of a given mode is elicited by 6-click, while being in the mode we wish to change. Displaying the sequence occurs in the lowest mode (signaled by one twinkle) upwards. Every mode displays for about 1,5 of a second. After reaching 100% there’s one twinkle, then it displays modes downwards. The mode is programmed during the display invoked by a click or by the mechanism of turning off the switch. If we cease to do anything during the procedure of presenting modes upwards and downwards, the light brightness will remain as previously set.

Switching on/off the memory of the last mode used (default – the memory is on). Having performed the 7-click, the light after switching off, will always come back in the first mode of the given group. For example, in EDC it will be a default 0,03%. Similarly for every group (for example, in the tactic group it will be 100%)

Reset to factory settings for all groups and modes with the move to the EDC group and switching memory on.

Temperature monitoring
This procedure always works in the background and monitors current driver/controller temperature. It is based on a processor internal temperature sensor 25V. After reaching safety threshold (default 60C) the driver/controller flawlessly reduces power, then tries to equalize to the set work mode. If the heat isn’t effectively absorbed, next reduction occurs while holding to the preset safety threshold. After cooling the lamp (for instance, cool air blow around the lamp case) the face value returns for the programmed mode.

10-click – the temperature limit extended 5C upwards, confirmed by 3 flashes.
12-click – the temperature limit extended 5C downwards, confirmed by 2 flashes.

The above changes can be done repeatedly, e.g. 10-click performed twice in a row will rise the temperature by 10C (3×15C), just as 12-click tunes the mechanism to our needs.

The calibration of temperature safety treshold. It is ivoked by 9-click. The driver starts in 100% mode, the light becomes warmer and we decide that the temperature has reached safety threshold. Now any click will save this temperature as the safety threshold.

Low battery cell voltage warning.
The low battery cell voltage warning starts when the cell, in a working mode reaches about 2,9V. Then a single flash appears and a reduction to another, lower level from the programmable modes palette (we reach ~2,9V in the given mode, and after a flash, we drop to another, lower mode). After reaching critically low voltage 2,6V, the driver 4 flashes and goes into sleep mode.

Below the table of brightness, runtime, current/mode levels. Green background = modes of high efficiency. (LED XP-L V6 bin, battery cell NCR18650B):

Fresh review of my Convoy S6 XP-L mod based on this driver (brightness in time etc):

According to my guidelines, my friend Pyra is the author of this project.

Edited by: Bocian on 05/28/2015 - 03:12
pilotdog68's picture
Last seen: 6 months 1 day ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

Wow, looks like you put a lot of time into this!

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver