FETs and gate resistors - scope images

Tried a diode (axial IN5817 schottky) between LED +&-, absolutely zero effect on either the waveforms or on correct mode changing.

This is the 20DD again. No gate resistor.

I have to build 2 BLF drivers later on today, Iā€™ll definitely be trying this out on them. Because it removes the gate resistor it should make low slightly lower right?

Thanks for all the work, Iā€™m trying to finish up a few lights to make some money to buy one of those same oscilloscopes now that I see yours, Iā€™d never seen them before. One thing Iā€™m interested in looking at is the 1/2 off mode using Werners UI when using a long press to turn the light off from low (like in the video I showed you)

Well, without the resistor you can use a lower minimum PWM value, the resistor raises the point at which the LEDs will start making light. I guess one way of saying it (probably wrong, but...) is that the gate resistor reduces the resolution at the low end.

Hmm, interesting. Thanks for trying it. All 3 pictures in post #39 are with a 20DD board which has the IN5817 installed between LED+/-?

I could have made copies of each of the 3 pics and given them different names to differentiate between with output diode and without, because they look absolutely the same either way. :p (and it still wouldn't change modes right, and so far I haven't seen anything that will fix the glitchy mode changing issue that doesn't also fix the over-voltage thing)

Yes, same driver in all 3. From pic 1 to pic 2 it wasn't even shut off, I just stuck a wire onto both legs of the polarity protection diode while it was running. Then for pic 3 I removed the diode, added the cap in its place, and stuck the diode back on. The wires in and out and the scope probes weren't even disconnected for any of it.

This driver previously wouldn't work without the gate resistor, after adding the cap and removing the resistor it runs perfect:

:stuck_out_tongue:

  1. Your B+ trace is generated with the probe stuck where? Directly on the B+ contact pad I assume?
  2. The difference we see from bypassing the polarity protection diode is whatā€™s really intriguing me right now.
  3. The IN5817 was attached between BAT+ and the FETā€™s tab with the bar facing BAT+, right? Just confirming.

1. Yes... actually, the wire soldered to the + pad I intentionally left with enough exposed wire for the probe to clip onto. So it's about, what, 1mm or less from the pad? For pics showing the gate signal, I clip the probe directly onto the FET's leg. For the MCU pin 8 signal I remove the grabber attachment and use the pointy end and hold it on the pin. Probe grounds are clipped onto the driver's ground ring.

2. Me too, dude. dave_ said earlier that this particular combo of wire length*, capacitor (C1), and diode (D1) is creating a (very) crude boost circuit. There's no single component anywhere that is on purpose generating boosted voltage, I never thought that was the case... but 6V input on pin 8 results in, unsurprisingly, 6V output on pin 6. Whatever fix it takes to get pin 8 down to the actual B+ voltage is what will fix the erratic behavior. (completely removing the diode isn't a solution even if losing reverse polarity stuff would be acceptable, cause it screws up voltage monitoring and also the driver can't be reflashed unless the jumper across D1 is removed, it gives 'no communication...' otherwise. Other than all that, eliminating the diode would be the most simple fix, but not at all practical.)

3. Yup. It did so much of nothing I even reversed it, where of course it shut off the LEDs. 0:)

*The wire length can't be contributing all that much, since the drivers that act goofy on the bench also still act goofy when installed in a light.

As if I need more unexplainable stuff to throw on the pile, I have one really strange one. I have a BLF-SRK driver that has always run fine on all kinds of cells (INR 20R & 25R, Panasonic ICR 2900s), but absolutely freaks out and refuses to change modes or shuts off completely if I put in four Samsung ICR 28As (only charged to 4.20v, never tried with full charge to 4.30). I did the same extra 10uF capacitor trick on it, and it now runs perfect on the 28As. :~

With a big current change in a very short time, you donā€™t need all that much inductivity to charge a small cap to 6V. And if the mcu + fet drive takes less charge than the spike puts in, it will stay there forever. :slight_smile:
With your quite hard switching (high slope), thatā€™s what you get. :stuck_out_tongue:

Since iā€™m on limited mobile traffic I wonā€™t go searching for the actual circuit, but with ā€˜ddā€™
and ā€˜reverse protection diodeā€™, I imagine it somewhat like that:

When we draw in some of the parasitic inductance, it looks somewhat like that:

There is your booster. :wink:

To get rid of the effect there are several options:
-soften the switching (gate resistor)
-clamp voltage at mcu with suppressor diode (5.5V types should be available plenty)
-add snubber circuit to dampen the spike (in some way like your big el. cap now does)

Iā€™d probably try softer switching and one of the others. Whatever the easiest/cheapest is.

Congratulation you have found the problem, never have thought of overvoltage until now. :party:
Thanks for the pics in #39.
That is what I wanted to see. But I am a bit surprised that there is no spike in the diode bypassed pictureā€¦?

@dave we know why it is but why does a cap over the diode helpā€¦?

Oh no, I only used the big cap because it was at hand and easy to make contact with various points while watching the scope. I'm using an 0805 10uF/16V X7R, same part as the Nanjg's capacitor (and same as used on the BLF boards at C1). Are there any longevity/performance worries with doing it this way? It definitely does cure the problems that come from not using the gate resistor.

It's not perfect but if it fixes the problem, does it matter...?

@werner
parallel to the diode? We have not pure DC here, so current could flow through a cap back.

Since I am supposed to do work I really donā€™t want to, letā€™s look at it with spice. :smiley:

Here the circuit with the problem:

Now with cap in parallel:

looks familiar? :wink:
See the red curve, the current through the cap.

Here the falling edge zoomed in. (the cap current in blue is inverted. When it is negative, current flows to the mcu cap)
You can see how the mcu voltage (red) follows the voltage before the diode/cap (grey).
As soon as the voltage before the cap changes, current flows through the cap and the voltage behind the cap also changes. Works in both directions.
The ringing is just resonance with the inductor.
So, yeah, ac can get through a cap, probably sounds familiar too. :wink:

@comfychair
Well, if the cap has a half decent ripple current rating, itā€™s going to be fine.
It certainly is not a perfect solution with all that crap at the mcu vcc,
but that does not mean it is not a good enough and practical one. :wink:

Good work everyone. Daveā€™s info makes sense to me now. From his description (& spice sim) it seems that having a cap after the protection diode is integral to the unwanted boost circuit. What if we just move that input smoothing cap to before the protection diode? Iā€™m pretty certain thatā€™s not a perfect fix, but it seems to me that it would eliminate the boost circuit and just leave whatever remains of the spikes, similar to the diode bypass.

Thanks comfychair. Of course that all checks out. As you know I like to make sure Iā€™ve got a handle on the situation - detailed responses help with that. Based on what I know now I guess Iā€™d better throw some strike-thru in a previous post ;-).

Would that cap location work? It would just go from B+ to GND. It would be easy to try anyway. I do know the driver won't run AT ALL with the cap completely removed, but I never tried just a single cap from B+ to GND.

What about... using the zener/resistor regulator, even for the 4.2v drivers? That still provides reverse polarity protection, right? How would low voltage detection be affected, with a resistor in place of the D1 diode and zener between after the resistor and GND? That would effectively dump any excess voltage to ground (though very small current based on the resistor used). Or would that setup not generate the high voltage in the first place? I don't think I've ever tried a zener-modded driver in a single-cell layout...

Or is this second capacitor idea good enough? I mean, it looks better on the scope than even a totally stock 105C, right?

(Something that hit me last night, I worried that this cap+diode thing would screw up low voltage detection - pin 8 is now 2 whole volts lower than before, but I haven't compared what's present at pin 7 between the before-mod and after-mod drivers. I did a quickie check with a used CR123 and it steps down the same in the after-mod driver as it does with the same CR123 in a light with a before-mod driver. So if it's different, it's not vastly different.)

So, there is no cap from b+ to gnd?
Iā€™d try that then first. But keep the diode and vcc cap, just add one there.
With a little luck thatā€™s good enough.

Correct. There is only one cap in the stock BLF20DD circuit, it is placed after the reverse voltage protection diode. Is there a simple explanation of how this cap would be less effective if placed before the diode?

dave_ has probably pointed out the proper way to do this in post #53. I havenā€™t fully thought out what happens if you move the Vcc cap like I described in post #51. I figured that as long as the cap was still close to the ATiny it would still be able to filter for Vcc, and as long as we moved it to before the diode it would no longer form the unwanted boost circuit. Maybe dave_ can explain why part of that thinking is flawed? Until he shoots a big hole in my thought process Iā€™d love for you to try it both ways if you want ;).

In terms of the effect on voltage monitoringā€¦ yeah, looks like it would be affected on any drivers that sample battery voltage after the protection diode. Drivers which hook the divider up directly to B+ are unaffected. Do you get 6v on Vcc in every mode, or does the voltage of the boost circuit vary depending on PWM freq?

On the matter of whether what youā€™ve already done is good enough - I do not know. Iā€™m not a guru on this stuff, but it seems unconventional. If we can get better results with a conventional method I see no reason not to do it. If just moving the Vcc cap worked and was acceptable that would lower part count. It seems that this would be an unconventional solution as well though.

As to your experience in post #46 with w/ the ICR 28Aā€™s producing the problem and the other cells not doing itā€¦ Iā€™d immediately assume itā€™s higher Internal Resistance. The higher the internal resistance of a cell, the higher voltage will spike in a scenario like this.

Wow. Never figured that would have worked, because otherwise why would the 105C have the cap after the diode?

Good work!

Traditionally that cap should be as close to VCC as possible. Putting it after the diode helps achieve that goal and doesnā€™t cause the original 105c circuit to malfunction (even if it makes the ATtiny operate out of spec). Iā€™d assume that the original 105c was never modeled in SPICE or anything.

The cap after diode is made to buffer the voltage for the Controller which works perfect as we can see a bit to perfect as it never gets discharged and stays at 6Vā€¦.(post#39)
Cap between - and + will get discharged through the led if voltage breaks in and so its Not so steady DC which can lead to some Controller malfunctions.

The Zener mod to a standard mounted driver should be the best possibility, but would need extra parts.


Voltage protection is no problem because we flash the firmware by ourself anyway, the adc value just needs to be adjusted in the software, which I do anyway because I want a bit higher protection anywayā€¦ I always try the driver on a power supply if it works because the internal voltage from the ADC isnā€™t super accurate, but until now I never found a big mistake. I am also unsure if the voltage drop on the diode is 0.25V because the voltage only drops if current flows and there is just little current flowing, maybe you can measure it with the oscisoftware.
I have an excel sheet for easy calculating different values and get a clue which values are useful, you just fill in the resistors used and the voltage you want the protection kick in and the sheet says the value to select.

Werner is correct. If we go with the latest change (ā€œV2ā€ pic) the a new PCB layout should be made to push the diode and the cap very close to the VCC on the ATtiny. That way it will still be a decoupling cap (I think). As it stands it happens to work, which is good, but I think it would be hard to call that cap a decoupling cap anymore.

FWIW you never posted pictures or results from dave_ā€™s suggestiong (post#53). He recommended keeping C1 in place and adding a cap like you did in your ā€œV2ā€ picture. Iā€™m not sure exactly how that would pan out.

EDIT: Well, I want to clarify what Iā€™m saying. I donā€™t think itā€™s normal for a decoupling capā€™s operation to depend on a diode, so if Werner is saying that the cap must have a diode to keep the LED from pulling it down I donā€™t know if I agree with that. All Iā€™m saying (all I know to say :wink: ) is that for the cap to be effective it must be as close to the VCC pin as possible.