Attiny25/45/85 FW Development Thread

I would appreciate the source files for these. Mostly cause I’m trying to learn diptrace and it might help me to play with your files some. Nice work either way!

Good progress TA. It is all a compromise trying to build stuff this compact.

I think you have the basics down. For the rest you will probably have to prototype 2-3 times to work out issues with the mechanics, sizing, top and bottom ground ring fit, etc. If you have components on hand, it may help to print the copper layers to scale and then try to lay everything out.

Re. the credits, for myself anyway, there is no need or justification. This circuit has been around in its basic form on BLF much longer than me.

Things I would change, but this is just me:

- Not sure why your 7135 part does not have a pin 2? It is a standard SOT-89 as far as I know, if you need to borrow a footprint from another library part. Of course it will work with only the tab connected as well.

- The topside ground fill looks too aggressive, filling in between the MCU legs and it also has orphan islands. I would try to keep 12mil clearances, unless when passing between IC pins.

- Pin 3 of the 7135s is signal only, can gain some copper there for the pins 1 if you want.

- Typically part values do not go on the silkscreen, only part names - this also keeps the board valid when part values change or are not available :slight_smile:

- The tab of the top-side 7135 will make solder leak onto the ring when flowing. Not always a bad thing, but probably not the intent.

Yeah, never really worked with boards this small before, it is a learning experience.

Far as the credits go, I just wanted to be clear that it was not my design, I simply put it on a PCB in the size I wanted.

1 - The 7135 pattern was a normal SOT89 but I edited it early on to remove the center pad for another board design where it kept interfering with the center spring pad. Which reminds me, I forgot to extend the one on this board back out after shrinking it from 22mm. I can add the 3rd pad back in but figured since it was not needed and I was not able to use it on these compact drivers anyways, so why bother?

2 - I can increase the pour clearance but figured more copper = better since most of these things are getting pretty hot in a flashlight. Is there a reason to want more clearance then the 6 mils it has now for what we are doing?Increasing it to 10 mils eliminates most of the copper from the top side.

3- I was going to shrink the signal ring on the bottom side 7135’s but left it alone since I thought it looked neat with the saw tooth look. But from a performance standpoint, yeah might as well make that change.

4- I put the part values on the silk screen mostly because when I first started reading BLF and playing with this stuff everyone just assumes that everyone else knows what part values you need and it is surprisingly hard to get the exact info for a particular driver in many cases as they are just listed as “FET+1 parts”. Took me awhile to figure out what those were and that most of the drivers on here used the same parts. So I figured I would save some people that same hassle I went through. Easy enough to remove them if you think that is best though.

5 - I figured that would happen, but didn’t think it would hurt anything. In order to line up the VIA’s evenly around the outside this was the only real option without interfering with something or spending way too much time on it. I could go with only 2 or 3 sets of vias, but it didn’t look as balanced to me.

So the overall layout looks good? Happy with the C2 setup?

Sure, it looks like DEL is ok with the latest schematic which is the most important thing with Diptrace. Once you have that, the rest is just a matter of making everything fit on the board size you want.

Send me a PM with your email and I will toss the early source files over to you. Once they get approval from those in here I will make a thread and post it all up in there for everyone.

Here is the latest schematic I am working with for reference, I also removed the embedding from the prior posts to minimize confusion.

I wanted to make sure the circuit was acceptable and I would not have to make any major changes before I started real world tests, no reason to test something you still have to make major changes too lol. :wink:

I printed it out a little bit ago and populated it with what I had on hand which was only 805 components, I had read that you can put them on the 603 pads and indeed, it looks like if you were careful they would indeed fit.

In fact it looks exactly like the 3D model that diptrace outputs, good to see that it is accurate. I measured clearances, everything looks good. I can get a programmer on it with everything installed even in 805 sizes.

So in a pinch people could build these with 805 if they really wanted.

With the 603 there should be no problems at all with fitment. Looks like you could put a 603 on the bleeder resistor if you snipped the middle pin on the 7135 as well.

I have to say, I am REALLY liking diptrace, so far it has been spot on.

Only issues I have run into past learning hiccups are some things with the copper pours. They are not really designed to do what we are doing but with a few simple work around they are manageable.

If you have anymore suggestions please feel free to let me know, you know far more then me about this kind of thing, I was an assembler, not a designer.

Difficult to get C2 any better with a 2-layer board. I am trying a 17 mm layout in Eagle, and gave up on fitting both Cs, going with only C2 = 10 uF.

Your general layout looks pretty good. Re. clearances I just get nervous because of the available fault-current with Li-ion cells. But production process are probably much better today than what I am used to.

Great, I will knock out a 20mm and 22mm version and then post them up in case anyone wants them. Any other sizes people can thing of that would be nice to have?

Finished adding, and most of the testing for new features in Narsil:

  • Blinks out the firmware vers #, currently v1.1 - works just like the voltage level blinking: 3X click to voltage level blinking, then dbl-click to blink out the firmware vers #
  • added access to the full set of strobe and beacon modes from ramping: when at max level, dbl-click goes to first strobe mode. If OFF, dbl-click to max, then dbl-click to strobes

Ok, got the drivers made up, made a thread here for them: Texas Avenger "TA" Driver series - Triple channel + Bistro or Narsil + Clicky or E-switch - The Ultimate open source driver!

Please let me know what you think, I plan to order some in a few days to test.

I was able to make up a drawing in diptrace. Thanks for the recommendation!

I took the circuit from a tp4056 charging module and layed it out on a 16mm pcb. I’m not sure what of implications regarding our current firm wares especially bistro and narsil. I started a thread if you would like to comment or give some input. I still don’t know how to tune the settings of diptrace, but you can get an idea of what I am thinking.

I just had this idea for a current-regulated driver that has probably been considered before, but I couldn’t find any discussion of it.

It would be a single FET driver using PWM that would sense the average current and adjust the PWM duty cycle to keep the average current constant as battery voltage dropped.

For some applications this would be very nice I think. For example a single XPL medium mode with fixed PWM duty cycle might do 2.5A with a fresh battery but will drop to 1.5A as the cell is depleted. The proposed driver would increase the duty cycle as the voltage drops to keep the 2.5A average current constant (as long as the direct drive current is >= 2.5A). It wouldn’t keep the brightness completely constant because of the reduced LED efficiency at higher current, but it would be pretty good regulation that would be versatile and work with high currents while not producing much heat on the driver.

I guess the simplest way to detect the current would be sense resistors, but I’m not very familiar with the specifics. Any thoughts?

That it would be easier to stack a few additional ACM7135 there to get a constant output. Also I think the nice thing about FET drivers as well as the ACM7135 is that they are very simple. If you start adding a sense resistor then you have to implement a feature into the firmware. Also the voltage on the sense resistor would be tiny if you want the circuit to be efficient so you’d need an op-amp (plus a few resistors) in order to get a proper voltage output which you could measure with a MCU. So the circuit would get significantly more complex and the firmware would take up more space as well.

Thanks for the insights. I agree a FET+ 7135s would work for lots of applications, but it would not be as versatile.

What about a Hall current sensor? Something like this one.
http://www.allegromicro.com/en/Products/Current-Sensor-ICs/Zero-To-Fifty-Amp-Integrated-Conductor-Sensor-ICs/ACS712.aspx
It’s probably not cheap.

I understand this would not be a simple modification and would require firmware and UI developments.

I think it has a supply voltage range of just 4.5V to 5.5V. But I also have to say there are people here who understand more about all of that stuff than I do. I am sure that there is somewhere a current sensing IC which would work but I also don’t know if it would be worth it. Additionally I think if you are already going through the trouble of implementing a current sensing feature then you might as well construct a proper buck/ boost driver, for example based on the TPS63020.

If you're going to flash it for a specific LED family, a simple voltage -> PWM level table would get you 95% of the benefit with no hardware complexity.

On a different topic, does this:

avrdude: verifying ... 
avrdude: verification error, first mismatch at byte 0x0000 
         0x00 != 0x0e 
avrdude: verification error; content mismatch

mean I have fried the MCU? The write cycle proceeds as usual but it just won't stick. It's a tiny25 which has seen a bunch of voltage spikes while running... :( (the ones from turning off the FET at high amps).

It’s possible that the clip isn’t seated properly. It may be that it isn’t making good enough contact to sustain the default baud rate. I’ve had success in some cases by reducing the baud rate. Try something like “-b 9600” if you are running avrdude from the command line.

Must have been something along those lines as it’s working properly again. The clip is always hard to fit on that particular driver.

I get the verify error often, way too often... Never turned out to be a bad MCU, always something to do with the clip connection, seems like.

In the bistro firmware, what units are the Temperature settings in? I would prefer figure out what number I like and have it built into the firmware vs having to calibrate it for every light.

If I remember right it’s about 4 degrees C per digit. You will have to calibrate anyway, since the temperature measurement of the mcu is not exact at all.