Overview

clicky

lucidrv
lupodrv
guppydrv
guppy2drv
luxdrv04
NLITE

momentary

lumodrv
mobydrv
simodrv
mokkadrv
moppydrv
lumo35drv

custom PCB

RGBW
H17F/lucid2

DrJones' Custom Firmware Drivers

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.

Here's a list of my firmwares:

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.

lucidrv

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:

Battery monitoring: 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.
PWM frequency is 18 kHz.
Note: The brightness ramp hast 16 steps, from #16(100%) downwards the output halves every 2 steps. The lowest modes however deviate from that due to limited PWM resolution, also the actual output on the lowest modes depends on hardware variations like 7135 internal capacitance and LED forward voltage.
The levels (in %) are:   ~.2   .7   1   1.5   2   3   4   6   9   13   18   25   35   50   70   100

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

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.

lupodrv

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.

Battery monitoring: 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.
PWM frequency is 9 kHz.

guppy2drv

#modesmemory
1 5-33-100memory
2moon-5-33-100memory
3100-33-5memory
4100-33-5-moonmemory
55-33-100-strobe-beaconno-memory
6moon-5-33-100-strobe-beaconno-memory
7100-33-5-moon-strobe-beaconno-memory
825-100no-memory
9100single mode
10100-strobeno-memory
12turbo timer config mode
Standard mode list

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

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:

  1. <1% - 4% - 20% - 100% - ramping - strobe - beacon;   short-cycle memory
  2. 100%;   single mode
  3. 25% - 100%;   normal memory
  4. ramping - 25% - 100%;   short-cycle memory

luxdrv 0.4

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:

  1. Select one of these modes as made to be reprogrammed and use it for >1s (mode lock time),
  2. quickly tap button 15 times (without locking a mode, i.e. max 1s between taps),
  3. continue tapping until you reach ramping (or whatever else mode you want),
  4. use that new mode for at least 4s (!) --> stored.
Unfortunately there's no feedback (I didn't have program space left for that).
Note that the lock time is increased to 3s while programming for a more relaxed procedure.
Note that you have to find the desired mode/level within another 14 taps, or else you'd delete a mode (see below). Shouldn't be a problem with the longer lock time though.

Add a mode:

  1. Switch to any non-programmable mode (a ramped level or any mode behind it) and use it for >1s (mode lock),
  2. quickly tap the button >30 times (without locking a mode),
--> an additional mode is added after the other programmable modes (before ramping), and you can now program that new mode like above from step 3.
You can have up to 6 programmable modes.

Delete a mode:

  1. Select any programmable mode (before ramping) and lock it (use >1s),
  2. quickly tap >30 times,
--> the last programmable mode (the one directly before ramping) is removed.
(You can't delete a mode from the middle of the programmable ones, because again I didn't have program space left for that.)
You can even delete all programmable modes, then the 1st mode is ramping. That's actually an interesting setting, too.

Default modes: <1% - 4% - 20% - 100% - ramping - strobe - batt/beacon

NLITE

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).

staropenclosed (soldered)
1The 1st star is a dummy and not connected anyway.
23 modes L/M/H4 modes, additional moon level
3ascending mode order (moon/)L/M/Hdescending mode order H/M/L(/moon)
4classic memoryno 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.

moppydrv (electronic switch)

#modesdouble-click
15-33-100100
25-33-100strobe
3100-33-5strobe
4moon-5-33-100100
5moon-5-33-100strobe
6100-33-5-moonstrobe
730-100100
8100100
9100strobe
10moon-5-33100
11moon-2-15-50100
12moon-2-5-15-50-100strobe
13100-50-15-5-2-moonstrobe
14moon-5-33-100-blink1Hz-blink3Hzstrobe
155-33-100-blink1Hz-blink3Hz-beaconstrobe
20turbo timer config mode
Standard mode list

wiring information

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.

lumodrv (electronic switch)


wiring information
User interface:

setup in a SmallSun ZY-T29
There are a couple of ways to start the light in the mode you want:
  1. short click (tap): use previous mode
  2. long press: start ramping up
  3. double-/triple-/quad-/quintuple-click: whatever is configured

Default settings:

New version 1.1 (applies to drivers sent since September 2013)

The new version allows to permanently store a changed mode configuration: Note: The number of modes can not be changed.
Warning: You can overwrite a special mode (strobe/beacon) with a different setting; once you make that change permanent, that special mode is lost forever!

mobydrv (electronic switch)


wiring information

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.

Features:

User interface:

mobydrv/Q variant (electronic switch)

This is is a variant of mobydrv that allows switching the light off much more quickly and thus is better suited for flashlight use. It also uses 16 brightness levels instead of 12, the same as lucidrv (more modes in the lower end).

simodrv (electronic switch)


wiring information

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 offwhen on
short pressswitch on with memory (last used mode)switch to next mode
long pressswitch on without memory (first mode) switch off
double clickdirectly switch to high (100%)
triple clickdirectly switch to strobe
long hold (2s)battery indicator

Programming:

Further features:

mokkadrv (electronic switch)


wiring information

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

The brightness levels are adjustable ('programmable').

when offwhen on
short pressswitch on third mode (HIGH)switch off
press&holdswitch 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.
double clickstrobe
long hold (8s)battery indicator

Note that it doesn't have memory. See new version below.

Programming: (same as simodrv)

Further features:

New version since 2015

when offwhen on
short pressswitch on in last used mode (memory)switch off
press&holdswitch on in LOW (1st mode),
then cycle through the modes
cycle through the modes.
double clickHIGH (3rd/4th mode)
triple clickstrobe
long hold (8s)battery indicator
UI with memory option (star 2)

lumo35drv (dual switch)


wiring information

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.

Master-slave setup


master-slave wiring

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.


© DrJones (2013++)