Attiny25/45/85 FW Development Thread

Yeah I think it's low risk for functionality, but high risk for being ugly. Good thing is that nobody will see that side. ;)

^ Nice to see this board RMM. The pad for MCU Pin 1 looks really close to the FET gate pad. Seems like solder may bridge the two pads.

The Oshpark render looks tighter than it is. It is close, but not that close.

I created a 17mm mosfet +1 7135 meant for attiny13/ 25/ 45/ 85 (150mil / 208mil). It should have clearance for a programing clip. I’m planning to order a set to test out, then I’ll be happy to share it on oshpark.

LFPAK56 mosfet (for the popular NXP PSMN3R0-30YL), 0805 pads, small pin3 pad for an e-switch, OTC. Could also be used for e-switch + tail clicky lights like the EagleEye X6R.

Just ordered the 3 min for now. Hoping the 25's will be enough memory anyway, but you never know til you start adding. Just hate to waste time trying to save every byte - been there, done that years ago, back in the Z-80 days.

Haven't started yet on expanding modes and config options, but I much prefer an e-switch for doing an advanced UI, and so far, the timing at 8 Mhz is dead on and needs no calibration.

I gotta look into the benefits/features of the ATMEL AVR Dragon. Richard - I should just send you the 10-12 bricked 13's I have though - I will probably have no need for them anyway.

Aww… but that’s half the fun! It’s like sudoko, or haiku, or trying to say something meaningful on twitter.

I figure nearly everything important can probably fit onto an attiny25v, though it’ll still need different firmwares for different types of lights or different styles of interfaces. And the attiny85v can probably fit nearly everything into one build.

But for some other projects, I’m using an ATmega32U4. Like, modding the firmware on a new keyboard.io whenever it shows up. Aside from basic stuff like modifying the keyboard layout, I think I can also make it run my old “water” demoscene effect on the keyboard LEDs. Only 64 pixels, but each one is individually-addressable with an RGB value. Partial derivative vector calculus computed at each keystroke! :slight_smile:

All sounds good! Yikes, done a few things with pixel addressable displays a ways back too - financial systems with those old style big board displays, early early rev. RGB graphics controllers. Worked on a few 2D graphic plotting systems as well with actual line drawing built-in!

Gotta go open up my BLF Manker A6's - just got a 3D and 5A in today. The 3D so far looks good - came apart easy at the threads. The threads and tube look good so far, boxes are excellent. Very hard to tell % wise what the real deal is - lots of issues reported, but who knows if it's common or 1 out of 50, or how bad the issues really are. I'm not too concerned - I really bought them just to see it all come together, and how it fairs, first hand. BLF is really breaking some new ground with this GB. I was never found of the A6 style host itself. Had a couple early ones, before Convoy sold them - wasn't happy with working with them, but that could have changed - was my early days of modding too Wink.

Just back from my one month computer-less vacation, not read through everything here so you might all be set by now…

I have working firmware for the 85 (I use the 85V 10SU version), but it’s not really sharable as it’s for my own specific driver design that uses different pins for everything. While I was gone my new driver board came from OSH Park where I’ve done some major changes I need to test before making available. Sharing one without the other is a little pointless because it’s all based on different pins, and I still have an 84 based project I want to complete.

I haven’t yet used the temp sensor on the 85, but I have on the 84. Seems to be reliable enough for overheating protection, providing you don’t need to be totally precise on the temperature. I’ll be setting mine with a margin for error. Once I’ve got the new 85 design built with components I will make the necessary adjustments and try it out. Registers are different between the 84 and 85, so I’ll need to tweak a few things.

On the 84 I’ve done some testing with a temperature controlled mode, meaning that the light gradually fades as the temp rises, trying to stick around an average temperature. I just did some quick testing, I’m not sure it’s worth the hassle completing. As mentioned earlier in this thread the temp characteristics of each light are so different that there would have to many calibration variables to actually be useful in any other light that the light it’s developed on.

I did read early on in this thread about the need for calibration and why not just stick to the turbo timer. Well, the turbo timer can be reset repeatedly offering no real temperature protection. I’ll still be using turbo timers but will be having an additional temperature controlled step down that can not be overridden by mode changes or turning it off. I’ve had a light almost start a fire in my backpack, so I know they can get pretty darn hot.

In some other thread (I think STAR) someone asked about holding the switch during start-up for hidden functions. I don’t know if that got answered, but I’m doing this on all my 84 and 85 based projects to access hidden features and mode programming stuff. However, I don’t use pin interrupts as I’ve seen on STAR versions. I run the WDT interrupt at the highest speed and check if the switch is pressed just as I’d check the voltage on the cap for startup or the battery level in the while(1) loop. It makes the logic so much easier.

Here is my first entry into the Attiny85 crowd. It’s built specifically for the Eagle Eye X6R (That’s why those three big vias are there), but I don’t see why it wouldn’t function in any other 20mm application. I’ll share the actual oshpark link once it’s completely finished.

I don’t have hardware yet, but the plan I’m going with is to let the user calibrate the temperature cutoff. Basically, run in turbo and save the temperature value every second or so, until the user turns the light off or presses the e-switch. From then on, that value will be what it uses as a maximum temperature. I think this will be an easy and effective way to make it work for different lights and different preferences.

As for the switch, I’ve also been planning to ditch the switch interrupt, because it takes a bunch of extra room and seems to make the code very fragile. We don’t exactly have a proper threading library on the attiny… so, I had also planned to go the WDT route.

But I’m starting with clicky-switch code and a small attiny25. E-switch stuff will have to happen later.

Ooh, nice! I’ll probably want one. :slight_smile:

It’d be a lot nicer than drilling holes through a 17mm driver… please update with progress as events unfold!

Here is my 85 driver board I got home while I was away. The rather radical changes I made are that I’ve put the OTC, voltage divider and E-switch all on the same pin. The idea is that the voltage divider resistors will be of large enough values so that R2 also acts as a bleed resistor for the OTC, and as the OTC is on the same pin it will be constantly charged by the BAT+ input. Voltage readings should be normal except when the E-switch is pressed. I don’t know if I can get this to work, but I just have to try. Why? Because I want to use my smooth adjustable output level of any amount of AMC7135s on up to 7 on constant current with an additional single AMC7135 for PWM between, and also have a FET for turbo/boost mode. I’m doing this on the 84 and love it, so this is an experiment to see if it can be done on the limited amount of pins that the 85 has.

I actually managed to squeeze in a total of 10 x AMC7135s, but don’t know if it will be too tight to be able to flash the MCU, so I put those two additional ones next to the pins of the MCU so they are the ones to go if it’s too tight with 10.

No spring as I will bridge with stiff copper wire with vias on each end of the MCU, and the MCU needs folded legs. Resistors and caps are 0603 size. Ground tabs on the AMC7135s need to be cut off a little, as does the PSMN3R0-30YLD FET, and made custom Eagle parts for these cut parts. No other way to fit all this stuff on a 17mm board otherwise.

No idea if this will work at all. It’s just an idea I have to try… It is a hobby after all…

Edit: Removed images, new version in the pipeline…

Mad science, I tell you. Mad!

Wight tried something similar, and it was pretty cool. It seems like a simple FET+1 covers most of the functionality though, without the need for extra 7135 channels. Beyond that it’s kind of diminishing returns, with the extra 7135 channels getting used only for like one mode each. On the BLF A6, here is how the two channels are powered for evenly-spaced modes:

The modes are:
|. Group 1 |. 7135 power |_. FET power |
| Moon | 0.8% | 0 |
| Low | 8% | 0 |
| Med 1 | 43% | 0 |
| Med 2 | 100% | 2.7% |
| High 1 | 100% | 22% |
| High 2 | 100% | 54% |
| Turbo | 0 | 100% |
|. Group 2 |. 7135 power |_. FET power |
| Low | 8% | 0 |
| Med | 90% | 0 |
| High | 100% | 35% |
| Turbo | 0 | 100% |

Extra channels would improve the modes labelled “High”, and maybe “Med 2”, but aren’t really needed for the rest.

I’m very curious to see if you can get the combined voltage/otc/e-switch pin to work though. Combining any two of those would help quite a bit with opening pins for other purposes.

IIRC, Mike had said in an earlier thread that he didn’t really like un-regulated output, so all the low-mid-high-whatever modes will have regulation and the FET is only used for Turbo mode. I can appreciate his reasoning, and I’m looking forward to seeing the finished (final tested version) driver.

I'm more interested in driving 3-4 outputs with this sort of setup. Is that what this 85 driver does? I know only 2 I/O pins can be used with PWM's, but a 3rd or 4th could be driven with fixed 7135's at full power I suppose - pretty cool, great for multi-color lights. That whacko nut zoomie light (on TMART and GB) with it's 3 XP LED's would be an interesting host for this.

^ I believe the 25/45/85 have 4 pins that can have PWM output. Pins 2, 3, 5, & 6.

13a has one PWM channel that can output to 2 pins (OC0A,OC0B). The 25 et al have 2 PWM channels that can output to 4 pins (OC0A,OC0B,OC1A,OC1B).

Ohhh?? Didn't realize that! I thought the 13A had 2 independent PWM's on max of 2 I/O pins it could support. Hhmm, didn't realize that was what T_K's firmware was limited to when combining the FET and 7135 - thought her dual mode tables were controlling 2 PWM values at the same time. Also thought the 25/45/85 had the same restrictions... I gotta go back into the specs.

Update: I have now shared the driver in post #135 of the X6R thread.

Correct. Not using PWM on the FET at all. It’s just full on for turbo.

I’ll be driving 5 outputs. 3 outputs for AMC groups of 1, 2 and 4 for any number of 1 to 7 on in constant current, another output for driving a single AMC7135 with PWM, and the last is for the FET. I do this so I can seamlessly adjust the output from moonlight to all 8 AMCs full on, using PWM with the single AMC to fill in the gap between each constant current AMCs. I did it on my ZY-T08 project and just loved how it worked so now I want to try it on a 17mm driver for a triple XP-L HI light with dual switch setup and a FET for turbo mode.

I haven’t thought about the 85 having PWM on four pins as I only use it on one, except on my dual LED headlight project where I use two (but it uses the 84, not the 85).

I guess I should clarify that this particular driver won’t suitable for multiple LED outputs (such as different color LEDS) as there is only one LED- and all AMCs and the FET are connected to it.