Attiny25/45/85 FW Development Thread

True, I was just thinking it is less work to add PWM to modes as the voltage drops since the modes would largely remain the same as they are now except for turbo (well technically it would as well, since you already need to lower turbo in the low Vf lights).

By subtracting it, you have to start all over on the modes and mode spacing. Not impossible if this proves to be the more effective and smallest option, just more work. It also means you are committed to the regulation being active at all times as the modes will be wrong without it.

EDIT: Actually I did just realize a possible issue with this option, using this method you will run into issues where a mid range mode will reach 255pwm before the subtraction and thus not allow any more resolution, so all the midrange modes would basically be the same as turbo? Or am I missing something?

We thought about going a lot more advanced with the setup, such as controlling the FET directly with the Attiny through a DAC to give full control and reduce components / cost. This would take completely new firmware though and quite advanced firmware at that. I didn’t see this as a viable option at this point so opted for the simpler option that would work with a tweaked bistro/narsil.

I will release the driver once it is ready for the public eye, it still has some work to tweak to get the design finalized. It has been a royal pain trying to keep the components 0603, if it was machine made it could be made with 0402 or 0201 and be way nicer. I think it would also be able to fit a tiny85 in that case.

Sorry this is a bit off the current topic but Ive got an “im in the middle of modding something” question.

Is it common for Narsil (Narsil triple) to run on 4.6mA of standby current? If not, anyone know what I might have done incorrectly? I’m using 220k and 47k dividers.

Which driver are you using?

I’m using the ta17 all three channels.

Edit
This is unexpectedly high correct?

I’m not sure I follow you there. From what I understand, most firmware already has modes which use the full PWM range up to 255. My code will require no change there. It simply tries to make the light behave the same above eg. 3.8V. So unless you’re unhappy with the current behavior on a partially drained cell, there is no need to change the modes.

I imagine it might be the case that most modes/ramps were tuned for full cells and might not be quite as nice with partially empty ones… but I really don’t know. Then again, they were probably tuned for LEDs with higher Vf which did not need scaling back at high Vcc so this might all cancel out. It’s hard to say how much change will be needed to the modes without trying it in an actual light. And no two people seem to want the same modes anyway :slight_smile:

About your edit: the only range issue is that the highest power settings at the highest voltage are unavailable. But that’s the whole point of it, I think. Of course you could still make an exception for turbo, if you mean to cook an egg or something.

Yeah, I did roughly that but without the DAC, instead using the pull-up resistor + careful timing as a poor man’s DAC. It took a long long time. It’s not realistic to adapt existing firmware to that kind of system so it was probably a good choice to pick what you did.

It’s an interesting long term project though and I’m still wondering if the two PWM channels could be combined into a basic, highly accurate DAC for this purpose. Someday I’ll find out.

Does it have the zener installed?

Yeah, it should be a lot less then that. What about the bleeder resistor, is that installed?

No zener no bleed resistor

Not a great photo but this is the driver

I always look at things from the widest possible view and try to pick features / options that will work for as many different possible situations as possible with as little work as necessary.

In this case it would need to be able to work with a low Vf LED where it will limit the PWM at full voltage and with a high Vf LED where the PWM does not need to be limited and only increased to maintain output in the mid range modes.

Basically the way everything works now is fine, the idea with this feature is to allow the modes to maintain some semblance of regulation as the cell voltage drops. The modes as they are at full voltage is fine and if the mode is high enough that it can not “maintain regulation” past a full cell, then so be it, that is the price of using turbo modes.

I never hear of people complain about the modes as setup for a full voltage cell like they are now, so I figure why change it, plus it will make setting up the ramp table and modes much harder in the software because you will always have to factor in the multiplier instead of the multiplier only trying to maintain output as voltage drops as best it can.

From the way I understand it basically flipping your code around so that instead of removing PWM as voltage increases it would instead add it as voltage decreases. Same thing, just reversed and allows all the modes to remain unchanged from how they are now because most of them are indeed setup for full charged cells. Otherwise we will have to increase all the PWM by 30% only to remove that 30% in the software regulation later.

Strange, looks good unless there is a minor short someplace or in one of the 7135’s.

I have never measured the narsil drain myself but I think tom has it under 1mA now. No idea myself. I might check one of my lights to see what it does.

I just checked one of my Narsil triple drivers and I got 5.3ma, so actually seems like it is working fine. Just not sure why it is so much higher then the normal narsil. That would be a question for Tom.

Hmmm? I’ll look over everything again. Maybe he has not tested parasitic drain on the triple channel version? If I can rule out a software bug then it must be something about the driver itself. Otherwise is there another eswitch firmware for the triple channel drivers?

Ah… that helps much! Thanks. I’m not sure if I can live with that or not? The light will eventually go to a paying friend so I don’t want it to drain the cells on him. I’ll have to think about that.

I’ve sent tom a number of messages over the last couple weeks and have not received a response so?

Yeah, I didn’t expect it to be that high either, no idea why it is that way. Although in my case I only have narsil drivers in SRK’s, L6 and a D01, all of which have enough batteries to last a few years at those drain levels lol. Just not a big e-switch guy for the smaller lights.

He has been super busy lately and his computer went down IIRC. So who knows when he will get back on here.

At 5ma wouldn’t it drain an 18650 3000mah in less than a month. So for your four battery lights that would be four months? Or is my math wrong?

Opps, your right, I was thinking of .5ma instead of 5ma (been working with the lighted tailcaps a lot with that kind of drain).

Yeah, 5ma is very high indeed.