Attiny25/45/85 FW Development Thread

1911 posts / 0 new
Last post
Tom E
Tom E's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 08/19/2012 - 08:23
Posts: 13396
Location: LI NY

I just did a little research on the D1 and C1 positioning. The original Nanjg 105C and Nanjg AK-101 have the cap after the diode. Also an old BLF DD driver I had was like that as well - cap after the diode. But with BLF DD 1.0, the cap is before D1 and from then on, seems like we kept it that way.

 Anyone have any ideas on this? Maybe it didn't have any effect at the time, and was easy to layout?

pyro1son
pyro1son's picture
Offline
Last seen: 5 months 3 weeks ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

I’ve always put the cap after the diode just thought that’s how it was meant to be

Pastebin                                      &nbs

texaspyro
Offline
Last seen: 1 year 3 months ago
Joined: 04/29/2011 - 12:43
Posts: 4593

Putting the cap after the diode can cause the CPU voltage to rise to unacceptable levels. Inductive spikes get stored on the cap, raising the voltage. The cap can’t drain back into the (low impedance) battery because of the diode… the circuit behaves like a boost converter. There is a thread that talks about the issue…

DEL
DEL's picture
Offline
Last seen: 2 years 8 months ago
Joined: 06/28/2015 - 08:35
Posts: 559
Location: Canada
texaspyro wrote:
Putting the cap after the diode can cause the CPU voltage to rise to unacceptable levels. Inductive spikes get stored on the cap, raising the voltage. The cap can’t drain back into the (low impedance) battery because of the diode… the circuit behaves like a boost converter. There is a thread that talks about the issue…

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:
http://learnemc.com/decoupling-for-boards-without-power-planes

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.

Tom E
Tom E's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 08/19/2012 - 08:23
Posts: 13396
Location: LI NY

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?

FmC
FmC's picture
Offline
Last seen: 5 months 3 weeks ago
Joined: 03/31/2013 - 05:23
Posts: 2197
Location: Brisbane, AU

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.

Tom E wrote:

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

Post 1055 from the OSHPark thread;

comfychair wrote:

I think it's almost certain that any board that has re-used the Nanjg's original diode/capacitor layout in the power supply to the MCU suffers from the same overvoltage thing shown in my scope images. Even an original 105C does it, though when driving 7135s it doesn't rise to the level that causes odd behavior.

Move the capacitor at C1. Originally it goes between the diode's output and ground. The boosting goes away if it's moved to between B+ and ground, and then gate/pulldown resistors are no longer needed. In existing designs replace the gate resistor with a jumper. In new designs their pads can be eliminated entirely, freeing up valuable space.

 

Tom E
Tom E's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 08/19/2012 - 08:23
Posts: 13396
Location: LI NY

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.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 4 hours 1 min ago
Joined: 01/12/2013 - 14:40
Posts: 10614
Location: (469219) 2016 HO3

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.

Tom E
Tom E's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 08/19/2012 - 08:23
Posts: 13396
Location: LI NY

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)
Tom E
Tom E's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 08/19/2012 - 08:23
Posts: 13396
Location: LI NY

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.

pyro1son
pyro1son's picture
Offline
Last seen: 5 months 3 weeks ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

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

Pastebin                                      &nbs

Pablo E.
Pablo E.'s picture
Offline
Last seen: 3 years 8 months ago
Joined: 08/08/2015 - 13:54
Posts: 234
Location: Spain (GMT+1)

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?

Tom E
Tom E's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 08/19/2012 - 08:23
Posts: 13396
Location: LI NY

Pablo E. wrote:
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.
Pablo E.
Pablo E.'s picture
Offline
Last seen: 3 years 8 months ago
Joined: 08/08/2015 - 13:54
Posts: 234
Location: Spain (GMT+1)

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

I wish you luck with testing.

Tom E
Tom E's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 08/19/2012 - 08:23
Posts: 13396
Location: LI NY

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.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 4 hours 1 min ago
Joined: 01/12/2013 - 14:40
Posts: 10614
Location: (469219) 2016 HO3

Pablo E. wrote:
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?


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.

Mike C
Mike C's picture
Offline
Last seen: 3 weeks 4 days ago
Joined: 01/22/2014 - 08:03
Posts: 2486
Location: Sweden

comfychair wrote:

I think it’s almost certain that any board that has re-used the Nanjg’s original diode/capacitor layout in the power supply to the MCU suffers from the same overvoltage thing shown in my scope images. Even an original 105C does it, though when driving 7135s it doesn’t rise to the level that causes odd behavior.

Move the capacitor at C1. Originally it goes between the diode’s output and ground. The boosting goes away if it’s moved to between B+ and ground, and then gate/pulldown resistors are no longer needed. In existing designs replace the gate resistor with a jumper. In new designs their pads can be eliminated entirely, freeing up valuable space.

 


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?
Tom E
Tom E's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 08/19/2012 - 08:23
Posts: 13396
Location: LI NY

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.

DEL
DEL's picture
Offline
Last seen: 2 years 8 months ago
Joined: 06/28/2015 - 08:35
Posts: 559
Location: Canada
Tom E wrote:

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.

ImA4Wheelr
Offline
Last seen: 3 months 1 week ago
Joined: 02/03/2013 - 14:51
Posts: 7932
Location: SC

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.

Tom E
Tom E's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 08/19/2012 - 08:23
Posts: 13396
Location: LI NY

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.

Tom E
Tom E's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 08/19/2012 - 08:23
Posts: 13396
Location: LI NY

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!

MRsDNF
MRsDNF's picture
Offline
Last seen: 8 hours 31 min ago
Joined: 12/22/2011 - 21:18
Posts: 13429
Location: A light beam away from the missus in the land of Aus.

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

 

djozz quotes, "it came with chinese lettering that is chinese to me".

                      "My man mousehole needs one too"

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

Tom E
Tom E's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 08/19/2012 - 08:23
Posts: 13396
Location: LI NY

Tanx! Not for nuttin, but how-u-doin?

MRsDNF
MRsDNF's picture
Offline
Last seen: 8 hours 31 min ago
Joined: 12/22/2011 - 21:18
Posts: 13429
Location: A light beam away from the missus in the land of Aus.

I wish my pea brain understood the language you all speak.Smile Daughters graduation tonight. She just came home from getting hair etc done. I wasn't sure it was her at first. Shes my last one at secondary school so next year all three of them are at Uni. 

And what would be Tom E be up to? Problem solving? I hope not. 

 

djozz quotes, "it came with chinese lettering that is chinese to me".

                      "My man mousehole needs one too"

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

texaspyro
Offline
Last seen: 1 year 3 months ago
Joined: 04/29/2011 - 12:43
Posts: 4593
MRsDNF wrote:
And what would be Tom E be up to?

Celebrating a crappy World Toilet Day, of course!

MRsDNF
MRsDNF's picture
Offline
Last seen: 8 hours 31 min ago
Joined: 12/22/2011 - 21:18
Posts: 13429
Location: A light beam away from the missus in the land of Aus.

You sound a little shitty TP? Did you miss out on an invite? 

 

djozz quotes, "it came with chinese lettering that is chinese to me".

                      "My man mousehole needs one too"

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

texaspyro
Offline
Last seen: 1 year 3 months ago
Joined: 04/29/2011 - 12:43
Posts: 4593
MRsDNF wrote:

You sound a little shitty TP? Did you miss out on an invite? 

I always celebrate World Toilet Day. Life sucks without your Porcelain Pal… and a lot of people on this world don’t have a decent one…

Tom E
Tom E's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 08/19/2012 - 08:23
Posts: 13396
Location: LI NY

My daughters (2) are all dun with school, out in the real world. My older one is a teacher and an assistant high school coach for girls soccer - watched them win the state championships over the weekend - NY catholic schools. She had a full ride at Providence College for soccer, Big East - those were the crazy days, all over the country to catch her play. Haven't seen a girls soccer game in a long time before this past weekend - brought back lot of memories...

MRsDNF
MRsDNF's picture
Offline
Last seen: 8 hours 31 min ago
Joined: 12/22/2011 - 21:18
Posts: 13429
Location: A light beam away from the missus in the land of Aus.

It sounds like exciting times again. You must be very proud of them. Smile

I spent a week in NY mid year and loved the place. I have no idea how anyone parks with a two inch gap between cars though. If I ever win the lotto I'd love to come back in the winter time.

 

djozz quotes, "it came with chinese lettering that is chinese to me".

                      "My man mousehole needs one too"

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

Pages