Attiny25/45/85 FW Development Thread

Yea, I'd take 0.05V accuracy for sure, but seems to be off a full 0.1V. I pm'ed DEL and he got back to me. Might be that he measured 230 mV drop for the diode, and about 250 mV might just nail it on my setup, but we are internally converting to 0.1V resolution, but if we used 0.01V resolution and display 0.1V, that would be better.

We are using 10 bit ADC, so we have pretty good resolution on the input side, dunno bout the precision though.

I measured the cell in circuit, and boy, there's lots of things goin on - didn't expect to see that much sagging and variation.

I posted this over in the TA driver thread, but here goes:

In NarsilTriple, got the voltage mon using the 1.1V ref working pretty well, very well actually. Also got temp monitoring in, and working to knock down output.

Made a change to voltage mon in DEL's code which I think did the trick - there was truncation goin on, not rounding, and once I rounded the ADC conversion to volts, it's working really well now.

For the temp monitoring, it's more sophisticate in ramping mode, but still not bad in normal mode set too - 3 steps down in ramping, cut by 1/2 each time, and in mode sets, drops twice, down 1 mode each time.

I'm pretty darn happy with it so far. Could tweak it forever of course, but also, this is on one flashlight, one driver, one 85 MCU, etc., so who knows how consistent it is. Used an HE2 cell in my test light (M2-Z), and it wasn't get'n hot enough, so dropped in a VTC6, and wow - got to ramp up in degrees pretty nicely. I monitored the housing with a IR thermo meter, so as outside approache 50C, the 55C trip point was hit, and output dropped in 1/2, then little while later, another 1/2 drop - that was enough. Might have to tweak the time delay - right now it's 20 secs - should make it 30 secs.

Outside temp drops immediately when brightness is cut in 1/2. In ramping mode, I use the ramping table index as divided by 2, not the amps, so not quite the same.

Ohhh - also don't think I mentioned it, but after pulling the voltage divider resistors, parasitic drain went down from 0.037 mA to 0.025 mA -- nice benefit.

Ok, I'm get'n tingly all over - doesn't take much to excite me though -

Very nice!

Thanks! Posted bout it in the BLF Q8 thread, post #3065 direct link here

Hi. I want to flash bistro firmware to attiny85, what fuse should I use? Inside the firmware it says

Is that for attiny25 only or that can be used to attiny85 also?

I have wondered this myself, TomE’s narsil has fuses that work with the 85, I just have not taken the time to figure out if they are the same once that would work with bistro.

I am thinking about just using tiny85’s for all the drivers over 17mm, the 17mm still works best with the 25.

The 25/45/85 should be all using the same fuses. Verify on the fuse calculator here: http://www.engbedded.com/fusecalc

Thanks. Is this the correct command when flashing?

Dunno if those fuse values are correct - check with what you are supposed to use for bistro. This is what I used, and posted for Narsil:

avrdude -p t85 -c usbasp -Ulfuse:w:0xe2:m -Uhfuse:w:0xde:m -Uefuse:w:0xff:m

Question, why not read the OTC using the Vcc reference instead of 1.1V. As Vcc sags, the OTC voltages all will also sag won't they? So this would compensate for that. Maybe this is done somewhere. i just checked in bistro and it appears to use 1.1V.

My other idea would be to increase the OTC cap to 10 or 100 uf and add a parallel resistor to tame this thing, instead of relying on what seems to be the voodoo of every stray uA in the whole board. Presently there seems to be no engineered controlled leak-down for the OTC. Am I wrong? I may test. Can use R2 as the parallel resistor for now with some minor hacking of existing hardware. I'm not quite setup for it yet, but soon.

You know a lot more about circuits/circuit design than I do. Most of us follow the lead, just build what's supposed to work, and that's not always easy to do to get right. You are probably right - not sure who came up with the OTC concept originally, might have been wight or comfy, but both are no longer active. Real estate has always been a limiting factor with the 17 mm driver, the defacto standard, so adding parts wasn't much of an option.

The issue with the OTC is the cap itself. Even X7R caps change the capacitance quite a bit as they get warm and the timing can change significantly due to this. That is a far larger issue then how it is setup. Once it is calibrated it works as it is and is consistent at a given temp.

Far as going with larger components or adding more, there is simply no board space for this. We are already overloaded as it is.

I would much prefer find something else entirely for the off-time timing but I have not been able to come up with anything better.

Well, the issues with the OTC are there only because of lacking an e-switch. I've found simple memory decay detection, like in Biscotti, seems to work very reliable but you lose the short/med/long press detection. But power switch lights are low end and limited. Pretty much all higher end, advanced UI lights have e-switches.

This is why it's frustrating seeing vendors Like Simon/Convoy and Jaxman trying to build quality lights without an e-switch. It will always limit the usability of the light.

While I have no issues with a e-switch in principle. Most e-switch lights are side switch only. I am not a fan of side switch lights unless it is a hulking monster of a light. It is just too hard to find the button when you need it. The tailcap switch never moves lol.

Dual switch lights are the ultimate, I love these. Sadly these are even rarer.

I have that trouble finding the switch with some, certainly not all, and definitely not with the ones I prefer. The S1 Baton is an example of one where it's hard to find. The SupFire L5 is easy, as well, of course the SkilHunt H15 where it's on the top, but many others I find easy to find. Generally if I'm walking around with the light in my hand, my thumb is right there at the switch - all depends how you use it. I find the side switch to be in the natural position of how I hold a light, but everyone is different, and there's different usage scenarios.

Once the light is in my hand and I am holding it I like the side switch. The issue is the getting it into my hand and turned on in the first place.

I know that around here the tail-switch lights are by far the preferred lights for most situations.

Although if just casually walking around with a light then the side switch lights are popular as well.

Calibration won't make up for my first question. OTC isnt LVP. It can be used with full batteries or empty. That seems like a free tweak to make it that much more predictable (not a minor effect compared to cap heating). I see your point about temp. Selecting good caps can limit that to 15%. What temps do these mcu's reach before the cases get too hot to hold in a decent build? They monitor their own temp right? It is true that bigger caps are more difficult to have in high quality in the same space. Anyway I was referring more to finicky design, which yes, once working is working, although I have other suspicions about performance, just suspicions though, maybe not worse than the cap heating (other than the voltage thing)

In the smallest lights or most of them (single cell lights), we've got two extra resistors anyway that aren't needed now that measuring Vcc itself was figured out (as I understand it, I don't know the details). One is in the right place. Of course that could also be used to save some space.

Both on one light sounds good.

Oh, I see. Just use VCC for the OTC. Yeah, that makes sense.

R1/R2 are not needed for 1S lights but most drivers will still keep them as they made great pads for future mods with access to that pin.

Honestly I would rather find something besides the OTC but sadly I do not think that is possible.

Although I have been trying to figure out if a larger cap was used in place of C1, if it could actually power the MCU for a second or 2 (the MCU would need to sense the turn off with another pin and shut itself down to save power naturally). This would allow the MCU to keep highly preceise timing for off time and eliminate all the OTC issues altogether.

Fitting a 1206 cap would not be easy but it is possible. It is actually possible to simply place the 1206 cap on the 0805 pads as well I am pretty sure.

I wondered the same thing after you mentioned other ways, but of course you need basically two vcc pins then. One to let it know it's "off". And a diode between the cap and the second pin, that may already exist. Might need a V version of attiny. I think you're looking at a few mF of capacitance, but maybe not if the software folks can get the attiny into some nice ultra-low power state. Of course you could leave the mcu powered and just give it a signal to shut... oh wait, that's an e-switch.