Do I need to replicate part of this schematic?

This is to control a 12v cooling fan via PWM, I want to control 4 fans, so do I need to add 4 (zener) diodes or would one suffice?

I’ve drawn the schematic with the four diodes.

1 Like

Any forced-commutated charged inductor requires some means to manage the resultant “BackEMF” that is generated due to the current wanting to keep flowing. This is either done via dissipative means or via providing a freewheel path.

With 4 (brushed) DC motors in parallel there is an argument that you only require ONE freewheel diode. However, the devil is in the detail and the detail is in the specific layout and the resultant stray inductance between the DRAIN of your MOSFET and the ANODE of each FWD

My advice

  1. change the zeners for DIODES. There is no need to have a zener in this position, especially as their forward characteristics are not as good as a FRED.
  2. Place a zener across the MOSFET “just incase” because if the tracking results in a poor loop then the Zener will save your switching device
  3. assess at layout. if you can place the FWD in a suitable place to minimise the critical stray inductance then go with just one (suitably rated for power and current). If this cannot be achieved then 4off, each one positioned close to each motor

I tried to have a look at your screenshot, but it does not fit on my monitor.

Then I noticed all sort of overlapping texts and that is not a proper way to present info to others when asking for help, and I closed the screenshot.

Sorry, I’ll sort the text out and take a screenshot of the actual area that I’m asking a question about.

Most of the screenshots I make are explicitly from small area’s on the screen.
Take for example this tread:

I posted 12 screenshots there, most from complete windows, and they are still pretty small.

Apart from that.
Naib wrote a pretty good response.

This should be more relevant, I’ve taken @Naib 's advice and switched to FRED’s, as for point 2 I,m not sure where to but the zener, across the FET pins 2 & 3 as the Fet’s internal diode? Point 3, I’ll go with 4 the fans themselves will be 20-40 cm’s away from the PCB.

The “body diode” of a FET does not come into play for this type of circuit. By provisioning for an external ZENER 3 -> 2, you can mitigate any higher voltage situation that would result in an avalanche event.

Thank you so much, I’m only barely educated in electronics, but what you write makes perfect sense!

Some small remarks:
If you draw your motors next to each other, then it becomes more easily clear that they are all just parallel:


And one diode should suffice.

I also “inverted” the use of your optocoupler. In this way, when it is “off” (or defective, loose wires etc) the fans are turned off This could be an advantage or a disadvantage, depending on what the fans do.
If needed, you can also “invert” the function of the optocoupler again, by putting the PWM on the Cathode of the IR LED instead of the Anode.

[Edit] I *&^%$#@! thrice in the screenshot.
First I did not notice the 2N7003 can not handle > 300mA, and the second time I connected pin 4 of the optocouper to the “south” side of the fans instead of the +12V rails with the result the MOSfet could nod be opened fully. (Tnx Peter for catching this)
The third time was actually the first, by making a quick mockup in Eeschema and not saving it, so I had to choose between re-doing it again in Eeschema, or some pixel program which shows my temporary *&^%$#@! to the rest of the world.

Fourth *&^%$#@! probably was actually the 2nd, and that was noticing the big mouse cursor cross in the middle of the screenshot.

One of those day’s I guess…

cough depending on other influences

Indeed, especially with higher currents and… Lots of condiserations.

The most obvious thing glaring everyone in the face is that the 2n7002 is only rated for 300mA. It is unlikely that is enough for 3 fans!

Also, FET’s don’t immediately die when they are overvolted.
What happens is that the FET just starts conducting. It acts as a zener diode that clamps the voltage to the breakdown voltage of the FET. Of course whith both a high current and high voltage over the FET it heats up quickly and this overheating can cause the FET to let out it’s magic smoke and fail permanently.

Some MOSfets are “Avalanche rated” and specifically desgined to dissipate a specified amount of energy (usually specified in Joules) in this mode.

Naib’s advice is good. If you are driving brushless fans, it may not be necessary to have any diode but they are inexpensive enough and can always be omitted later if you are “pinching pennies.” I would consider using a schottky diode rated at least 500 mA and 40V.

Yes. The 2N7002 is probably too small a MOSFET for driving 4 fans. Several ohms of “on” resistance. Much better FETs are inexpensive; you could get one with 0.01 to 0.05 ohms series resistance.

EDIT: The larger schematic is not clear enough for me to see; not sure you need the optocoupler? Generally an optocoupler would only be needed if the fans are switched to a ground which is isolated from the ground reference of the controlling signal.

If space isn’t an issue then planning for other uses and contingencies is never a bad idea. Suppose you have a spare board and want to drive a different motor?

methinks that pin 4 of the optocoupler should be wired to a resistor going to the +12 V and not to the negative common of the fans ?

Until now nobody mentioned the distances to and the placement of the four fans : probably they are not sitting on the PCB and may be each fan needs a diode sitting nearby ?


I’m not 100% sure, but there is something about this circuit that is bugging me (and I can’t be arsed to simulate it). I agree in the concept it is trying to achieve, however the dynamic nature is what is bugging me.

for the 1st turn-on at t=0, the ability to turn-on will be delayed due to the stator inductance since at t=0 those parallel motors will appear as an open-circuit with an associated time-constant. This time-constant with equally influence the voltage that the GATE can increase by and thus the FET might be in its linear region longer than expected.
Now… lets assume the circuit has managed to establish the desired mean current in the windings… when the FET is OFF, the DRAIN will rise to around 12V - Vdiode and the FET is held off via the OPTO.
However… when the FET is commanded ON via the OPTO, initially the voltage at the ANODE of the diode will permit a voltage appearing at the FET’s gate. However, as the FET turn’s on, the DRAIN will be dragged down to ~0V (or whatever Ron * Id equals… ), but this voltage is also the voltage that is applied to the GATE (minus Vce of the OPTO). Theoretically it would turn-OFF (and then ON, OFF, ON… driven by the stray capacitance), in practice… it will settle at a voltage that just starts to turn the MOSFET on and either the motors will hardly turn or the MOSFET will burn out due to higher Rds, higher voltage across the device (etc).

I would pull Pin4 of the OPTO up to 12V, via a 100R resistor. This 100R resistor will limit the turn-on current flowing into the GATE

some of us have, in a roundabout way :wink:

I also agree with hermit:
It does not hurt to put the diodes on the schematic, and reserve space for them on the PCB. You can always decide whether to populate those spots with real diodes later.

Nope, this is a common misconception:

The reason is that you want to avoid abrupt current changes (especially over any sort of inductance.) Note here that long cables also have a significant inductance. If you put the diodes near the motors, then when the FET turns of, the motor current is direrected to the diode, but the current through the wire stops abruptly, and thus generates a voltage spike of it’s own.

The thing you want to protect with the diode is the MOSfet, and the diode should be placed close to the MOSfet. This way, when the MOSfet turns off, the diode redirects the current back to the “plus” side of the motor via the long wires. In this case the current through both the motors and the wiring decays “slowly” (depending on motor time constants).

Another way of saying the same:
If you put the diode close to the MOSfet, then the change in current path between the MOSfet on or off is minimal, and thus generated EMI is also minimal.

You may be right but I think we do not know enough about the fans : are these just DC motors, brushless, or fans with electronics inside ? Which type of load do they present ? At which frequency ?
I for my part I didn’t note in my first answer that the optocoupler is not for on-off control but for PWM power control :frowning:
Kind regards from France

The fans are computer case cooling fans, they run at 150ma each so a total of 600ma. The fans are to cool two LED arrays on a heat sinkthey will be mounted approximately 17 and 32 cm’s from the PCB.

I’ve redrawn the schematic with values, I’ll first show the schematic that is provided by the creator of the code for the ESP-32 board. The optocoupler is as far as I’m away to protect the ESP-32 in the event of a fault.

The original schematic.

My updated version.

I’ve selected the IRFZ44N transistor, is it a good choice? Also added a FRED diode, they’re not available in small quantities here and quite expensive.

Optocoupler is not strictly needed here, but that does not mean it’s a bad idea. As you already wrote, it protects your uC in case of faults, and you need something as a level converter anyway because an IRFZ44 has a too high threshold voltage.

It is also an easy way to be able to separate the GND returns of the high power stuff from signal wires.

Generally speaking using a pullup resistor as a gate driver for a power MOSfet is not a good idea. You want fast switching to limit power loss. But for a low current circuit like this it’s probably good enough. Designed in slow switching (Gate discharge time) also reduces EMI problems, and it also reduces the required speed for the freewheel diode.

If your diode is expensive or hard to find, then you can simply use the body diode of another IRFZ44. (Just short the Gate & Source). Do not let the gate float!

IRFZ44 & PC817 are both widely available from China (clones / fakes / refurbished / whatever) but very likely good enough for simple circuits like this. I would not use such part in production runs, but for tinkering the low price is attractive to have a bunch in your part bin.

Simple circuits like this I usually build directly on Matrix board. For single use there is not much to gain from designing a PCB. And electronics on Matrix board is easy to modify if needed.

Not sure why you would want a zener across the motors, generally a simple flyback diode across the motor (cathode to V+) will suffice to take care of back EMF during the off phase of the PWM signal or when you cut the motor off. Usually this is located right at the motor terminals. It wouldn’t hurt to have one at each motor, although if they are very close to each other and the driver with short cabling the added inductance would be small and you could probably live with a single flyback diode on the board. A more appropriate place for the zener would be across the 2N7002 to keep it from exceeding the Vdss(brk) but if you have the flyback diode across the motor, then the back EMF would be clamped anyway.

I’m also not sure what the purpose of the opto is. Why can’t you drive the 2N7002 directly via the micro’s PWM pin (with perhaps a series protection resistor in case the 2N7002 ever shorts)? You don’t have two isolated circuits so it isn’t for that. If I recall correctly the Vgth(max) is well under 5V logic levels, which you appear to be using for your micro.