STAR Firmware by JonnyC - Source Code and Explanation

I haven’t tested it yet, but I think there are a few methods left to reduce power. A big one is to turn off the ADC in sleep mode, and basically turn off everything except WDT and/or pin change interrupt. This will require a bit of extra code on sleep and wake, to disable/re-enable things, but the longer standby time is probably worth it. I especially want to get power draw as low as possible for the “smart” tailcap mods, so it can be both fancy and efficient.

That’s the other thing on my list to try. :slight_smile:

In theory, the voltage divider values can be increased as long as their relative values are still proportional. Multiplying each by, say, 10X, should reduce standby current. I think. So instead of 19.1k and 4.7k, maybe 191k and 47k?

… and now I see Tom E already did both of these things, oops. I should read more before I respond. :slight_smile:

No prob! I’m a mess with this - I got things posted between 3-4 threads. Did a bit more testing, and it’s looking real good so far. Love the 0.016 mA draw from an 85. Only got bout 10 resistors with the 10X values, so I’ll be limited initially, but plan on updating a bunch of my e-switch lights running Narsil with the indicator LED’s. Modded Narsil this eve to have a quick way to toggle the locator LED functionality: quick click followed by click&hold, the let go as soon as the main LED goes OFF. Maybe sounds a little complicated but takes less than a 1/2 sec.

I just don’t think we gave e-switch support much attention, and that’s why these things haven’t been explored - one line of code cut parasitic drain by half, then the resistors cut it by 90%.

Anybody have a version of STAR offtime with strobe added? Or something comparable that works on standard 17DD hardware?

I got it for the 25 posted up on my google drive share w/mode changing that works like luxdrv (short cycle). Not sure if I got a version for the 13A, think I do, but not sure it’s posted - @work now so might not have access.

Thanks, been a change of direction though. I'm updating a light I built for somebody a long time ago and it had phase-correct luxdrv on it, no ramping mode, with strobe & battcheck. Turns out it's the strobe he doesn't use, and I guess hacking luxdrv's battcheck into STAR would be impractical. He's OK with the way it was before, I'll just give it a fast PWM version of luxdrv and call it done.

Ahh - luxdrv was my baseline driver code for years, tweaked to each individual's mode choices. I kind of abandoned it now in favor of STAR offtime, then tweaked my flavor of STAR offtime with some unique features, but then went on to the 25/45/85 stuff. Sorry - it's impossible for me to keep all these variations/tweaks in my head - my heads spinning from just typing bout it .

I have a version of STAR with a strobe I can link when I get home tonight, but is there a reason you don’t want to use TK’s blf-a6 firmware? It has strobe functionality built-in and you can just disable all of the other bells and whistles that you don’t want (that’s what I do)

The blf-a6/tk-otc.c code is made specifically for easy mods. It has the config mode stuff removed to make room for other changes, assuming that if you’re compiling it you probably don’t need runtime config options. Most things are easy to turn off or change if you don’t want them default. I don’t have one specifically configured as described though.

I would like to build a flashlight for general & bicycle use.
I am thinking for h-l-strobo.
Is it possible to add a slow strobo in Star firmware?

Hopefully a quick question.

I read the below wiki post on changing the PWM frequency.

Why would a frequency below 9kHz be desirable?

As I understand it, the setup around 9kHz generates the least PWM noise.

Any insights?

Boy, long time - no one asnwered. Yes, of course it's possible. I got more advanced versions, but based on STAR - got lots of blinkies as options.

No, think he means 9 kHz is too low, higher rates are desirable and possible. I use phase mode on the Tiny25 and Tiny85 at about 15.6 kHz, and I beleive my 13A code uses 18 .8 kHz in FAST mode.

Efficiency, lower and more stable moon mode.

High PWM frequency is OK for FET drivers. 7135 chips, on the other hand, are relatively slow and require a minimum PWM pulse width to fully turn on. This is why you may see discussions around using minimum 5-6/255 PWM duty cycle, and the sensitivity of this number related to the exact hardware in use (cell voltage, emitter type, driver, etc).

Against BLF wisdom I use 2.4 kHz PWM with FET+1 drivers. I do not PWM the FET though, only the 7135. No audible whine, and no visible (to me) PWM. Nice low moon mode. FET is used only for full-on turbo mode.

You could try 18.8 kHz PWM for the FET (MCU clock at 9.6 MHz, phase-correct PWM) and switch to a PWM divider of 8 (2.4 kHz PWM) when only the 7135 is in use. That should give the best of both worlds.

PWM frequency is something which depends a lot on personal taste.

Some people can’t stand anything in human hearing range, since the pulses make noise. So, nothing below 16kHz or 18kHz or whatever the top of their hearing provides.

Some people (like me) can’t stand anything with visible pulses, and sensitivity to that varies a lot per person. Like, I can see 8 kHz or slower PWM pretty easily, and anything under 2 kHz looks like a strobe light to me.

Some people prefer to focus on efficiency and stability instead, which slower pulses are better at. Slower pulses work on more hardware and provide more consistent output with higher efficiency. So, those are some pretty good reasons to slow it down as far as you can tolerate.

… and some people (mostly cheap light companies) just go for whatever is cheapest, which is usually super slow.

In general, the most useful range is from about 1 kHz to 20 kHz. Slower than that, and almost everyone can see the pulses. Faster than that, it loses more and more efficiency without any real benefit. I prefer the 16 to 20 kHz range.

Thanks everyone for the input.

Looking at the versions of this code I’m wondering if the Momentary version is intended to be used with a tactile switch (as opposed to clicky). The dev notes say it’s intended to be used with a “single momentary switch” but I’m not sure what that actually is.

Maybe I’m dreaming but I’m hoping I can find a tactile switch mounted to a 17mm or 20mm PCB to use with this firmware and a 105c.

Thoughts?

Thanks in advance.

"single Momentary switch" means electronic switch - wired up to a pin of the MCU, for how they use the wording. A tactile switch is still a power switch, just like a clicky.

If you have a flashlight that is an e-switch with a driver mounted switch, our standard way of mod upgrading is to piggyback on a driver with true e-switch support. We usually use pin #2 of the MCU as the switch input, instead of the OTC, and figure out a way to wire up a jumper from the driver mounted switch. Also we usually strip off all parts, accept the switch, from the stock driver. I've ton a ton of them, many different types and sizes.

If you want to convert an e-switch to a tactile switch, oh boy... Dunno - the mounting and supporting the deeper throw of a mechanical switch may be a challenge, but probably has been done and posted about somewhere...

My attempt to search out an e-switch has been hindered by the fact that E-switch is also a company.

Here’s what I’m after: the ability to use a tactile switch with a 105C running the STAR firmware. The physical nature of it I can handle by machining something in a pinch, it’s the firmware aspect that I’m trying to get a handle on.

I was under the impression (based on who knows what) that this would require a MCU different than the ATTiny13a. I thought a clicky switch operated differently then a tactile switch in that a clicky physically opens and closes the circuit where as a tactile would “tell” the driver to turn on, off, etc.

Is it possible to use STAR, a 105c, and a tactile switch together?