Flashlight drivers with modes use a micro-controller (MCU) to handle those modes and the user interface. Fortunately a few drivers come with an Atmel ATtiny13 MCU which can be reprogrammed with custom firmware, namely the NANJG105C (8*AMC7135, 2.8A or 3.04A), NANJG105D, the NANJG101-AK1 (4*AMC7135, 1.40A) and the NANJG-AK47A (3*AMC7135, 1.05A). This became a hobby for me, and here I gather info on my firmware variants. If you want such a driver, you can contact me at budgetlightforum.com (BLF) or taschenlampenforum.de (TLF).
All those drivers are for input and output voltage of 3-5 V (lower brightness at 3V), best suited for one Li-ion cell or multiple Li-ion cells in parallel, and one XM-L or similar. Slave boards could be connected for driving multiple XM-Ls, see at end of page.
|drivers for usual lights with a clicky|
|luxdrv 0.3 was my first firmware. It features short-cycle memory, ramping, battery monitoring (reduces brightness when batt is low, and has a battery level indicator). It's source code is available here, License: CC-BY-NC-SA (non-commercial use only, derivative works must be under the same license).|
|MiniDrv is a minimalistic firmware, it demonstrates how simple and small a firmware can be. No blinkies and no battery monitoring though. See MiniDrv/MiniMo page.|
|NLITE is a free firmware with similar features as the original NANJG105C, i.e. it has some mode groups, selectable via solder bridges at the stars. It has 8 groups though, none of them with blinkies, instead you can have 3 or 4 modes (with ot without moon mode), low-to-high or high-to-low mode order, memory or no memory. Also PWM is 18kHz, not visible, not audible. Firmware download and more details below.|
|luxdrv 0.4 is it's successor.
Key features: Short-cycle memory, Ramping, programmable (i.e. modes are configurable by the user, by a number of taps), the number of modes can be changed, too. Has low-batt step-down (reduces brightness when battery is low) and battery indicator.
|guppydrv is not programmable, but it has mode groups, so you can have different modes for different situations, for example
a mode group for outdoors (High, Med, with memory), one for indoors (moon, low, med, high, no memory), one with just high (for tacticool and signaling purposes), one with special modes, ...;
ramping is available as a mode, too.
Memory is a per-group setting, i.e. can be different for each group (no-memory, classic memory, short-cycle memory).
Reduces brightness when battery is low, and beacon mode includes a battery level indicator.
|guppy2drv is not fully programmable, but it has a lot of mode groups to choose from, each with it's own memory setting.
The major improvements above guppydrv are the bigger number of possible groups and the more direct way of choosing between them,
as well as the highly configurable turbo timer and off-time memory. No ramping though.
Also has battery voltage indicator and low voltage step-down.
|lupodrv is a very flexible firmware for lights with a clicky.
Key features: Programmable (change, add, delete a mode) with a nicer UI than luxdrv, and the memory type can be changed, too (no memory, classic memory, short-cycle memory). Also a mode can be locked for signaling or tacticool purpose.
Has low-batt step-down (reduces brightness when battery is low) and battery indicator.
|lucidrv is my most flexible firmware for lights with a clicky.
It is very similar to lupodrv, but the UI is a bit different and it additionaly has two mode groups.
Key features: Programmable (change, add, delete a mode), has two mode groups, the memory type can be set for each group (no memory, classic memory, short-cycle memory), also a mode can be locked for signaling or tacticool purpose.
Has low-batt step-down (reduces brightness when battery is low) and battery indicator.
Note: Since 2015, lucidrv/FT (lucidrv with off-time memory) will be sent as default.
|lucidrv/FT (ofF-Time memory) is a variant of lucidrv that can distinguish between
being off for a short tap (half-press) on the clicky and being switched off for a longer time. This is called off-time memory
and may require (depending on hardware) a small hardware modification (soldering an additional capacitor).
lucidrv/FT also offers an extra mode reached by a double-click (double-tap) as an option.
|drivers for lights with momentary buttons (electronic switch)|
|MiniMo is a minimalistic firmware for momentary (electronic)switches. No blinkies and no battery monitoring though. See MiniDrv/MiniMo page.|
|lumodrv, for flashlights with a momentary button (electronic switch), like UltraFire T50, SkyRay King, UltraFire H3, Small Sun ZY-T29, ZY-T11, ZY-T08. Unfortunately some of those lights are not quite modding friendly. Key features: Easily accessible ramping (just press and hold); hidden extended modes; double-click to high etc.; momentary mode; battery indicator and low-batt step-down.|
|mobydrv, intended for cycling, where you need to change modes more often than to switch the light on or off. Key features: easily change modes up or down, programmable, hidden strobe, battery indicator, low-batt step-down.|
|mobydrv/Q, a mobydrv variant that allows switching the light off much more quickly and thus is better suited for flashlight use.|
|simodrv, a momentary switch UI that partly mimics classical clicky UIs. A short tap switches to the next mode, a long click (press&hold for 0.5s) switches off. However when off, a short click switches it on to using last used mode (memory), while a long click switches it on using the first mode (no-memory), so you can decide between memory and no-memory each time you switch it on. Has a battery indicator, a hidden strobe (triple-click), and the brightness levels are configurable (programmable).|
|mokkadrv, a momentary switch UI with some tactical tendencies. When off, a short click always switches to HIGH, a long click (press&hold for 0.5s) to low. A double-click activates strobe. A short click also switches off. Press&hold to cycle through the 3 modes. Has a battery indicator, and the brightness levels are configurable (programmable).|
|moppydrv, sort of guppy2drv for momentary switches, with basic operation similar to mokkadrv. Like guppy2drv, there are many mode groups to choose from, selectable by the user. When off, a short click switches to on the last used mode (memory), a press&hold to the first mode of the mode group (no-memory). When on, a short click switches off, press&hold cycles through the modes. A double-click leads to an extra mode (from off or on). Has a battery indicator, low voltage step-down and a configurable turbo timer.|
|lumo35drv, for flashlights with a clicky (for power) and an additional momentary button (for modes), suited for the TK35 and it's clones for example (requires modding to parallel battery setup). Key features: Easily accessible ramping (just press and hold); hidden extended modes.|
|Other drivers (with custom PCB)|
|RGBW, a driver suitable for the RGBW XM-L color, or other RGBW setups. Has lots of color modes, and can measure the battery capacity. Requires a momentary switch.|
|H17F with lucidrv2 firmware, an enhanced lucidrv on custom hardware, allowing for lower low modes and additional direct drive capabilities for turbo modes, and full thermal regulation.|
Short-cycle memory is a special UI that allows to have memory and many modes without the need to cycle through all of them.
With classic memory you have a few modes, and if you want to go back to the first mode, you have to cycle through the remaining modes.
With no memory, you always start at the 1st mode and don't always have to click through all the modes, but you have no memory.
With short-cycle memory, a mode is memorized (i.e. if the light is switched off an on again, it comes on in that previously used mode), but when you change modes again, it will restart in the first mode instead of the next mode, so you don't have to cycle through all the modes. This combines memory with the advantages of a no-memory-UI. It effectively hides every mode behind all it's predecessors and is very effective if you have your favourite modes in front and blinkies or other rarely used modes at the end. I call it "short-cycle" in contrast to the classic cycle-through-all-modes memory, but it was actually invented by sixty545 at BLF.
This is the successor of lupodrv with a somewhat more intuitive programming UI; it also features two mode groups.
Note: Since 2015, lucidrv will be sent with off-time memory as default (actually lucidrv/FT).
Two mode groups: You can have two mode groups for different situations (e.g. one for indoors with moon and low modes, and one for outdoors with high/med). Each group is fully configurable with up to 7 modes and it's own memory type (see below).
Mode locking: Select any mode and use it for a second, then activate mode lock (see below). Then that mode is locked, it won't change to next mode any more (unless you unlock it again). Good for tactical or signaling purpose.
Programming: You can change any mode to a different brightness, strobe or beacon; you can change the number of modes (1-7) in each group, and you can change the memory type for each group (see below)(no-memory, classic memory, short-cycle memory).
Configuration menu (programming mode):
Select a mode and use it for at least a second. That mode is then the selected mode for some of the actions below.
Then enter programming mode by 8 rapid taps (half-presses; the light must be <0.2s on each time).
You have to be quite fast, however it's no problem if you tap a few times more.
Shortly after those rapid taps a blinking signal will be shown. This serves two purposes: It indicates that the light is now in its configuration menu (programming mode) and awaits further input, and it also serves as battery level indicator: The number of blinks indicates battery voltage, about one blink for every 0.1V above 3.0V without load (~12 is full, ~4 is pretty empty). If you let them pass without tapping the button again, the config menu is exited without any change.
If you want to change the configuration, you need to 'input' more taps while the blinking signal is active, the number of taps specifies the action. Note that the timing is more relaxed in the config menu; you have to be swift and uninterrupted, but by far not as rapid as the 8 taps above. However you must hit the exact number of taps.
Once you entered the config menu (by 8 rapid taps) and see it's signal, tap the button a number of times to do the following:
New features for lucidrv drivers sent since September 2013:
Disable programming (proglock): Solder a connection from the 4th star (the rightmost one on the images below) to the outer ring to disable programming (some conductive paint etc. might work, too). Mode locking and switching between mode groups (1 or 2 taps in the config menu) will still work, but all config options below that won't. Remove the solder bridge to enable configuration changes again.
Option: 5 taps for mode lock: You need to tell me if you want that option before I send the driver. A driver with that option will switch mode locking after 5 quick taps (like lupodrv) instead of one tap in config menu. The latter will then just be ignored and may be used to abort the config menu. This option might be useful for those who use mode locking often.
lucidrv/FT (ofF-Time memory) is a variant of lucidrv that can distinguish between being off for a short tap (half-press) on the clicky (to change to the next mode) and being switched off for a longer time (so that memory kicks in, or no-memory if configured that way). This is called off-time memory. It may (or may not, depends on hardware) require a small hardware modification (an additional capacitor of 1uF soldered between star 4 and the ground ring). ProgLock moved to star 3.
Option: Double-Tap: A quick double-tap leads to an additional (programmable) mode, e.g. high or strobe. It can also be activated fromm off by a tap immediately after clicking on (click-tap; for reverse clickies), or by a tap immediately before clicking the light on (tap-click; for forward clickies) You need to tell me if you want that option before I send the driver.
Just like normal drivers it has some modes and memory, but it has two additional features:
Mode locking: Select any mode and use it for a second, then quite quickly tap (halfpress) the button 5 times (so it's on for only <0.2s each time), then the mode you started with is locked; it won't change to next mode any more. Good for tacticool or signaling purpose. Return to normal operation by quickly tapping 5 times again.
Programming: You can change any mode to a different brightness, strobe or beacon;
you can change the number of modes (1-7),
and you can change the memory type (no-memory, classic memory, short-cycle memory).
Select a mode (use for a second) and enter programming mode by 8 rapid taps (<0.2s on each time); then the driver goes through all options (see below), just tap again at the right moment to choose the one you want.
|12||turbo timer config mode|
guppy2drv is more or less the successor of guppydrv. It allows the user to choose between a couple of mode groups, each with it's own memory setting.
Features: Lots of groups (I can implement up to 29 groups) to choose from (via some clicks), highly configurable turbo timer, off-time memory, battery voltage indicator, low voltage step-down.
Battery voltage indicator: Enter the config menu by 8 (or more) fast taps (half-presses), then wait for a blink signal. Count the blinks: It's one blink for each 0.1V above 3.0V, so 12 blinks is full, 3-4 blinks is quite empty.
Change mode group: Enter the config menu by 8 (or more) fast taps, wait for the blink signal (battery indicator). If you want to change the mode group, you need to 'input' more taps while the blinking signal is active, the number of taps specifies the group number (see mode list). Note that the timing is more relaxed in the config menu; you have to be swift and uninterrupted, but by far not as rapid as the 8 taps above. However you must hit the exact number of taps.
Set turbo timer: Enter config menu by 8 (or more) fast taps, wait for the blinking signal, then enter turbo config mode by the according number of taps (see mode list). The light then runs at full power. Let it run for the desired time (e.g. until it gets hot; use a full battery), then tap or switch off. That time is now set for the turbo timer. Setting a time below 4 seconds disables it. The turbo timer has a maximum of about 19 or 20 minutes (this is also the default). It applies to all modes above 50% and smoothly ramps them down to 50%.
Low voltage protection: Whenever the battery falls below 3V under load, brightness is reduced (about half). The reduced load usually brings up the voltage a bit. When it drops below 3V again, brightness is halved again - and so on, down to a very low level. It will not switch off and leave you in complete darkness though.
Connecting star 2 to ground (e.g. solder bridge to ground ring) activates group lock: The battery indicator still works, but groups cannot be changed any more.
Connecting star 3 to ground changes classic memory to short-cycle memory (for every group with memory). Note: There are some variants of guppy2 availabe elsewhere which may or may not have that feature.
guppydrv has it's modes organized in mode groups, the user can switch to the next group by 8 quite fast clicks (<0,25s). The number of blinks then indicates the current group.
You could have a mode group for outdoors (High, Med), one for indoors (moon, low, med, high), one with just high (for tacticool and signaling purposes), one with special modes,...; ramping is available, too.
Memory is a per-group setting, i.e. can be different for each group. Options are no-memory, classic cycle-through-all-modes memory, and short-cycle memory (see above).
Starting at high, starting at low, strobe or not, memory or not - you can have a mode group for each situation.
guppydrv has battery monitoring with automatic step-down on low battery level, and the beacon mode starts with a battery indicator (a number of blinks); see lupodrv.
Default mode groups:
The mode order is
memory -> mode 1 -> mode 2 -> mode 3 -> ramping -> selected ramp-level -> strobe -> beacon -> mode 1 -> mode 2 -> ...
When switching on, you start at the beginning of that list, but that's the memory (previously used) mode.
Mode 1 is omitted if the "memory" mode already was mode 1. (short-cycle memory)
If you select any mode and use it (>1s), and then switch the light off and on again, it'll be in the same mode (memory).
But when you switch to the "next" mode, instead of always advancing to the next mode in the mode order, it starts from the mode 1 again.
e.g. use mode 2 (>1s) -(tap)-> mode 2 (memory) (for <1s) -(tap)-> mode 1
In the above mode order list, modes 1-3 are user configurable, and their number is configurable, too.
Change a mode:
Add a mode:
Delete a mode:
Default modes: <1% - 4% - 20% - 100% - ramping - strobe - batt/beacon
Since you can't backup the original NANJG firmware (it's protected, you only get garbage if you try), you can't restore it's functionality if you flashed a new firmware to it. Here's a firmware that is somewhat similar (i.e. the mode group is selected by solder bridges between stars and the outer ring), but with more and different groups that seem to be needed more often (no blink modes).
It's levels are 5%-33%-100% and optionally a moon mode (a few milliamperes, depending on hardware variations like LED voltage).
|1||The 1st star is a dummy and not connected anyway.|
|2||3 modes L/M/H||4 modes, additional moon level|
|3||ascending mode order (moon/)L/M/H||descending mode order H/M/L(/moon)|
|4||classic memory||no memory|
Any combination is valid, so these are 8 groups in total and should meet most people's needs.
Example: Moon/Low/Mid/High, no memory: Solder stars 2 and 4 to ground (the outer ring).
It also has a PWM frequency of 18kHz, which is not visible and not audible (no whining noises).
Battery monitoring: Whenever the battery falls below 3V under load, brightness is reduced (about half).
Recommended fuses are low: 0x75, high: 0xFF.
Firmware download: nlite.hex, it's completely free (including commercial use). Please consider sending me a message if you use it commercially (i.e. sell drivers/dropins/lights etc); just for curiosity.
|20||turbo timer config mode|
moppydrv is like guppy2drv for momentary switches; like guppy2drv, it offers a lot of mode groups to choose from, trying to accomodate various needs and preferences. The basic UI is similar to mokkadrv (click-on, click-off), but you can choose to switch the light on with (tap) or without (press&hold) memory.
This firmware is intended for cycling, where you change modes more often than you switch the light off. Thus changing modes up or down is very easily accessible, while switching off takes relatively long to prevent accidental sudden darkness.
This UI was intended as a SImple UI for lights with a MOmentary switch, but I couldn't stop, so it is programmable again :) The idea behind the UI is to mimic classical clicky UIs which switch to next mode an a 'half-press' or 'tap', but switch on/off with a 'deep press' or 'click'. With this UI, a 'half-press' translates to a short press (or click), and a clicky's 'deep press'/'click' to a long press (press&hold for 0.5s). There's an additional feature though: By switching it on with a short or long press you can decide wether to have memory or not.
|when off||when on|
|short press||switch on with memory (last used mode)||switch to next mode|
|long press||switch on without memory (first mode)||switch off|
|double click||directly switch to high (100%)|
|triple click||directly switch to strobe|
|long hold (2s)||battery indicator|
This UI is similar to simodrv above, but the basic UI is different and somewhat more tactical and oriented more towards the needs of law enforcement. It is suitable when you need
|when off||when on|
|short press||switch on third mode (HIGH)||switch off|
|press&hold||switch on first mode (LOW), |
then slowly cycle through the modes (L-M-H-M-L-M-...)
|From whatever mode you are in, cycle through the modes.|
|long hold (8s)||battery indicator|
Note that it doesn't have memory. See new version below.
Programming: (same as simodrv)
|when off||when on|
|short press||switch on in last used mode (memory)||switch off|
|press&hold||switch on in LOW (1st mode), |
then cycle through the modes
|cycle through the modes.|
|double click||HIGH (3rd/4th mode)|
|long hold (8s)||battery indicator|
As default there are two 'standard' levels, 25% and 100%, and a short tap on the mode button switches between them.
Ramping: When you press the button a bit longer (>0.5s), it begins to ramp up (visually linear), starting from the brightness level you just were in.
If you release and press again (>0.5s) it ramps down instead, so it's quite easy to fine-adjust the brightness to your wishes;
if you want it just a tad brighter or less bright, you don't have to start over.
The end of the ramp is indicated by a short blink.
Extended modes: If you press the button even longer (>1s while already at the end), you get the extended modes, where strobe and beacon are. A short tap switches between the extended modes, a longer tap gets you back to standard mode.
If the main (power) button is a forward clicky, you have a momentary operation (signaling, 'tactical'), too.
If you want to drive multiple LEDs, a master-slave setup might be an option.
In such a setup, the PWM signal from the MCU on the master driver is connected to the slave board(s) which do not have an own MCU, they just hold more AMC7135 ICs.
The wiring is shown in the image; more slave boards can be easily added.
The slave boards do not need to have Batt+ or LED+ connected.