STAR Firmware by JonnyC - Source Code and Explanation

It compiled fine for me when I deleted it.

Hmm. Maybe I’m having cache problems again… At least now that I know the code isn’t the problem, I should be able to figure it out. Thanks.

Ok it is working now, just had to restart AVRStudio. I still don’t know why it does that…
………………….
If anyone else is interested in it, here is the code.
It is STAR Off-Time, no memory. L > M > H > ~10Hz Strobe

Isn’t it satisfying when you get it working? :slight_smile:

Okay, I got a first pass written. It works but isn’t well-tested.

The “ToyKeeper/starry-offtime/” firmware is basically STAR_off_time except it lets the user set PWM levels individually per channel, and PWM speed per mode. Also, it uses the single solderable star to toggle mode memory instead of mode order. And it drops any attempt to support single-channel PWM, since the whole point of it is to improve how the second channel is handled.

This is an early rev; I’m planning to add some blinky modes as options, so you can add a strobe or beacon or battery check mode if desired. And probably the 3-level offtime handling to let people go both back and forward in the mode sequence. I don’t want to take it too far away from its origins though, so I’ll branch off into a different file before it diverges too far.

Anyway, it’s in my code repo below.

I’m looking to add a basic temperature monitor to STAR OFF-TIME v1.2 using an external temperature sensor like an LM45. (output is 0-100degrees mapped to 0-1v)

I reckon it’d be trivial to just co-op the voltage monitor shutdown procedure and simply feed it the temp monitor output instead, but that would mean losing the LVC functionality.
Is there a relatively simple way to do both? ie keep Low voltage protection and also step down at a critical temperature.

Maybe someone has already done something like this and would be willing to share their code?

Cheers
Linus

JonnyC was working on this; look at the MTN_momentary_temp version of STAR. It’s written for e-switches instead of off-time clicky, but it should at least demonstrate how.

The difficult part is that the attiny13a can only process one ADC reading at a time, so you have to keep switching the ADC channel between voltage and temperature. And you’ll most likely need different code to respond to each, since one steps down as values get lower low while the other steps down as values get higher. Also, one can step back up while the other never does.

You probably won’t need much of the solder star configuration code either, since you’ll have a maximum of one star available after connecting the OTC and temp monitor. Add an e-switch or second PWM channel or indicator LED, and then there are no pins available for stars.

Ah cool, thanks for the tip. I’ll look through that version to see how it’s done, and maybe I can understand it enough to transplant a few code snippets :slight_smile:
Cheers

Please note the operation voltage of the LM45 is 4-10V while the MCP9700/A is 2.3-5V.

Thanks, yes this would be used on a 2s driver running a 5v LDO so operation voltage isn’t a concern. Thanks for posting the alternative for 1s though, didn’t know about that one :slight_smile:

The starry-offtime firmware now has additional features:

  • 3-level offtime support, so you can go both forward and backward through the modes
  • 10Hz tactical strobe mode
  • battery check mode (also functions as a beacon)

It has some early code for hidden modes too, but it’s not working yet. Currently, it just tacks them on to the end of the regular modes, and they’re not hidden. I may branch before finishing that though, because I ran out of room and will need to remove some STAR bits before I can add new things. If I do, it won’t look much like STAR any more.

I’m mentioning this because it adds some things people asked for. Basically, STAR_offtime with individual control over each PWM channel, bidirectional mode switching, strobe, and battery check.

Thanks ToyKeeper. I’ll fire this code up soon.

Oh, um, the battery check code is currently calibrated for RMM’s Moonlight Special driver, which seems to get higher readings than any other driver I’ve tested (nanjg, BLF17DD). It may be a little “off” on other drivers unless you recalibrate it.

My measurements are in the ToyKeeper/battcheck/ directory, along with a firmware which can be used for making new measurements.

RMM may have switched to a protection diode with lower forward voltage (eg voltage drop). Does the diode on your Moonlight Special have a marking on it? (like 41 or E2)

Indeed. On the Ferrero Rocher, I see one labelled 41. On the Moonlight Special, it’s labelled E2. The ADC readings between the two differ by about 10, which is enough to make LVP and battery charge estimations not work well.

Mystery solved - that’s PMEG1020EA. The lower forward voltage should improve the driver’s overall drop-out by a small amount.

Hi guys,
First time im posting in your forum but its been a while that i read your stuff. Pretty amazing what you have done with this little nanjg-105c. Tido, JohnnyC , drJones and all other programmer could be proud of yourself!

I have programmed around 20 drivers (nagj-105c with 4 stars)with your technics but some fails . Let me explain!:slight_smile:

First , i modified the code by simply add more Modes to the star mom like 1,8,14,100,255 . 90% of the Times everything work the way it should. But some refuse to get 5 mode even if i reflash several times. It only work on 4 modes with the turbo in??? Any idea what could go wrong.

After i got one that the turbo is really fast even if i programmed it to 60 sec? is duration is around 10 sec? reflashing and it change nothing any idea whats happening here :slight_smile:

tks for your help

Glad to see you here!

The problem is likely your mode level setting of "1". That is far too low for most 7135 chips to turn on, especially when there are multiple 7135 chips on the same board. Depending on the number and type of 7135 chips, you probably need the lowest level to be between 6 and 8.

The turbo timer on the momentary driver is set in 0.016 second increments. So for 60 seconds you would need to enter a value of 3750 for the timer (60/0.016).

Hope that helps!

Thanks for your reply,
i changed the code for the two driver that have only 4 mode and now is working with 6 modes… ill removed one entry and i should end up with 5 mode :wink: problem solved tks!

for the timer… that one i really don’t know what to do with. I changed the number of ticks to 10000 ! so more than 120 seconds and its not responding… 5 sec on and it change to the previous mode , really strange!. All other driver( more than 20!) work perfectly with turbo but only one is not working??? Ill work on it but i think it will end up as a 7135 chips spare parts!

Anyone have a idea what could go wrong with the timer?

I wonder if you are seeing the low voltage protection kick in on that driver. If it steps down from any mode other than the highest mode, then that is probably the case.