NarsilM - configurable e-switch firmware for Multi channels, v1.3

Release v1.3:

Here's the latest NarsilM v1.3 files: NarsilM v1.3

You will find a readme.txt file listing the .HEX pre-configured files there.

Please note v1.3 has no changes to the UI, therefore earlier manual revs still apply. Here's the revision history for v1.3:

Vers 1.3 2018-08-11:
- make SaveConfig() safer by disabling ints, ensure 0xff's get written in old position, using library routine first
eeprom writes and not using eeprom erase
- limit mode set choices to just those sets that are compiled in, if it's 12 or 8 sets for example

Vers 1.3 2018-07-29:
- added the TWOCHAN_3C_PINS option, so a standard TA triple board can be used in FET+1 mode (no 7135 bank needed)

Vers 1.3 2018-01-28:
- added support for TA's driver for the new Astrolux S42. It uses the single 7135 on pin #3 and the FET on pin#5, with the Indicator LED on pin #7.

Vers 1.3 2017-10-16:
tweaks made to battery voltage level readings:
- The single cell mode using the internal V ref and no resistors appears to be more accurate now, rounded to the blinked out value.
- for using R1/R2, it should also be more accurate now - still in testing

Prior Release v1.2:

Oct 16th, 2017:

Here's the latest NarsilM v1.2 files: NarsilM v1.2(link is external)

You will find a readme.txt file listing the .HEX pre-configured files there.

The tactical mode is now invoked only from ramping from a fast 5X click with the main LED(s) ON or OFF. It can only be disabled from a power cycle. It is very quick, very responsive, and very fast clicks can be used even for a manual strobe.

There's still no updated manual. I still consider it a BETA release for testing.

Please note v1.2 has no changes to the UI, therefore earlier manual revs still apply. Here's the revision history for v1.2:

Vers 1.2 2017-10-16
- changed momentary/tactical mode so fast clicks have no effect, and only way to exit is to power cycle

Vers 1.2 2017-10-15
- if strobes are disabled, a 2X click from 2X turbo should restore the previous level you were at
- BUG FIXED: 4X clicks in modes operation engages lockout - not supposed to
- operation change: make click&hold in MODES or STROBES wrap from 1st mode to last
- BUG FIXED: in LVP switch LED control: the LED sometimes is left on after an LVP drop, and is not
blinking the way it should be. The "bug" is that I'm trying to control the switch LEDs from
multiple places so it's getting turned off quickly after turned on, and left on when it should
be left off. It's a timing thing, so has sort of a random pattern - sometimes left on, sometimes
left off. The 8 sec LVP blink need to be qualified better, and should not be calling Setlevel()
as is because it wants to control the LED
- BUG FIXED: temp stepdown should not happen right away from turn ON. Delay it by 15 seconds
- BUG FIXED: for temperature stepdown, in moon mode, a temp stepdown is actually done because moon
mode is marked as special level 255, which is considered as a high level of output instead of very
low. The stepdown results in the light switching much brighter. This should only happen id the
temperature threshold is set to a low temp, or the light is still hot and not cooled down when moon
mode is chosen. It can also result in an immediate jump to the stepdown level as soon as the light
is turned on in moon mode. Might appear as a bright flash when ramping first starts.

Prior Release v1.0:

NarsilM is the latest version of Narsil supporting Multi channel output configurations. It supports 1, 2, or 3 output channels in specific configurations using an ATTiny85 MCU.

List of features

  • Ramping – smooth 150 level ramping, simple press&hold ramps, 1 click ON to last level, 1 click OFF, direction of ramping will toggle unless you hold to a level for about a second
  • Mode Sets – quick access to lowest and highest modes, 1 click OFF
  • 12 mode sets to choose from, 1 to 8 modes per set including optional moon mode
  • Moon mode (optional) level can be set, modes can be arranged for low to hi, or hi to low
  • Multiple strobe and beacon modes can be accessed, total of 5 special modes (18 Hz strobe, police strobe, bike strobe, 2 sec beacon, and 10 sec beacon), or can be disabled
  • Low Voltage Protection (LVP) – output is decreased starting at 3.0V, shut off at 2.8V, both with blink warnings
  • Timed or Thermal step down can be selected or disabled (works for high output levels in Ramping too)
  • When power is applied, 2 blinks indicate it’s ready
  • An Indicator LED (SMD LED) is supported as a locator LED and low voltage indicator
  • Battery, Temperature Check and firmware version # display – blinked out voltage, temperature in C, and # (ex: 3.7V would be 3 blinks, pause, then 7 blinks)
  • Lock-out feature for the side switch – enabled and disabled by a special click sequence
  • 20 second button press safety lock-out feature (engages lock-out after 20 secs being held)
  • the firmware version # can be blinked out
  • all configuration settings can be reset to the factory defaults
  • very low parasitic drain is supported with using power saving features and design, as low as 22 µA
  • large set of custom compile time settings are supported, documented in one separate header file
  • mode set and ramping tables are in separate header files, can be easily modified without knowing much in "code"

Where to get it

Link to the full available files for download: Google Drive Share for NarsilM

Direct link to the Atmel Studio 7.0 solution/project/source files/notes: NarsilM

Direct link to AVRDude cmds w/fuse settings, HEX file for (BLF Q8) build: NarsilM hex 2Chan Q8

NarsilM Reference Manual

Where to get compatible driver boards

There are several boards out there in a wide variety of sizes and form factors that can run NarsilM. Of course the primary requirement is e-switch support, plus it requires the Attiny85 MCU because of the code size. The I/O pins are a little flexible but still have specific requirements.

Lexel sales thread using TA boards:

Texas Avenger triple channel boards:

DEL two channel boards:

HarleyQuin BLF SRK board:

BLF Q8 SRK Driver, in OP:

The above board designs have the extra parts to properly support the ATtiny85, either the 85 full pad size or mounting via the bent pin method. The extra parts (from original Attiny13A designs) were all developed by DEL then adopted with help from DEL to other designed boards by Texas_Ace and HarleyQuin.

I've used both TA and DEL boards for various lights, and used the HQ BLF SRK board in my 37K lumens 16X XHP50 light running Narsil.

Tech Info

Here are the current code sizes for the provided configurations using ATMEL Studio 7.0.

** Atmel Studio 7.0 uses the Atmel AVR 8-bit GNU Toolchain ( supports all AVR 8-bit devices. The AVR 8-bit Toolchain is based on the free and open-source GCC compiler.

Some Notes

  1. This should be a stable version.
  2. Even though there's lots of flexibility and custom configuration capabilities, it cannot be the do all, end all of e-switch firmware. It's source code is included to allow anyone to change it as they like.
  3. Besides being used in the BLF Q8, it's being planned for use in the upcoming BLF GT and FW3A lights. The buck driver support has already been added and bench tested by DEL, so it is planned to be embedded in a future verison of NarsilM.
  4. I've implemented Narsil/NarislM in many different lights, small to large. I've run it on various driver boards, more recently from Texas Ace, DEL, and Harley Quin. They have the designs with the latest proper updates from DEL that support the Attiny85 working with 7135's and FET's.
  5. I'm hoping this thread can be used as the place for Q and A on NarsilM
  6. I'll be adding more specs/info on NarsilM over the next couple weeks


Thanks for posting Tom. :slight_smile:

Thanks Tom .

Tried NarsilM already , and i find it really useful the way it is , now that it is one version for all drivers

Speaking as the noob i am on matters like this i must say flashlights operating like this bother me a little, but then again it look like if you just put a little time into it you will be able to tweak it more or less to the way you like it. :sunglasses:

So right now my favorite are still the push & click wheel on my P 36, but i am eager to get my hands on the Q8 and narsil.
And my U 21 are also working for me, but i think it would take a little getting used to if it was a light i had to use often.

Guess you have to start somewhere, back in the day i also stayed with DOS until win 98se :laughing:

I also like the idea of tweakability. I can’t wait for my Q8 and FW3A.

Does 3 output channels mean that it s possible to control 3LED separately?
Also is possible too use 2switches like the NC EC21

Thank you.

In theory yes. You could use mode sets to select the channel, but the UI isn't designed for it.

Ok thanks and the double switch?
It’s just that I have that NC EC21 that I can’t get rid of so I’m thinking of modding it with another driver. I also find the red LED underpowered, not enough lumen to light the path you’re walking on. It’s only good for reading something upclose…. I ws hoping I could do it with one of the drivers Lexel is putting together with your firmware.

Double switch? 2 e-switches? If so, not enough I-O pins.

I think its electronic so nogo. Thanks for the reply and the hard work it s appreciated.

Thanks Tom!

There was an uunexpected bug found not so long ago that you were going to keep in the programming. Were you able to? And is it in the manual?

Uhh, maybe? Not sure. New manual is very brief. On the cell now.

Thanks…. looking forward to my Q8 and my drivers from lexel

Thank you very much, Tom E.
Now, what Google Translator …
Guide me and do not confuse me.

Thanks Tom. :+1:

Ah, a new version, so I should write a new cheat sheet.

Wasn’t there a feature if you switch to maximum brightness it does a quick ramp, to not stress the eyes?
A fade from on and a fade to off, like the olight S1R.


Minor updates to the reference manual now posted:

  • typo: clicks --> blinks
  • added the list of special (blinky) modes
  • added hidden/cheat method description to turn off the indicator LED

ttrev has the meld driver. It’s designed for multicolor lights but it can be used with a single white and has double e-switch support. The firmware has an option to run both a primary white and a secondary emitter/laser. I believe you could take advantage of the ec21 by adding a better red led or a laser like ttrev did to his. Check into it anyway as my information may not be spot on.