Adventures in TinyAVR 1-Series

I put together a BLF TINY10 driver for an sf-348 which works well, and now I’m thinking of building a 10mm FET+1 driver next. I’d like to run something Bistro-like if possible so the easiest would be to just use a VDFN attiny13a, but this would mean using a cut down UI, it would have no temperature monitoring and be slightly harder to flash.

How hard would it be to port Bistro to the 1616 MCU? And can it be used in such a simple circuit as the BLF A6 driver?

no problem there, so it’s only about porting bistro to the 1-series attiny.

1 Thank

Thanks, I installed KiCad and had a go squeezing it all in to 10mm and it seems to fit surprisingly well! I was expecting to have to stack the 7135 on top of the FET, and then put the +battery contact on top of that but it wasn’t necessary. I ended up putting the power section side towards the LED, and the MCU etc towards the battery. There’s one version with the attiny13a and one with the attiny1616.

I’ve never designed a PCB before so I’m sure it could be done a lot better but it was fun to have a go.

I fear that’s the easy part though, and the porting will involve more research. I’ll have a look at the datasheets and see if I can make any headway, though I’ve never ported anything either so we’ll see how it goes!


That was quick for your first time! And it looks pretty good too.

Do you not need a GND ring ? (The thin exposed line most likely wont be there because board houses remove copper ~0.2mm from the edges).

0603 size diode is SOD-523, the one on pcb looks like 323 ?
A 2020 FET is ample enough, even up to 14500 triple or 18650 single LED lights, DMN1004UFDF is the current best one at about 5mR.
0402 is also an option if more room is needed for a GND ring, equivalent diode case is SOD-923.

What’s the schematic ? Is R1 R2 a batt level voltage divider ? Because voltage can be sensed from the VCC pin.

Thank you, it’s very satisfying seeing it pop up as a 3d model! Yes I do need a ground ring, I thought that would be enough but will make it larger. I will also replace the 0603 components with 0402 as you suggest (and the FET), it’s getting pretty tight on there.

The schematic is just the BLF A6/A17DD driver adapted to use the same pins on a attiny1616 instead. I stripped the PCB of one and worked out what was connected to what, put that into KiCad, then replaced the 13a with a 1616. Yes it’s a voltage divider, I gather it brings VCC down to around 1.2V for measuring.

The first schematic is based on what I saw on the driver, the second is my assumption of how a 1616 would fit. Also included is the A17DD PCB.

I found a footprint for an actual 7135 to make the 2nd one, ignore the difference there.



The diode is most assuredly a Schottky and not a zener, used for reverse polarity protection of the MCU. But also it’s preferable to use a low pass filter for the MCU in FET drivers.
Here a classic FET+1 circuit (for e-switch here) : DEL's OSH-Park driver boards - #3 by DEL
R5-C1 is the LPF, 4.7R and 10uF
C2 is a decoupling cap, 100nF
You can probably save C2 by putting the LPF after the diode.
The diode can also be replaced by a PFET, when doing VCC voltage sensing (which you should do with a T1616 since that saves two resistors), there is no need to correct for the diode voltage drop since a PFET has virtually no drop. I usually use a small SOT-723 package.

PB0 and PB1 are good for PWM out, but PB2 and PB3 are not ADC pins, check 5.1 Multiplexed Signals in the datasheet page 18.

The standard flashing pad layout is UPDI - + with 1.27mm pitch.

Hey I cant PM you but I am interest in this programmer :slight_smile:

Welcome to BLF! PM incoming.

I’m interested in one but it won’t let me pm you

Welcome to BLF! I think you need a certain number of posts before you can send a PM. I’m sending you one now.

Hi Guys,

This thread looks pretty interesting, I’m new into micro controllers and I wondering if you can clarify me a doubt about the Attiny1616.

I was looking at the datasheet and it says it has like 5 Vref options: 0.55v, 1.1v, 1.5v, 2.5v and 4.3v. So my doubt is, if we have a 4.3v Vref option why we need to use a resistor divider to measure battery voltage?

The 4.3V Vref can’t be regulated if VCC is lower than the Vref, actually it needs to be a bit higher than that because there is some dropout voltage, there is a table in the datahseet about that. The highest Vref that can be used with li-ion is 2.5Vref (require VCC=>2.9V IIRC)
Regardless, we don’t need a resistor divider to measure the battery voltage if VCC is connected to the battery (e.g. no LDO) : https://ww1.microchip.com/downloads/en/Appnotes/00002447A.pdf

2 Thanks

I was thinking something like that but wasn’t sure, thanks for clarifying it actually makes sense.

I didn’t know that, this MCU seems very complete, ¿Do we need the LDO because while drawing a big amount of amps the battery drops its voltage, resulting in a no constant voltage range/reference for things like PWM?

I’m actually a web developer, so I don’t understand much about the topic, but I’m making a custom attiny1616 dev board to practice, I would like to make a desktop program, where you can build up your owm custom flashlight UI then the program would export the code to you just copy and paste it on arduino IDE.

I was planning to make the dev board a buck driver since is the big thing right now, but as I’m unemployed at the time, I will have to use the things I have at home, so I will practice with an N mosfet, my first goal is to make a 17mm driver for non e-switch(s2+, C8) that can be flashed.

I’ve seen you on convoy’s thread, I bet you’ve seen guys who wants a 50% or 70% modes or me who can’t stand strobe mode.

And if for some reason this works it’ll be good to give it to simon.

You need a regulated VCC if you’re using a filtered PWM signal as setpoint for the constant current circuit, in that case you need a LDO (usually 2.8V) and a voltage divider for battery voltage sensing.
But if you use the DAC instead of filtered PWM, then VCC can be unregulated, because the DAC uses the internal VREFs, the T1616 DAC is only 8bits, 1:255, but the diming range can be extended to 1:1159 by using two VREFs, 0.55V and 2.5V, in theory because in practice the level 1 and 2 are pulsing, so it’s more like 1:386.
If it’s a direct drive “FET” driver then VCC doens’t need to be regulated.

2 Thanks

Thank you thefreeman! very clear.

I’m interested in one of your programming keys if you still have them. Unable to PM due to being new.

Thanks for joining the party, icthelight!
Don’t go towards the light!

Guys, what kind of solder paste do you use to reflow your drivers, 138°C, 158°C or 183°C?

What alloy is 158° ?

I’ve used the three main ones, SnPb, SAC (SnAgCu) and BiSnAg, all from Chipquik.

  • SnPb flows the best and is the easiest to use, but is leaded of course.
  • SAC is the worst IMO, doesn’t flow well i.e. tends to make bridges if the paste application isn’t perfect, the high temp requires good equipment and limits the number of reflow and working time. Touching up joints, which is often needed, is difficult with a small iron tip without some sort of preheating (hotplate).
  • BiSn doesn’t flow as well as SnPb but better than SAC, the low temp is great if your equipment has trouble heating up to SAC temp. It’s the easy lead-free option.
    It makes poor joints if mixed with SnPb, so it’s better to also have BiSn wire when using BiSn paste.
1 Thank

There are two products I’ve seen on aliexpress that are 158°C

1.- Mechanic XGS40: It says its composition is SnPbAg doesn’t state any %, the “Ag” may be fake another site states Sn63Pb37

Link mechanic

2.- Ma Ant MY-58A: Its composition is SnBi but also doesn’t state any%, they also have their 138°C version

Link Ma Ant

The first one I heard from a youtuber who repairs iPhones, he likes the XGS-40 158°C for iPhone CPU reflow.

It seems that Mechanic has another solder paste of 148°C melting point called Mechanic XP5, the XGS40 and XGS60(same formula different weight presentation) have the ipx6 flux, so it appears 148 and 158 are both leaded but with special flux, hmmm more toxic?

I have a hot plate called Mechanic IX5 Ultra I haven’t used it, but it can heat up to 260°C, is small but its plate size is generous for flashlight porpuses 80mm x 60mm, mine came with a tiny dent on one of the corners so slightly less for my plate, If I ever need to use the 8cm I could just sand it.

Link Mechanic IX5 Ultra