Mod - GarryBunk's SecurityIng HD-016 (It's Finally Done!) - Pic Heavy

Cool. I can just invert the value then.

What I was thinking is to do something roughly like setting the maximum PWM level to 255 minus the difference between some hardcoded value and the actual thermistor value. This way, it would ramp down smoothly and gradually above a certain temperature, and step back up just as gradually when it cools off. The scale might need to be multiplied or curved or something, but it seems like the concept should work.

The goal is something similar to ZL’s “PID” thermal controls, which behave like this (but less advanced):

Low voltage, though, should just use the standard approach found in STAR. When low, step down. If it’s already at the bottom level, warn and shut off.

Not really. The attiny can only measure one at a time, and it’s asynchronous, so it needs a bunch of extra logic just for switching back and forth between the two ADC channels. Plus, low voltage logic never steps back up.

I agree, both would be redundant. Thermal protection will use more ROM space than turbo timeout though. We’ll have to see what will fit.

It’d be nice if we could just replace the standard attiny13 with attiny25 chips in all the common drivers. Twice the ROM space, and since half the space gets used for overhead it means like 1500 bytes to play with instead of 500.

I have no idea. I’ve only done voltage indicators once, and the circuitry side of things was already fully taken care of. I just had to do the measurement and logic in the firmware.

This is just a guess, but I would assume that the attiny’s output pins run at the same voltage as its power source, so whatever the buck is feeding the attiny. It can run at up to 5.5V though, I think, which should be enough. And to control how much power is fed to those indicator LEDs you’d have to insert appropriate resistors along that path; the attiny can only turn it on or off. I don’t recall off-hand what the default attiny output pin current is, but you’ll almost certainly need to reduce it for indicator light use.

Guys, don't want to break out your brainstorming flow to much, but I have an idea for my usage only leaving stock MCU in place as is. First to resume what we have in stock form. As I understand it (I might be wrong) we have three circuits parts: 1 controling/user interface and 2 power controling for each led.

Now, my idea is to put both leds in parallel on both power controling circuits parts. Leaving everything else as is I'm assuming we can get modes like 50%, 50% 100%, strobe. This of course is not very usable, but if I change sense resistance in the circuits to get: first 1/3 and in second 2/3 of desired power. Then I think we can get modes 33%,66%,100%, strobe.

This would be just fine for my usage leaving all other features (voltage indicators, thermal protection) in place. Not the best as would rather have strobe hidden and bit different mode spacing, but it's usable.

Can someone look if this mode is possible? Resistor mod is trivial to me, but putting leds in parallel is in question electricaly. Phisicaly I can just connect two black wires and we are done .

What do you think?

TK,

All that sounds good to me. I have no problem if you wish to go with a Attiny25. I believe I could use the same equipment I already have. I would just need to specify Attiny25 in Atmel Studio when first setting up your FW. I would need to order some 25's.

I will play indicator leds to see what gets them to work. It sounds like they must have some internal protection that blocks current when voltage is too high.

ledoman,

Interesting idea. I don't know enough about electronics to answer your question. It sounds like it would work. I have paralleled drivers before to increase current. I didn't have any of the drivers off though. So I don't know if there would be any kind of back flow issue. On this driver, I think you would have to connect both the positive leads and both the negative leads to each other to make it work.

Thanks, will wait what others have to say. Since hopefuly there is no PWM, just on/off, I expect no intereference between power circuits. Hopefuly!

I should mention that I don’t actually have any attiny25s or the tools needed to swap one out on an existing driver. I’m just basing my guesses on the usual difficulty getting everything to fit, plus JonnyC’s comments that he is having trouble with exactly the same features. I know I’ve had to pull some dirty tricks to make things fit into 1024 bytes in the past…

I can probably use a lot of what JonnyC already wrote, but I haven’t looked at the details yet.

^ I can only imagine how creative one has to get squeeze code into such a small space. Just let me know if you do decide to go with the 25. I would need to place an order for some. I'd do my best to test code since you wouldn't be able to do the same with actual hardware.

I wonder if I should just get a hot air gun.

Or I found a BLF member selling nanjg drivers with the MCU replaced, but they’re $15 each plus $5.50 shipping. For the price of three, I could probably get a hot air gun and a few attiny25s and be able to upgrade arbitrary drivers.

Hot air guns are great to have for all kinds of things. I find that even the cheapest ones work fine for reflowing.

Not sure if you would be interested in the conversation that I trying to start here.

Have you optimized the code enough? If you have based your code on Star there is a lot you can do. I’ve cut memory usage almost in half but still have the same functionality. Star is written for easy use and changing of modes and such, but can be optimized a whole lot to save space without changing functionality.

It depends. I’ve definitely squeezed a lot of extra features into the available space before, on other firmwares… There is a lot in STAR that I don’t need or care about, which helps. But in this case I don’t actually have hardware so I haven’t written much code.

I was surprised at how much memory could be saved from a few changes. Saved me from having to dig into ATtiny25 programming… for now at least.

I managed to fit 15 modes into 1024 bytes on an off-time based light, including a battery check mode and a bunch of different styles of blinkies and a pulse frequency modulated moon mode which smoothly self-adjusts its speed to compensate for decreasing voltage over time. And 2-level turbo stepdown and low-voltage protection. And a short/med/long button press UI.

So I might be able to fit everything into 1024 bytes for the light in this thread… I’m just not totally sure, and it’s hard to know until I have hardware to test on.

If there was more RAM, I could compress the code and fit even more… but attiny chips have nowhere near enough RAM to run a decompression engine and then store a larger program in memory.

Seems like you’ve done a lot of optimizing :slight_smile: I’ve got two individually controlled PWM channels with separate output pins, 8 individual modes per channel (each channel with it’s own mode memory), turbo timeout, low and critical voltage step down, short and long press UI (off time)… and still have room to spare… Not finished with it yet though, don’t need a total of 16 modes so I’ve got more space to work with if needed.

You don’t need any hardware to see if it fits, AVR Studio tells you how large the end result is after compiling.

Oh, I have the size calculation built into my build script. The question is whether the code actually works. I can easily make it small enough if it doesn’t have to work. :slight_smile:

In theory, practice and theory are the same. But in practice… well, not so much. Code is all theory until it’s running in its intended environment.

Yeah, I couldn’t get anything done without the hardware. It’s just that wrote you where not sure if it would fit, guess I misunderstood that a bit. Of coarse you can’t be sure of the size until it’s all been tried and tested, I know that all too well :slight_smile:

Regarding Attiny 13a vs 25, I'm not sure what all in involved with converting the FW over, but part of my thought process if I was a programmer would include the following:

  • The Attiny13 has been a challenge memory wise for quite some time. It probably has hobbled more than one programer.
  • The 25 is superior to the 13 and uses the same foot print.
  • Programing time will be needed to squeeze into the 13. This same time could be used to convert to 25. This time could be thought of as an investment into taking drivers to a new level going forward.

I’ve got a few of the 25s at home, and also a few 85s, but I wasn’t forced to use them as I just finished my head light project code (as described above) and it weighed in at exactly 1024 bytes! :bigsmile:

However, I’ve been looking at the datasheets for them both and comparing. I think it could be done rather easily. I just don’t have one of those component layout test boards (or whatever they are called) to test them. My 13a programming has been tested on Qlite boards, and I’m not that keen on attempting to replace the MCU on any of them. I’ll be getting one of those test boards though, and might dig into it then.

Has anything been decided about the hardware, like which MCU will drive the indicators? Where is the voltage coming in, and is it getting divided to a standard range? In general, how is the hardware turning out?

I think the decision was:

  • Remove the stock MCU entirely.
  • Attempt voltage monitoring AND temp monitoring.
  • Drive one or more of the stock indicators using the final remaining pin on the ATtiny. (EDIT: together, as unit. So just make them operate together and maybe turn on solid for low, then blink for critical… or something.)

Hardware is the stock driver (pictures in Post 16) with the MCU pulled. Here is a schematic of everything but the 2 build-in buck drivers. I will adjust the voltage divider resistors initially and again after testing, if needed. I can also adjust the FW to fine tune LVP.

LED's 3, 4 & 5 are voltage indicator LED's. There are 2 buck drivers in the driver. Both will be provided the same PWM feed.