STAR Firmware by JonnyC - Source Code and Explanation

1335 posts / 0 new
Last post
zeremefico
zeremefico's picture
Offline
Last seen: 3 hours 22 min ago
Joined: 03/27/2012 - 02:44
Posts: 1389
Location: Greece

Microa wrote:
May I ask how to supply power to the MCU of your driver?

With 8.4v using ZY-T13 driver as contact board.
Thank you for your help with the voltage!!!

₪₪₪₪ ΟΥΔΕΝ ΚΡΥΠΤΟΝ ΥΠΟ ΤΟΝ ΗΛΙΟ ₪₪₪₪

My YouTube channel

Flashlights & edc gear

K40M F16

zeremefico
zeremefico's picture
Offline
Last seen: 3 hours 22 min ago
Joined: 03/27/2012 - 02:44
Posts: 1389
Location: Greece

Do you guys believe 5.6v & 8.4v is the low voltage limit for 2 & 3s cells?

₪₪₪₪ ΟΥΔΕΝ ΚΡΥΠΤΟΝ ΥΠΟ ΤΟΝ ΗΛΙΟ ₪₪₪₪

My YouTube channel

Flashlights & edc gear

K40M F16

Crux
Crux's picture
Offline
Last seen: 1 day 5 hours ago
Joined: 05/03/2011 - 16:27
Posts: 227
Location: Northcoast, Ohio, USA

zeremefico wrote:
Do you guys believe 5.6v & 8.4v is the low voltage limit for 2 & 3s cells?

You need to be careful here, because you aren't monitoring each cell individually. You need to account for the very real possibility of one cell dying before the other. If you assume that the typical cell voltage to be 3.7V and the lowest you want a cell to go is 2.8V then perhaps 6.5V might be the cutoff for two cells and 10.2V for three. Of course you can always plug in different numbers and recalculate.  I can't say those are good values or not, and certainly not in all situations.  I just think it is best to error on the high side; leave a little juice in the cells rather than risk damaging them, or worse, damaging yourself (or the trusting soul that is holding the light for you).

As was stated, always use identical cells in series and/or parallel arrangements.

pilotdog68
pilotdog68's picture
Offline
Last seen: 5 months 5 days ago
Joined: 05/30/2013 - 23:31
Posts: 6422
Location: Held against my will in IOWA, USA

So let’s say I want my cut-off voltage to be 6.2v. If I use a 22kohm resistor for R1, a 2.2kohm for R2 should get me in the right vicinity, correct? Close enough that I can then use TK’s battcheck to get the exact ADC values I need?

(Using the calculator that wight linked in a different thread)

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

Mitko
Mitko's picture
Offline
Last seen: 9 months 1 week ago
Joined: 09/19/2014 - 05:20
Posts: 1537
Location: Bulgaria

Is there 1 mode-100% ( or star choosable 1 mode) 105c firmware awailable guys? Currently i am bypassing the atttiny13 in order to achieve this :~

Mike C
Mike C's picture
Offline
Last seen: 1 week 18 hours ago
Joined: 01/22/2014 - 08:03
Posts: 2578
Location: Sweden

pilotdog68 wrote:
So let’s say I want my cut-off voltage to be 6.2v. If I use a 22kohm resistor for R1, a 2.2kohm for R2 should get me in the right vicinity, correct? Close enough that I can then use TK’s battcheck to get the exact ADC values I need?

(Using the calculator that wight linked in a different thread)


For 2S cell configuration I’ve been using 47.7K and as R1 with 4.7K as R2, but I would have no issues with trying your values, they should work.
Mike C
Mike C's picture
Offline
Last seen: 1 week 18 hours ago
Joined: 01/22/2014 - 08:03
Posts: 2578
Location: Sweden

Mitko wrote:
Is there 1 mode-100% ( or star choosable 1 mode) 105c firmware awailable guys? Currently i am bypassing the atttiny13 in order to achieve this :~

Not to my knowledge. Star would have to be re-written a little, as with 1 mode there is no mode to step down to on low voltage. Ask here, it’s a more general firmware thread: http://budgetlightforum.com/node/38364
ToyKeeper
ToyKeeper's picture
Offline
Last seen: 2 hours 16 min ago
Joined: 01/12/2013 - 14:40
Posts: 10743
Location: (469219) 2016 HO3

FWIW, I added a STAR_1mode firmware to my repository since the changes needed to do this turned out to be non-trivial.

I’m not sure it should really be called STAR though (even though it’s 95% the same code), since it doesn’t use the stars any more. With only one mode there’s no point checking the stars.

guardior
Offline
Last seen: 1 year 9 months ago
Joined: 04/06/2015 - 14:06
Posts: 132
Location: Sweden

I’d rather order from Fasttech but they don’t seem to stock the clip but from what I understand this stuff from dx.com should do the trick?

Clip: http://www.dx.com/p/sop8-abs-test-clip-black-343981
Programmer: http://www.dx.com/p/usbasp-usbisp-downloader-programmer-for-51-avr-blue-...
Wires: http://www.dx.com/p/diy-10cm-20-pack-female-to-female-dupont-line-wire-m...

And I’m rather using Linux but Avrdude seems to be working fine there. Compiling binaries should work in Linux too with some manual work, needing the avr-gcc toolchain. I’m mostly looking for a three mode driver, Lo-Hi-Strobe, so it’s probably already available in one of JonnyC’ or DrJones’ firmwares. I’d rather get rid of PWM completely, just run on 8×7135 for Hi and 1×7135 for Lo, but dunno if that’s possible without hardware tweaks?

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 2 hours 16 min ago
Joined: 01/12/2013 - 14:40
Posts: 10743
Location: (469219) 2016 HO3

guardior wrote:
… from what I understand this stuff from dx.com should do the trick?

And I’m rather using Linux but Avrdude seems to be working fine there. Compiling binaries should work in Linux too with some manual work, needing the avr-gcc toolchain. I’m mostly looking for a three mode driver, Lo-Hi-Strobe, so it’s probably already available in one of JonnyC’ or DrJones’ firmwares. I’d rather get rid of PWM completely, just run on 8×7135 for Hi and 1×7135 for Lo, but dunno if that’s possible without hardware tweaks?


I haven’t tried any of the flashing tools from DX; not totally sure if it works or not. Could you let us know your results?

All the tools work fine in Linux, and pre-built packages are available at least in Debian and Ubuntu.

For 1×7135 and 8×7135, you’ll need a driver with dual PWM, such as one of wight’s designs or the “moonlight special” from RMM. The only free firmwares which support both dual PWM and strobe are “starry-offtime” and “blf-a6”, found in my code repo linked below. However, almost nobody can see the difference between fast PWM and actual current control, so the dual PWM requirement is probably not really necessary.

guardior
Offline
Last seen: 1 year 9 months ago
Joined: 04/06/2015 - 14:06
Posts: 132
Location: Sweden

ToyKeeper wrote:
I haven’t tried any of the flashing tools from DX; not totally sure if it works or not. Could you let us know your results?
Do you think those three items above will work? If so I’ll order them. And yes I promise that I’ll let you know if they work, or not Smile
ToyKeeper wrote:
All the tools work fine in Linux, and pre-built packages are available at least in Debian and Ubuntu.
That sounds great. Will just have to look up a good tutorial then.
ToyKeeper wrote:
For 1×7135 and 8×7135, you’ll need a driver with dual PWM, such as one of wight’s designs or the “moonlight special” from RMM. The only free firmwares which support both dualPWM and strobe are “starry-offtime” and “blf-a6”, found in my code repo linked below. However, almost nobody can see the difference between fast pwm and actual current control, so the dual PWM requirement is probably not really necessary.
That was my hope too. Just a stock 105c/105d with custom firmware with fast pwm will be good enough for most people. Also I think the mtn dd+7135 should be able to run without pwm with custom firmware, running Lo on the 7135.
ToyKeeper
ToyKeeper's picture
Offline
Last seen: 2 hours 16 min ago
Joined: 01/12/2013 - 14:40
Posts: 10743
Location: (469219) 2016 HO3

guardior wrote:
Do you think those three items above will work? If so I’ll order them.

I think so, but I’m not sure about the clip size. Usually it’s called a SOIC8 clip.

guardior wrote:
That sounds great. Will just have to look up a good tutorial then.

The README in my firmware repo has information about installing/using tools in Ubuntu or Windows, links to the hardware I use, plus links to other guides including other hardware people have used:
http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/view/he...

guardior wrote:
That was my hope too. Just a stock 105c/105d with custom firmware with fast pwm will be good enough for most people. Also I think the mtn dd+7135 should be able to run without pwm with custom firmware, running Lo on the 7135.

Yes, the DD+7135 drivers will work too, but I thought you wanted to stick with 7135s. Smile

However, a single 7135 running at 100% is not what I would call a “low” mode. It should do about 100 to 150 lumens in that mode.

In any case, a regular nanjg works fine as long as you don’t mind being limited to 2.8A. It also has no offtime capacitor, but that’s not really an issue if you use memory decay to distinguish short vs long taps, add a capacitor yourself, or use an ontime-based firmware.

guardior
Offline
Last seen: 1 year 9 months ago
Joined: 04/06/2015 - 14:06
Posts: 132
Location: Sweden

ToyKeeper wrote:
I think so, but I’m not sure about the clip size. Usually it’s called a SOIC8 clip.
Yeah I wasn’t sure about the clip either. But I managed to find this: http://en.wikipedia.org/wiki/List_of_electronics_package_dimensions

So hopefully sop8 and soic8 are the same thing. Smile I’ll order and see what happens.

ToyKeeper wrote:
Yes, the DD+7135 drivers will work too, but I thought you wanted to stick with 7135s. Smile

However, a single 7135 running at 100% is not what I would call a “low” mode. It should do about 100 to 150 lumens in that mode.

In any case, a regular nanjg works fine as long as you don’t mind being limited to 2.8A. It also has no offtime capacitor, but that’s not really an issue if you use memory decay to distinguish short vs long taps, add a capacitor yourself, or use an ontime-based firmware.

I’m only using P60 hosts right now so yes I do want to stay away from DD. One 7135 would be a perfect Lo mode for me. Also this driver from Fasttech seems pretty good but it doesn’t got a flashable ic, at least not that you can connect to within reason.
https://www.fasttech.com/products/1612/10001997/1143103-1-lithium-2-grou...

It could possibly be hidden like a friggin hamburger. Smile I think I’ll better stick to 105c/d for now.

Edit: And thanks for helping a newbie out. Smile

vestureofblood
vestureofblood's picture
Offline
Last seen: 3 days 9 hours ago
Joined: 08/17/2012 - 15:21
Posts: 1987
Location: Missouri

Hey all,

I was just wandering if anyone happens to have a version of this or some other OS firmware that is a just a traditional    L, M, H,  Strobe, SOS, with memory?

In Him (Jesus Christ) was life; and the life was the light of men. And the light shineth in darkness; and the darkness comprehended it not.
http://asflashlights.com/ Everyday Carry Flashlights, plus Upgrades for Maglite.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 2 hours 16 min ago
Joined: 01/12/2013 - 14:40
Posts: 10743
Location: (469219) 2016 HO3

I think you could probably configure the’s TheStar firmware to do L/M/H/Strobe/SOS with memory, in such a way that the blinkies are hidden. It’s more complicated than that by default though.

_the_
_the_'s picture
Offline
Last seen: 3 weeks 3 days ago
Joined: 07/08/2011 - 06:22
Posts: 3646
Location: Finland

Easy. Just replace the mode definitions in TheStar code with the following:


Three modes with hidden Strobe and SOS wrote:

// Basic modes

#define N_BASIC_MODES 3

#define MODE_LOW, MODE_MED, MODE_TURBO

 

// Hidden modes

#define N_HIDDEN_MODES 2

#define HIDDEN_MODES MODE_STROBE, MODE_SOS


Three modes, Strobe and SOS in same sequence wrote:

// Basic modes

#define N_BASIC_MODES 5

#define MODE_LOW, MODE_MED, MODE_TURBO, MODE_STROBE, MODE_SOS

 

// Hidden modes

#define N_HIDDEN_MODES 0

#define HIDDEN_MODES

=the=

 

vestureofblood
vestureofblood's picture
Offline
Last seen: 3 days 9 hours ago
Joined: 08/17/2012 - 15:21
Posts: 1987
Location: Missouri

_the_ wrote:

Easy. Just replace the mode definitions in TheStar code with the following:


Three modes with hidden Strobe and SOS wrote:

// Basic modes

#define N_BASIC_MODES 3

#define MODE_LOW, MODE_MED, MODE_TURBO

 

// Hidden modes

#define N_HIDDEN_MODES 2

#define HIDDEN_MODES MODE_STROBE, MODE_SOS


Three modes, Strobe and SOS in same sequence wrote:

// Basic modes

#define N_BASIC_MODES 5

#define MODE_LOW, MODE_MED, MODE_TURBO, MODE_STROBE, MODE_SOS

 

// Hidden modes

#define N_HIDDEN_MODES 0

#define HIDDEN_MODES




Thanks _the_ I appreciate it.    Would you possibly be willing to do me one more favor?      I have tried and tried to get these files to work and so far had no luck generating any working code, and have not even succeeded at converting a working file to a hex.  

Could you possible send me a hex with the second option where its low, med, high, strobe, SOS, with memory in one sequence?   No hidden stuff.     

If its is something that take much time I would compensate you.

Thanks either way.


In Him (Jesus Christ) was life; and the life was the light of men. And the light shineth in darkness; and the darkness comprehended it not.
http://asflashlights.com/ Everyday Carry Flashlights, plus Upgrades for Maglite.

_the_
_the_'s picture
Offline
Last seen: 3 weeks 3 days ago
Joined: 07/08/2011 - 06:22
Posts: 3646
Location: Finland

vestureofblood wrote:

Thanks _the_ I appreciate it.    Would you possibly be willing to do me one more favor?      I have tried and tried to get these files to work and so far had no luck generating any working code, and have not even succeeded at converting a working file to a hex.   


Could you possible send me a hex with the second option where its low, med, high, strobe, SOS, with memory in one sequence?   No hidden stuff.     

No problem. Please PM me your email address and I'll compile the hex and send it to you.

What kind of mode percentages do you want for L->M->H? Do you want a full 100% high without turbo timer? Any other "annoying" features you would like me to strip away before compiling it?

On- or off-time memory?

..and please try also the one with hidden goodies.. Who knows, you might even like it. Smile

=the=

 

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 2 hours 16 min ago
Joined: 01/12/2013 - 14:40
Posts: 10743
Location: (469219) 2016 HO3

the wrote:
..and please try also the one with hidden goodies.. Who knows, you might even like it. Smile

Yeah, I kind of assumed the blinkies would need to be hidden. I don’t think I’ve ever heard anyone request non-hidden blinkies before. TheStar has a nice way of keeping those out of the main sequence without disabling memory.
vestureofblood
vestureofblood's picture
Offline
Last seen: 3 days 9 hours ago
Joined: 08/17/2012 - 15:21
Posts: 1987
Location: Missouri

That is fantastic, thank you so much!!!     I will PM my info.     This driver is not for me it was a request I had from someone else.    I will message him and ask if he would like the blinkies to be hidden.


If the strobe and SOS were hidden how would they be accessed?

In Him (Jesus Christ) was life; and the life was the light of men. And the light shineth in darkness; and the darkness comprehended it not.
http://asflashlights.com/ Everyday Carry Flashlights, plus Upgrades for Maglite.

_the_
_the_'s picture
Offline
Last seen: 3 weeks 3 days ago
Joined: 07/08/2011 - 06:22
Posts: 3646
Location: Finland

vestureofblood wrote:

If the strobe and SOS were hidden how would they be accessed?

By looping through the basic modes twice (in a row, without pauses).

=the=

 

Jaimelito
Offline
Last seen: 2 years 10 months ago
Joined: 05/06/2015 - 10:08
Posts: 26
Location: Jerez de la Frontera, SPAIN

Hi, i’m a regular reader but is my first post in BLF.

I’m trying to make a variant of your firmware but with a lock mode.

From off: 1 extra long press of switch (i.e.10 seg) locked, and only with another 10 seg can unlock

Anybody can help me with the code. I don’t know C but try and error can modify the original code like this:

From off:
  • 1 long press 100%
  • 1 short press cycle L to H (without 0%)
From on:
  • 1 long press 0%
  • 1 short press cycle L to H (without 0%)

Thanks in advance.

Jaime.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 2 hours 16 min ago
Joined: 01/12/2013 - 14:40
Posts: 10743
Location: (469219) 2016 HO3

Are you using a light with an e-switch?

If so, you might find ToyKeeper/Baton.c useful as a starting point, since it already implements a lock mode toggled by a long long press from off. However, it uses long press while on to advance modes, and short press turns the light on or off in whatever mode was last used. But it might at least be useful as a base for making what you want.

The code is in the firmware repo link in my signature.

Jaimelito
Offline
Last seen: 2 years 10 months ago
Joined: 05/06/2015 - 10:08
Posts: 26
Location: Jerez de la Frontera, SPAIN

Thanks ToyKeeper, I’m using Garrybunk.c from here http://toykeeper.net/torches/garrybunk/ and made some mods and get all what i want less locking mode and duplicate imputs and outputs.

This is the modified code. https://www.dropbox.com/s/6a2znhl7vyferqj/JAIMELITO.c?dl=0

HighEfficiency
HighEfficiency's picture
Offline
Last seen: 4 years 2 months ago
Joined: 02/05/2014 - 11:33
Posts: 74
Location: USA

The extended turbo timer and gradual ramp down you guys helped write for me have served me very well especially when used with the off time memory version.

I’m looking to take it one step further and implement STAR in some higher capacity lights I’ve been using. These lights are typically used at lower outputs for several hours at a time.

What I’m after is a global timer that would turn the light off after 5 hours.

Global in the sense that it would apply to all of the settings on the light. If low, medium, or high was left on for five hours, it would automatically turn itself off.

Is something like this feasible within STAR off time memory?

Jaimelito
Offline
Last seen: 2 years 10 months ago
Joined: 05/06/2015 - 10:08
Posts: 26
Location: Jerez de la Frontera, SPAIN

Now i’m noticied that have some flickering in direct FULL MODE with long press from off, but not for normal 255 output…
How i could fix it?

In video the first light it’s when flickering and the second full is normal cycle full.

https://www.dropbox.com/s/xdyd1jeq0y8ojm5/Video%204.wmv?dl=0

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 2 hours 16 min ago
Joined: 01/12/2013 - 14:40
Posts: 10743
Location: (469219) 2016 HO3

HighEfficiency wrote:
What I’m after is a global timer that would turn the light off after 5 hours.

Is something like this feasible within STAR off time memory?

Yes, but the timing won’t be very precise.

You should be able to count the WDT ticks in a 16-bit unsigned int. I think the default is 500ms per tick, so 36000 ticks would be about 5 hours. If the code sees the timer has gotten that high, it can turn off the light using the same method the low-voltage protection uses.

Jaimelito
Offline
Last seen: 2 years 10 months ago
Joined: 05/06/2015 - 10:08
Posts: 26
Location: Jerez de la Frontera, SPAIN

I’m talking to myself. Fixed it. I’ve remove FULL MODE and put the last mode when a LONG PRESS.

My next step is control 2 leds and 2 momentary switch with only one ATTINY13A. It’s possible with attiny13A or i need to change it?

Mike C
Mike C's picture
Offline
Last seen: 1 week 18 hours ago
Joined: 01/22/2014 - 08:03
Posts: 2578
Location: Sweden

It’s possible. The 13A has six in/out ports. However, only five of them are practical as the last one is the reset pin (PB5). Setting the reset pin to be an IO means that you will have to resort to high voltage programming in order to be able to flash the driver again. Other than that, you can do what you want with the five IOs. I think only two of them can do PWM, so these should be your LED outputs. Use two more for the E-switches, and the last you could use as a voltage monitoring input if you want.

Jaimelito
Offline
Last seen: 2 years 10 months ago
Joined: 05/06/2015 - 10:08
Posts: 26
Location: Jerez de la Frontera, SPAIN

Ok. i think to use PB0 as second led output and PB4 as second switch but my question is. Can work attiny13A with two different pwm frecuencys at the same time?

Pages