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

NarsilM V1.0,Ramping TEST

Chinese:

How do I need to modify the channel.h to get FET+1 on the Triple channel board

so that indicator LED is on Pin 7 and the FET on Pin 3

just the 7135*8 pin unused

I could do it electrically, but I dont understand the code in that file

Well, combo of Setups.h, RegisterSettings.h., and maybe Channels.h.

I'd set OUT_CHANNEL to 2, then edit up the RegisterSetting.h to match up signals to pins. Not sure how further to go, that might be enough, but I'd have to carefully review the ATMEL specs to be sure that all works out. Might have to do some mods to functions in Channels.h.

Certainly ramping and mode sets should work out as-is with the OUT_CHANNEL of 2 setting.

Ooops, probably definite you have to change the initialization code right in the beginning of main(). Critical initialization of ports for I/O and PWM's is there.

I dont understand how to do that

Ok, find this code in main:

  #if OUT_CHANNELS == 3    // Triple Channel
   // Second PWM counter is ... weird (straight from bistro-tripledown.c)
   TCCR1 = _BV (CS10);
   GTCCR = _BV (COM1B1) | _BV (PWM1B);
   OCR1C = 255;  // Set ceiling value to maximum
  #endif

Comment out the #if and #endif, so the code is executed. That looks like the only change you need to make in main(). This enables PWM on pin #3 I believe, which you need.

A quick question about the protection circuits.

At low voltage I believe it blinks 3 times then reduces output. In ramping, can you press the button to return to the previous level or will it just turn off?

What happens when thermal protection activates? Any blinks or just a reduction in output? Can a single button press bump it back up or will it just turn off?

My batteries were low and it blinked 3 times then reduced power. I clicked the button once and it went back up in power. I tried to video it, but I never could get it to repeat what it did earlier. It just turned off. So I’m confused.

As I know:
Low Voltage Protection (LVP) Output decreasing from 3.0V on.
Main LED: 3x blinks as indication
Indicator LED: every 8 sec

Shut off at 2.8 V
Main LED: 8x blinks as indication and shut off

You should at least remove the cells to prevent any more drainage! Otherwise your batteries can be damaged.

Taken from the Cheat Sheet for NarsilM v1.0 / BLF Q8

At thermal it should only step back without blinkies

Yes, when the LVP warning level has been reached, it will blink 3 times at moderate speed, and output is reduced. If the critical level for LVP is reached when the output can't be reduced any longer, it will blink 8 times quickly and shut off the light, and then continue to run for 6 minutes, blinking the switch LED twice every 8 seconds.

In ramping, the output is reduced by 20% of the ramping level each time.

In mode set operation, it's reduced by 1 mode.

So for ramping, if it's at the max level of 150:

  • first drop would be to level 120
  • 2nd drop to level 96
  • 3rd drop to level 76
  • 4th drop to level 60
  • 5th drop to level 48
  • 6th drop to level 38
  • 7th drop to level 30
  • 8th drop to level 24
  • 9th drop to level 19
  • 10th drop to level 15
  • 11th drop to level 12
  • for the 12th drop when it gets below 10, it's dropped to level 1

So in ramping or modes sets, if it reaches the lowest output (level 1 or mode #1), then it monitors the battery for dropping below the critical level.

I don't see anything in the firmware that would allow you to return to the previous output level by a single click. Maybe this was discussed at some point but it's not how it ever worked in Narsil or NarsilM.

I do see a problem though with having to go thru 12 steps at a minimum of ~ 5 seconds each. Here's a breakdown of using other percentage drops:

25%: 150 -> 112 -> 84 -> 63 -> 47 -> 35 -> 26 -> 19 -> 14 -> 10.5 -> 1 (10 drops)

30%: 150 -> 105 -> 73 -> 51 -> 35 -> 24 -> 16 -> 11 -> 1 (8 drops)

32%: 150 -> 102 -> 69 -> 46 -> 31 -> 21 -> 14 -> 1 (7 drops)

35%: 150 -> 97 -> 63 -> 40 -> 26 -> 16 -> 10 -> 1 (7 drops)

36%: 150 -> 96 -> 61 -> 39 -> 24 -> 15 -> 1 (6 drops)

For the next version of NarsilM, I'd feel better going with 6 drops from max, using 36%.

Okay, so it was definitely the LVP kicking in. Maybe I pressed the button just a tiny bit too long and it got brighter. Maybe I just thought it got brighter. My NarsilM driver is acting a bit funky in other ways, so it might have been a fluke. IDK, I can’t repeat it.

Thanks for the clarification.

What? double blink every 8sec?

So I should change

to

Edit: or blinks the main LED?

You could. I'm incorporating all the LVP details into a "Advanced Notes and Usage" manual. Working on it now. Basically I want something available in greater detail, we can refer people to when they have some in depth tech questions.

Tom, is it okay to dump a problem here?

I’ve got a TA FET driver built by Lexel with NarsilM that has some problems only in the mode sets area and Lexel thinks it might be in the programming. This is a 2S driver.

Dang, lost my typed response...

There's no 2X, 3X, 4X fast clicks in mode set operation. It's described in the manual, in the OP link. Fast clicks would cause countless # of inadvertent actions in mode set operation -- the two methods don't get along.

Mode memory in mode set operations is "Not Recommended". I used to say that explicitly in the manual. I should have taken out that feature, really. It doesn't work well.

What you are seeing, I think, is the lock-in time. You must be in a mode a min length of time in order for it to be saved. If you don't hold in a mode long enough, it won't be remembered.

Hi Tom,

I'm about to try to stuff a filed down TA board into an olight S15. It fits but only single sided. So with the 3 channel TA board running as a 2 channel FET+1 will the 3channel setup.h work or do I need to eliminate the bank 7135s?

Could I just reassign the pwm pins in the 2channel setup to work with the TA layout?

Way back I asked TA if he could change the 3 channel mapping to I/O pins to match up to a 2 standard channel FET+1, but it didn't happen. If he would have put the FET on pin #6 and the 7135 bank on pin #3, it would have been no problem.

So for what you got, pin #5 is the single 7135, pin #3 is the FET, I believe... I think this is the same thing Lexel asked just up above?

Even in my small OTF M3 16340 light, I was able to use a TA 15 mm board, using 3 7135's in the bank, but kept the original driver as a contact board, and mounted a filed down TA 15 mm slanted, at a angle.

I haven't tried doing what you are asking, and it's certainly possible with a little tweaking. It would be much easier now in NarsilM, since NarsilM has much more flexibility from the prior Narsil versions. I don't think Lexel knows code/programming enough to make and test the changes, though he knows a lot about the MCU and hardware designs, etc. I didn't hear back from him bout what I posted above, so I guess it didn't work out.

Boy, I could get this working, and I'm sure it will help out more than just you, and I can even find usage for it, I'm sure. Problem is time, with so much going on right now with the Q8 and GT projects, plus other stuff on very limited time availability.

How about if my next weekend, I can get to this, maybe have a tested solution. Do you have the capability to re-program the board, download a HEX file?

Hey Tom I just realized I never checked back in after this bit of advice. Just wanted to say that changing R1/R2 to these values (or very close, my set didn’t have exact matches) seems to have fixed mine right up. Works great now. Thanks again for all your help.

Cool! Glad to hear!!

Okay, so when in mode sets you loose instant turbo (2x), batt check (3x), lock out (4x) and all strobes/beacons etc…(2×2)?

That is a big loss, I didn’t know that.

And you say it’s normal for mode set memory to be glitchy as well? Momma mia! Lol

Do you have any idea why in mode 8 I only have 2 of the 3 levels or why I have to press the side button several times just to get the light to turn on?

No, did you read the manual? Tells you how to access all that stuff in mode set operation - I ain't repeating it here

Ohh - the mode set #8 problem... I can't see any problem there, least in the code. I'll test it on a Q8 proto I have here w/NarsilM later, though it's not the same options you have, Q8 is 1S, not 2S. I don't have a NarsilM v1.0 2S light with me at work.

For the issue of several clicks to turn the light on, I dunno. I have to re-read your description.

Are you certain it's NarsilM v1.0 you are running, that Lexel setup for you? I'm confused about all this...

Edit: Ooops!!

Ok, I see the problem with mode set #8: a 3 channel configuration uses a different set of modes. Only 8 sets of modes are defined, not 12, and mode set #8 should be 2 modes only:

  1. max of all 7135's (single and bank channels)
  2. Max FET

So what you are seeing is correct for what it's defined as. I never got around to filling up all compatible 12 sets of modes for triple channel configurations. I'll need to document it this way some where. I'll update the OP for now to mention it.

Also, to explain the modes:

  • mode percentages are roughly based on 1,500 lumens being 100%, typical XM-L2 type of LED, near full battery, moderate resistance reductions
  • The single 7135 is assumed to be 150 lumens which is 10%
  • if I rated a mode at like 40%, I was assuming 30% of the FET is used, and the 7135 at max (30% + 10% is 40%)
  • 2S setups are roughly double that. For example on my MT03 running 2S and triple XHP70.2's, one 7135 at max is about 320 lumens. A single XHP70 should be roughly 300 lumens.
  • of course the modes will work with any LED compatible to the driver, so an XP-E2 for example might max out at 600 lumens on the full FET, while a 4X XP-L2 SRK is ~6,000 lumens max, so the percentages kind of lose their meaning. This is the problem of rating output percentages based on 1 or 2 channels that are fixed in amps, and another channel that is basically wide open, where output depends on LED's, batteries, driver, and resistance in the full circuit.

Manual? I don’t need no stinkin manual. Lol jk

Okay, so I see that in mode sets you can still access batt check and lock out, but the procedure is different. (I can’t get strobes, but I may have strobes turned off)

Wow, it’s like 2 completely different firmwares loaded onto the same chip.

How are things looking for the Q8? Are the mode sets working well and spaced evenly? They are not spaced evenly on my 7k+ lumen light. That’s okay though. I plan to make a user video then go back to ramping mode. I like it a lot more.