STAR Firmware by JonnyC - Source Code and Explanation

Thanks for the links. I thought I had seen those at some point but I couldn’t find them when I searched earlier today. It definitely answers my questions.

The measurements are being done at no load, so I initially used hkj’s lowest-amp discharge curve. His no-load data is better though. My readings get taken only a few seconds after the cell was last loaded, but it looks like the recovery curve is pretty steep.

If the curves were normalized so that they were all the same width, I’m basically looking for the average Y-axis values (voltage) which correspond to X-axis values (capacity) of 25, 50, and 75%.

The main difficulty I see is the high-amp cell curve vs the high-mAh cell discharge curve. High-amp has a well-defined “knee” around 3.55V while high-mAh cells seem to discharge more linearly (less-defined knee at 3.2V).

So, yes, the user will need to know what type of cell they’re using, in order to understand how low is “low”. At 3.7V (resting) a high-amp cell is almost empty, while a high-mAh cell still has about half of its power left.

In any case, the data we both found suggests that I should definitely raise the thresholds from 3.0/3.3/3.6/3.9/4.2 to something more like 3.3/3.6/3.8/4.0/4.2 if I want to accurately represent capacity (and the “recharge me please” value would be just one blink).

The thresholds under load are, of course, lower. I think I’ll stick with the 0.3V increments for that (for realtime indicator lights), since it means it will be green for most of its life and won’t go yellow/red until it’s genuinely low (or under very high load).

Sure thing. I think your thinking sounds pretty solid, but I’ll make one mild counterpoint. You indicated that the high capacity cells tend to lack that “knee”, but I think that’s actually just Panasonic’s cells: the NCR18650A, NCR18650B, and NCR18650BD. Most other cells of all types tend to have a knee I think.

Normalizing the graphs on the X-axis did not occur to me, that makes a lot more sense for comparison purposes.

Hey guys, i have downloaded johnnyc latest code from his signature and now it works accordingly. Thank you so much :bigsmile:

Awesome, thanks for making us aware of the issue!

I am trying out the Dual Switch version of the software and I get an error during the compile to hex:

“variable ‘modes’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’
line 115 column 18

Anyone know the issue?

IIRC syntax changed between versions of AVR Studio. What version do you have?

6.2 build 1502.

The actual line of code related to the error is: PROGMEM uint8_t modes = { MODES };

I also edited the line at the beginning of the program to change mode spacing: #define MODES 12,70,255

Right, the fix is in post #413 I think. STAR Firmware by JonnyC - Source Code and Explanation

Subsequent posts indicated that this fix worked.

Whoops, I'll fix that up. The Dual Switch is kind of the redheaded stepchild that doesn't get the attention that the other programs do. I actually haven't even used it yet other than in my test rig.

I just pushed the changes to Git.

Thanks a lot wight and JonnyC.

I am putting this driver in a Convoy L4. I sure am glad to use this firmware!

Funny thing is, I wrote this so that I could mod the S4 I bought a while back but never used. I still haven't modded it or used it :( It's an awesome light, but I'm so used to the overhand grip and being able to switch modes with just my thumb that a C8 is my go-to light.

Oops, I meant L4, not S4. :party: How would the momentary version of the firmware behave in the L4 I wonder?

Ha! I meant L4 too :)

Every time you turned off the light it would just default back to off, unless you set the lowest mode to something other than off then I'm pretty sure it would default back to that mode.

I haven’t seen this mentioned anywhere so I guess it’s a no brainer to connect the switch to ground? But do I wire star 4>switch>GND for the Dual Switch version?

Yes.

Dang wight. You fast. :bigsmile: Thanks again.

Edit: Anyone in the mood for a sandwich? :crown:

Everything worked well and looks fairly trim and proper. I don’t think it warrants its own thread, but what I did was remove all of the components from the stock driver contact board and then made the necessary connections for the switch and power. One leg of the switch is jumped to ground, the other leg is connected to a wire which wraps around the flat side of the board and makes its way up to star 4. I didn’t have any really tiny wire (or bother to use a single strand of copper) so Kapton tape was necessary to prevent the switch wire from shorting on the driver retaining ring after the driver was installed. The mode spacing I went with was 12,70,255. It isn’t night time yet but the spacing seems pretty good. I gas de-domed an XM-L2 U3 on a 16mm noctigon (didn’t have any 20mm ones) and bolted it up. The holes that the stock LED board mounting screws “thread into” are actually not threaded at all, but they are the perfect size for a 4-40 cut tap so I tapped them and used some 4-40 BHCS. 3/16” is a good length.

Now I just have to make the rifle mount. I’ll update this post when I’m done with it in a few hours.
————————————————-
Edit: There we go. Now off to the folks to see if it fits….


Edit: nope, I underestimated the size of the barrel. I’ll remake it with a hinge and a pull pin screw so the light can be removed instantly. My parents have too few lights to let it sit on the rifle unused so it should be removeable easily. Good point about the physical connection of the driver in this application wight; I hadn’t considered it much. Fortunately it is only a .22 and has virtually no recoil so I think the solder joint on either side of the switch housing will suffice in this instance.

No problem. Your work looks good. One thing to consider, especially for a rifle light IMO, is the physical connection between the two PCBs. It looks like your only rigid physical connection is the switch casing being soldered onto the GND ring of the driver. If that’s the case consider adding epoxy or something to stiffen up the bond. In fact, consider air-wiring that connection and then using epoxy/whatever to do the physical connection. Just my two cents!

Woah! Snazzy looking. :heart_eyes:

I realized that I’d spoken out of turn as soon as I saw your snazzy barrel-clamping mount made up for such a small barrel. I agree with you.