Attiny25/45/85 FW Development Thread

Hi Tom,

Great that you have it going!

I agree with texaspyro about the boost converter effect. This is the ‘charge pump’ I mentioned above.
A safer option would be to keep the bulk decoupling at C1 and just use a small capacitor (0.1 - 1 uF) on the zener pads.
There is normally nothing to gain by moving all the capacitance to the closer pads.

I looked briefly for a reference, this one seems as good as any and actually refers to boards without power planes like our drivers:

The larger capacitance may be a band-aid on the real problem….there seems to be an excessive voltage drop somewhere during high-current PWM. If this is the case then you will find that the C1 capacitor is useless because it will be loaded by the emitters during these voltage dips. This is where a 10 ohm or so resistor in series before C1 may help.

Thanks for al the info! So, the Nanjg's had/have this design flaw all along? Maybe not a real issue at 3A or less?

It's a shame that Comfy's scope images are gone(& Comfy himself!). Looks like we are at the same point that we were at a little over a year ago.

Post 1055 from the OSHPark thread;

Hhmm. Looks like comfy and wight didn't agree on this issue. Yep, a lot of history lost... Wight says in Post #1068 exactly the same thing an EE told me - "put capacitance very close to sensitive but low-draw devices". Neither seem to know enough of the theory, or have enough experience, but they certainly know more than I do.

DEL is probably right - maybe just adding the small cap at the zener pad would solve it, and keeping the original 10 uF at C1 - didn't try that unfortunately.

If it helps, I have a copy of comfychair’s images…
http://toykeeper.net/torches/comfychair/

It’s a bit of a pain matching up the broken image icons to the actual files in the mirror though.

Thanks TK - saved that link. comfy had some invaluable pics. It may not help some of his better posts/threads though - really can't tell what's goin on - he used pics heavily.

OK - made minor tweaks to my e-switch firmware. Changed 2 timeout values because I think the timing was better:

Link here to latest: google drive folder

Changed from:

#define CONFIG_ENTER_DUR 128  // .16ms each (2 seconds) - hold button down for this time to enter config setting mode

#define LOCK_OUT_TICKS 12 // fast click time for enable/disable of Lock-Out (12=0.192s)

To:

#define CONFIG_ENTER_DUR 160  // 160=2.5s, 128=2s - hold button down for this time to enter config setting mode or lock-out

#define LOCK_OUT_TICKS 16 // fast click time for enable/disable of Lock-Out and batt check (16=0.256s, 12=0.192s)

After some more talking about it here @work, even though it's working now with the caps after the diode, I'll move the 2 caps (22 uF and 1 UF) before the diode. There is agreement here about the charge pump effect, so it's a worthwhile effort. Hoping this evening I can get to it.

Guess I better make a few changes to my boards then.

Just a sugestion, is the code used to LVP in *5s the same used in 13s?
could the behaviour is experimenting Tom E, be due to 13s and *5s read voltage in a different way?

I´ve read that when programming attinys with arduino, while *5s return acurate voltage readings, the same code in attiny13 do completely wrong readings.

Maybe the code is crashing the MCU instead interferences?

First problem there in arduino land is they are using the same code -- you can't use the same code - there are incompatibilities. We don't use the same code.

The AtoD initialization must be done differently. If you don't, something won't work right - like LVP that uses an AtoD.

For 13A:

ADMUX = (1 << REFS0) | (1 << ADLAR) | ADC_CHANNEL; // 1.1v reference, left-adjust, ADC1/PB2

For 25/45/85:

ADMUX = (1 << REFS1) | (1 << ADLAR) | ADC_CHANNEL; // 1.1v reference, left-adjust, ADC1/PB2

This is one of the 3 "golden rules" / "must do things" you must change for converting a 13A project to 25/45/85. I've tested LVP out (others have too) and it works fine.

Wow, you have done even better work than i though.

I wish you luck with testing.

I think (hope) we almost have this resolved. Certainly for my configuration it's working, but I'm trying to get a better solution where we feel more competent it's going to work across all driver layouts and usages - low amps or very high amps. Thinking the max amps I've heard of approach's 20A, maybe 15-18A? Driving 4 or more 219C's in parallel might be the worse case, because those 219C's have a lower Vf than the CREE's and seem to be able to survive at high amps.

Actually, I have to see if the big footprint of the 22 uF caps I have now will fit on a C1 pad... Forgot I'm using a 1210 size cap.

As Tom said, the init code is slightly different.

Also, each driver needs its voltage levels calibrated individually. A raw ADC value doesn’t mean much in terms of volts until it’s calibrated.

As for the code… I’ve found that it works 100% correctly on drivers made by one person, yet fails on drivers made by someone else. And when it fails, it can often be made to work simply by stretching or bypassing the battery springs. This doesn’t point to a software problem, but rather to a hardware problem.

I think the design we’ve been using must have been right at the edge of a tolerance level, pushed up against a boundary, and slight changes to even one component pushed it over the edge. Hopefully future designs will be more tolerant of small changes.

Hmm… Interesting stuff. I haven’t pushed through my latest design changes with OSH Park yet, so I might make these changes before I do. However, is it advisable to stick to the same 10uF capacitor? I see Tom E testing with 22uF. Is 10uF not enough?

Haven't sorted this out yet. My 22 uF caps are a little too big for the 0806 pad - dunno what to do at this point. I could try hot air reflow with solder paste and it could grab just enough of the pads... just that everything is so crowded in there, and I don't have a hot air setup that targets well.

When I stacked two 10 uF on the C1 pad, it wasn't a 100% solution. Can't tell what's really goin on without a scope. Could be the 1 uF cap may make all the difference.

All I know right now is the 22 uF cap (1210) on the zener pad with a 1 uF cap sitting on it seemed to be working well.

Hi Tom,

Yes, an oscilloscope is really the way to do it.

FWIW I did scope a 2.8A 105C driving a single XP-L2, 15 kHz PWM. No sign of voltage boosting at C1. Only 160 mV peak-peak switching noise, as can be expected. This is a test-bench setup though. Fed from a power supply with a 1000 uF capacitor 4” ahead of the driver to simulate the cell.

I also did a crude SPICE simulation of a 20 kHz ‘driver’, feeding 12 A to a bunch of ‘LEDs’. The only way I could get the voltage boost was by adding significant parasitic inductance between the ‘cell’ and the driver. In practice this means long wires.

With your arrangement you can probably fit a big capacitor on the ‘motherboard’, leave a 10 uF at C1. I would still use a 1 uF on Czener as well.

Tried following this conversation. I don't have enough electronics knowledge/experience to offer any advice on this high current issue. You seem to have solved it on the voltage in side. I am wondering if you every tried using a pull down resistor on the PWM output though.

No, think DEL recommended that earlier? I'm really not a good one for experimenting around - don't have a good setup, not ready access to variety of parts, soldering skills are ok, but not as good as many here. I really should work on getting a better bench setup and build up some parts inventory.

Ok, I posted a new update to the 45/85 e-switch firmware here: google drive 25/45/85 projects

I cleaned up this share folder now - it has the 3 BAT files I use for AVRDude, and has a ZIP of the full solution/project I use.

Changes:

  • One bug fix: eliminated the short flash that occurs switching from hi to OFF to moonlight mode
  • other minor clean-ups

I had thought the flash was a hardware issue, and attempted to fix it by adding a resistor to the FET gate input. But learned in the last couple of days that when I was changing modes to OFF, I was writing out a 0 to the TCCR0A register, which is probably not valid. I changed this to "PHASE" and can't reproduce the flash anymore in 4 separate lights I've tested it on so far. I also removed the resistor on the FET input pin I had on a couple of them. This problem has been haunting me for a long time now - been asking around, and seeing reports of it on other firmware/drivers, but could be unrelated there - not sure.

I'm not sure if this was just my version, but I'm suspecting it is. I went back to JonnyC's original STAR eswitch version and though he stored 0 for the PWM mode for the OFF mode, it wasn't actually written out to the register.

So, I probably have this same bug in my original e-switch firmware for the 13A as well. A big Oooopsy!

Nice detective work Tom E. Remind me not to be naughty in your neighborhood .