Attiny25/45/85 FW Development Thread

PWM is a square wave, or pretty close to it, and square waves have more harmonics than almost anything else. I wouldn’t be surprised if it’s making other audible frequencies, especially on bigger lights or high-powered circuits.

^ The problem does seem to manifest in my large high power buck lights.

Tom E wrote:

. . . but the wight 22 FET+1 driver (https://budgetlightforum.com/t/-/31559) is perfect for these packages with the extra set of extended pads, so it appears. I'll use the 22 mm board for development then.

Been trying to use this board, but I can't get the FW to work right on it. It never goes to sleep mode and mode changes are a bit erratic. When the driver is populated with components, but not connected to a cell or a LED, I read some continuity from Pin 2 and ground. Maybe that is normal, but it seems the problem is related the momentary switch pin. The board works fine with an Attiny13a and BLF-A6 loaded.

Gonna needed to change to a different driver board.

I just reflowed the 45 to that 22mm FET +1 driver, and pin #2 looks good - it connects to the OTC pad. If you have a grnd signal on pin #2, that could mean the OTC pad has some connection, as if the OTC cap is mounted - it can't be for the default e-switch setup. Could be a bad trace in that specific driver PCB, weird...

What happens when you hit a piece of metal and it rings after the initial impulse? What do they call that, tambor? I may have used the incorrect terminology, but that is what is happening here. I can't even hear 17kHz sounds, and I've measured the PWM to be always at 18kHz+. The frequency you're hearing isn't the PWM frequency.

I flashed the 45 on the 22mm FET+1 driver, and so far it's look'n pretty good. I got 5 modes, first 3 are on the 7135, and the 4th on a combo of the FET and 7135, last is FET only. Looks like the 1st mode doesn't work at all, 2nd and 3rd modes are the same roughly, and the 4th and 5th look normal. Strongly suspect the 7135 PWM's aren't working/configuring correctly. I got the strobe looking pretty good though - it's frequency looks pretty good - it runs at a pretty high frequency, meant to be disorienting.

I'm using for fuses: low: 0xe2, hi: 0xdf, extra: 0xff. So, I'm setting clock/8, and disabling brown out detection.

Gotta research that PWM channel used for the 7135. Though Richard mentioned some differences, maybe PWM's...

Tom E wrote:

. . . Could be a bad trace in that specific driver PCB, weird

Thanks Tom. When I depopulate the boards, I'll have to check for that. The trace running over to the OTC pads is very close to the ground trace. So maybe there is some leakage going on there. When I do, I'll also transfer the MCU directly over to a 17DD and see if the problem disappears.

Tom E wrote

:I flashed the 45 on the 22mm FET+1 driver, and so far it's look'n pretty good. I got 5 modes, first 3 are on the 7135, and the 4th on a combo of the FET and 7135, last is FET only. Looks like the 1st mode doesn't work at all, 2nd and 3rd modes are the same roughly, and the 4th and 5th look normal. Strongly suspect the 7135 PWM's aren't working/configuring correctly. I got the strobe looking pretty good though - it's frequency looks pretty good - it runs at a pretty high frequency, meant to be disorienting.

I'm using for fuses: low: 0xe2, hi: 0xdf, extra: 0xff. So, I'm setting clock/8, and disabling brown out detection.

Gotta research that PWM channel used for the 7135. Though Richard mentioned some differences, maybe PWM's...

The 2 channels of PWM changes some stuff. I think I read that one of the channels is only for phase and the other only for fast. So maybe that is it. I did have one 17mm board that would not work on the FET channel (using Attiny13a). I swapped mcu's, 7135's, etc and it just wouldn't work.

I don't think the fuse setting above would effect dividing your clock by 8. Strobe would be pretty slow if they did.

All I changed was the low fuse, from 0x62 to 0xe2, and then the strobe sped up significantly. Dunno - strobe depends on the _delay_ms() function.

I'll have to dig more into the PWM stuff then - that would be a limitation with these MCU's - surprised they are less functional than the 13A.

These are the modes/PWM options I'm using:

#define MODES 0, 0, 0, 0, 80, 255 // Must be low to high, and must start with 0
#define ALT_MODES 0, 5, 30, 255, 255, 0 // for secondary (7135) output. Comment out if no secondary output
#define MODE_PWM 0,PHASE, FAST,PHASE, FAST,PHASE // Define one per mode above. 0 tells the light to go to sleep

So, looks like modes 1 and 3 are the flaky ones both are on the 7135 in PHASE mode... Interesting. Look'n thru the data sheets, it sure is confusing, but I see possible differences in PWM's for the two pins (PB1 is the FET, and PB0 is the alternate PWM output 7135).

^ Same here. Much to learn about this mcu. You may be right, but I think we will find it has more functionality. Even if one channel is only phase and the other fast, they both can be feed to Pins 5 and 6. OCO is one of the PWM channels. OC1 is the other PWM channel. Notice both Pins 5 and 6 can be feed from both PWM channels. I think we just need to learn how to get them to work for us.

That's "free response" and in that case you'll hear resonant frequency. But important thing is that mlcc capacitor have resonant frequency of several hundreds kHz,so there is no chance that capacitor produces lower than pwm sound,which leaves spring as only possible source of sound lower than pwm frequency. Is there a noise when driver is connected with wires without spring?

Seems like I bricked the 45, may be those fuse settings I used, in post #52 above, not sure yet. AVRDude connects fine, then can't verify at address 0x0000 (1st address), so acts like it's bricked. Tried several times, so seems permanent. I'll have to reflow another - dunno if just something flaky, or are they really bad fuse settings.

This looks like a great tool for fuse settings btw: http://www.engbedded.com/cgi-bin/fcx.cgi?P_PREV=ATtiny13A&P=ATtiny45&M_LOW_0x0F=0x09&M_LOW_0x80=0x00&M_HIGH_0x06=0x04&M_HIGH_0x10=0x00&B_SPIEN=P&B_SELFPRGEN=P&B_SUT0=P&B_CKSEL1=P&B_BODLEVEL0=P&V_LOW=79&V_HIGH=ED

This is the Fuse resetter design: http://homepage.hispeed.ch/peterfleury/avr-hvsp-fuse-restore.html

Yes, it is possibly the spring, but that's my point--once you get it installed in a light, you can hear it. Much of the MLCC noise comes from the MLCC vibrating against the PCB.

Tom E wrote:

Seems like I bricked the 45, may be those fuse settings I used, in post #52 above, not sure yet. AVRDude connects fine, then can't verify at address 0x0000 (1st address), so acts like it's bricked. Tried several times, so seems permanent. I'll have to reflow another - dunno if just something flaky, or are they really bad fuse settings.

This looks like a great tool for fuse settings btw: http://www.engbedded.com/cgi-bin/fcx.cgi?P_PREV=ATtiny13A&P=ATtiny45&M_LOW_0x0F=0x09&M_LOW_0x80=0x00&M_HIGH_0x06=0x04&M_HIGH_0x10=0x00&B_SPIEN=P&B_SELFPRGEN=P&B_SUT0=P&B_CKSEL1=P&B_BODLEVEL0=P&V_LOW=79&V_HIGH=ED

This is the Fuse resetter design: http://homepage.hispeed.ch/peterfleury/avr-hvsp-fuse-restore.html

That fuse resetter looks like the simplest design out there. Thanks for sharing that.

I think that is the same fuse tool Halo linked to in Post 2. It can be used in reverse. Just plug in your fuse values in the bottom and see what settings they would give you above. It seems your fuse values in 52 are valid. Is your programmer set to 5 volts?

What specific FW are you using for the DD+7135? I'd like to check it out.

I can hear the PWM whine as well. This is what I got from a smart phone app that seems to be in line with what we are all hearing.

What hardware and firmware did you measure there?

On some lights I can measure PWM speed by using the photoacoustic effect, shining the light at black fabric and holding a mic to it. I haven’t measured inner components though, and high frequencies are hard to separate from background noise.

Yes - 5 volts. Though after several attempts, I did try 3.3v but nothing worked.

Ohh - I'm using my latest eswitch.c. I could post it somewhere for you - I'm @work now though, another 10 hrs or so. You probably have an older version of mine.

How did this thread get so into PWM hums? It's got me hearing all the hums and buzz's here @work coming from all types of equipment Smile.

I used a qlite with two extra 7135s and guppydrv. The noise was clearly being emitted near the head where the driver is. I held it up to the mic on the smartphone. The peak was very visable on the app i used. There might have been more peaks higher up in the range that i wasnt able to measure due to the limitations of the smart phone. And i have to say i have never heard of the photoacoustic effect. Thats pretty neat.

As for how we got here i believe it went: what core freq to run, then 6 mhz because that allows you to get 19khz pwm to keep it inaudable and then to 19khz or not we call can hear it. And i really have nothing to add to this thread other then all the fuse setting was why I was thinking of going arduino on a tiny 85.

^ You've already contributed much value to the thread. I'm not going to pretend I understand everything you, led4power, RMM, and ToyKeeper (alphabetical order) are saying, but the hum issue is one of the vexing challenges that we have to deal with in this hobby. So any discussion that may deepen our understanding is all good.

Tom E,

Much appreciated. I will PM my email address to you. I don't have much in programming skills, but I will do my best to read the data sheet and look at the alternate pwm feed portions.

I should note that I don't recall where I read that one pwm channel is for fast and the other for phase. I skimmed the data sheet and didn't see anything like that. So maybe what I read was not correct or I misunderstood it.

Well think about all of the constant current pwmless drivers out there with a pic controling a mosfet. They are all silent but i suspect its because they are running pwm in the mhz range so that by the time all of the harmonics filter down they have no energy left to be heard. I could be wrong but i highly doubt the are changing the enhancement on the gate to vary the current flow. Which wouldnt make sense because the inductor relies upon expanding and colapsing magnetic fields to generate the current and voltage levels so i would think it needs to be an on off afair. I think the real leap in blf driver design will come when we can figure out how to use the micro as constant current switch mode controller.
It seems like pics are exclusively used for this but i dont see why we couldnt do it with an attiny.

We need a PWM-less thread to discuss getting these MCU's working Tongue Out.