Adventures in TinyAVR 1-Series

Guess I"m confused - I thought there was just a simple delay but you are referring to a flash and I'm not sure what that means (high output or OFF, etc.). I suppose if it's not a simple delay, then yes - stepped or smooth, it's noticeable.

Also don't know what 'HDR' is, or 'cathode' is, in the context you are using them. I'm definitely weak in some areas.

Yes sorry I should have detailed more.

Cathode is the LED - (anode is +).

HDR stands for high dynamic range dimming. If you have a driver with one power channel like a linear or buck/boost driver you are limited by the resolution of the PWM, so 8bit or 10bit (higher then becomes limited by the precision of the current sensing circuit) but that’s still not enough for moonlight modes, a 5A driver with 10bit PWM can only be dimmed to ~5mA which is arround 1.5lumen.
To get a much higher resolution I use (like Zebralight, Armytek, Loneoceans, Mike C) multiple sense resistors, 2 in my case (ZL use 3 in most of their drivers), which are selected with a mosfet (which I call HDR FET), here is the shematic of the linear CC circuit :


(R9 should be 10Ω here, not 5. R11, R10, D2, C6 are for the hardware delay)

To quickly go over how the constant current regulation works : In this configuration the op amp will increase or decrease the gate voltage of Q1 (acting as a variable resistor) so that the voltage at the inputs of the op-amp, Vset and Vsense, are equal. In order to get the desired current we apply whatever voltage gives us the desired voltage drop across Rsense. If we choose 50mV Vset, we get 50mV Vsense, with Rsense = 10mΩ that means 5A. Basically this is a voltage to current circuit.

But Anduril only outputs a PWM signal, the attiny1 series do have a DAC (8bit) for outputing an analog voltage but there is no support for it in Anduril, so we convert that PWM signal into a voltage with an RC filter. The downsides are that it doesn’t smooth it completely (ripple), but with a C value high enough it’s good enough, and it takes some time for the voltage to rise/fall :

This is with the values in the shematic, with a PWM freq of 10kHz, duty cycle of 50% and a PWM voltage high of 50mV, it takes about 15~20ms to reach the desired voltage (25mV), and consequently the desired current.

Getting back to the HDR function, when the HDR FET (Q2) is ON the sense resistor is Q2(~2mΩ)+R8 = 10mΩ (there is R9 in parallel but it’s too high to matter), with Vset = 50mV current = 5A. At PWM 1/1023 we get ~5mA (just dividing by 1000 to simplify).
When the HDR FET is OFF the sense resistor becomes R9, the current at 1023/1023 becomes 5mA, and at the lowest level 5μA ~ 0.0015lm.
Effectively we get 20bit dimming with 10bit PWM. Though in some cases when Vsense is too low the output can be unstable, so we might not use the PWM level 1 or 2, decreasing the total resolution, but there is still plenty enough.

For reference the SC/H600 mkII have the lowest level at 100μA.

In CFG the ramp looks like this (only 30 steps to not break the page) :

With this :

(*)

We ramp up and reach ramp level 10, PWM 1023/1023 Vset/Vsense = 50mV, current =5mA because HDR FET is OFF, Rsense=10Ω, then it reaches ramp level 11, HDR FET turns ON, Rsense is now 10mΩ, due to the RC filter Vset is still at 50mV (5A) and fall to 50uV (50mV/1023) over the course of 15~20ms : that’s the flash.

So we can either add a delay on the HDR FET so that it takes >20ms to turn ON (that’s what I’ve done in hardware, but software would be miles better), or like you suggested use the middle ramp blink to turn the LED OFF during the Vset settle duration.

(*) Typing this I just realised that PWM level 0 in the blink function will actually turn off the op-amp/linear FET (Q1), contrary to what I said in the comment above, I’m stupid…
I’ll test that, I do worry that the op-amp doesn’t turn off instantly.

Alright it works for the smooth mode but not for stepped mode, I guess one step needs to be exactly on the transition level so that it blinks, which is technically possible but then the ramp and number of step are tied together and the later can’t be changed afterwards in the UI.

Just fyi, I'm reading all this and do understand most of it. Thanks!

Btw: ToyKeeper has implemented higher resolution PWM and “jump start” yesterday in the anduril2 branch.

Ok, I'll bite. What's jump start? And how exactly, what exactly did she do with higher PWM's?

Brief list of changes here over the last day or so: https://bazaar.launchpad.net/~toykeeper/flashlight-firmware/anduril2/changes/606

She took it from 598 to 606, mostly on the KR4.

"added a "jump start moon" option for hold-from-off, for lights with slow-activating circuits (briefly pulses the light at a higher level to wake up the circuit faster)"

Guess this is for problems with the KR4 as well, nothing like a new feature.

With the Noctigon linear driver the LED can take a second or so to lit up on the lowest level (not sure why), with jump start apparently it starts at a higher level then go back to the actual level.

Dynamic PWM : likely to prevent noise during thermal throttling, since the PWM runs at 4kHz (10bits) in the Noctigon driver the bulk 0805 cap can sing. So here resolution is decreased to 8 bit for the FET and frequency increased to 16kHz so that it’s not audible.

No, to change the timing to get higher resolution in the lower levels. Like 1/10, 1/9, 1/8, 1/7, 1/6, 2/10, 2/9, 2/8, …

Ah yes, I assumed that was the implementation starryalley’s dynamic resolution but no.

I reflowed my first 1616 MCU last night on my tweaked gchart 20 mm driver boards. It's just an old FET+1 but what a PIA soldering that VQFN-20 part. I must have made like 8-10 attempts at it, but hoping the next will go easier. I made my own 22-23 mm version that can be sanded down a couple mm's to fit various lights.

One of the 23 mm's sanded down will be going in a cheap 18650 small zoomie with an e-switch. By cheap I mean like paying $7 shipped.

I think what I'll do is use very little solder paste for the middle pad, and don't reflow the pins. For the pins I'll hand solder with just laying a thin stripe of solder paste across each side of 5 pins, then working it with the small tip iron. Might need the solder wick as well.

For the one I did last night I first tried paste all around and ended up with big balls of solder on each side, crossing all 5 pins. Eventually what worked was hot air removal of the MCU, solder wicked the pads clean, then hot air reflowed the MCU back on. I think the MCU had enough solder on the pins to bond well and still stay clean. All this time the driver was on a 100C hot plate.

Personnaly I’m using a stencil I made a while ago, just for the 1616.

Another way is to tin the pads and then reflow.

Ohhh, maybe the tinning method will work for me. Think gchart said the stencil didn't work well for him.

Hmm, maybe it’s because I’m using printing grade paste but I haven’t had any issues with stencils.

It’s been a while since I’ve used a stencil. I haven’t used one since getting new higher-grade paste. I need to try again.

So is that type 4 or 5, like described here: https://fctsolder.com/solder-paste-type-3-vs-type-4-vs-type-5/

I had to google it... Looks like 4, or better yet 5 is better for small parts/pads.

Is higher grade the type 4 or 5? Any links, let me know. Thanks guys!!

Out of curiosity, what thickness of stencil are you using? I think that could play a big factor as well.

And I’d have to look Tom, but I think I got the type 5 stuff. That and my old stuff was crusty and had been re-fluxed several times.

Mine is T4, it’s just that the printing grade one is less fluid, I think it’s so that it releases well when lifting the stencil, though I actually never tried stencils with the dispense grade (syringe) I have too.

0.1mm steel.
Oh I think puting flux in paste is very bad, I tried to put flux in some of the print grade to make it more fluid, one month after it didn’t work at all.

I use Chipquik no fridge (quite practical) Chip Quik - Solder Paste No Fridge (15)
Pot is print and syringe dispense.

But it’s not cheap

Ok, if I were to order this, I think I would want for solder paste:

https://www.chipquik.com/store/product_info.php?products_id=470011

and for flux:

https://www.chipquik.com/store/product_info.php?products_id=310017

I think the tack flux is the typical type? Not too thin, watery?

And definitely the leaded paste for me.

That paste would be amazing if refrigeration is not required. Any downsides?

Oh, by "print" you mean using stencils?

Update: Just found it on Amazon US, cheap but Halogen free: https://www.amazon.com/Smooth-Leaded-Solder-Paste-Syringe/dp/B08KRR7PV4/ref=sr_1_6?dchild=1&keywords=solder+paste+t4+syringe&qid=1629334633&s=hi&sr=1-6

Regular, leaded, more $$$:

https://www.amazon.com/Solder-Paste-clean-63Sn-syringe/dp/B07B3WXYM6/ref=sr_1_15?dchild=1&keywords=solder+paste+t4+syringe&qid=1629334633&s=hi&sr=1-15

Ooops! My bad! Those on Amazon are not the Thermally Stable ones (TS...)

For the flux I use SMD291, it’s not too thin I think, the one you linked is a RMA type flux and isn’t described as ”no clean”, that said it’s still RO*L*0 I.e. low activity so maybe it’s fine ?

I haven’t noticed any issue with the no fridge paste, but mine only 6 month old.

Print grade (sold in pots, see in the datasheet) is specifically for stencil, it doesn’t work well for applying the paste manually, it doesn’t stick well and kind of stays on the tip of the syringe. I’ll test stencil with the dispense grade (sold in syringes) next time.

This is what I've been buying, current syringe from Jan 2021: https://www.amazon.com/gp/product/B017RSZFQQ/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

I keep it in the refrig, but occasionally forget and leave it out for a day. It's really not sticking too well, and stays on the syringe as you described for the print grade. Not sure if it's from the age, leaving it out, or what. Think it's worse now though then it used to be, not sure. It's probably dried out some.

Yea, that RMA291 looks good - thanks! Now just wondering if I should commit to the $$$... Wish I had the ability to design and layout my own drivers . You two are doing great jobs on the drivers, btw!! Very jealous