Do I need to replicate part of this schematic?

In my opinion it is not ‘very good’ schematic.
As I understand at input there are 5V. So the PC817 LED current IF is about (5-1.2)/0.3 = 12.7mA.
Looking in PC817 datasheet I see that for IF=5mA the output current is 2.5mA to 30mA so in worst case output current is 50% of input current so 12.7/2=6.35mA. And 6.35mA at R2 gives us dropout of only 6.35V. So you have no guarantee (in worst case) that you switch off the Q1.
I looks that PC817 are divided into classes with different CTR (output current/input current). Are you sure you will use the right class?
Optocouplers are needed when you want to have isolation but here you don’t. Here using optocoupler only one you get is the delay of slopes in the range 3us to 18us (look in the datasheet) and you don’t know what delay you will get for rising and falling slope.
You can replace PC817 here with really any NPN transistor (like BC547). As Ic/Ib for transistor is over 100 (for PC817 is over 0.5) you can change R1 to for example 2k2. You will get the circuit that will have much less delay of slopes from your output.
MOSFETs used in power circuits should be driven with special drivers assuring high current pulses (something like 1A) for fast switching MOSFET from off to on and from on to off. MOSFETs gate has relatively high capacitance needed to be reloaded, and during reloading it MOSFET stays in active region dissipating high power. May be your circuit is enough low power to not get into troubles because of it but I don’t know (I have never used MOSFETs in power circuits).

Ok, it seems that the circuit isn’t well received. I’ve being digging around and came across this circuit published on Digikey, what is the consensus on this? should I add some diodes to the circuit?

Here’s the link to the original article https://www.digikey.in/en/maker/blogs/2019/how-to-control-a-dc-fan-using-the-raspberry-pi

I think the best thing you can do is build the thing on a breadboard and check with an oscilloscope how good it works.

You can learn a lot from theory books and the 'net, but it is no substitute for hands-on experience.

Even with simulators you miss out on a lot of experience, from bad contacts, ground faults and other wiring faults that cause voltage drops induce garbage in other wires of the same cable, mixing up transistor legs because they all look the same and lots of other things.

Thanks, I get what you’re saying, though I don’t have access to a scope and for very rare use it’s not really a viable purchase, I will check if any repair shops have one though, mostly they only use multimeters over here, I was quite surprised when I had emigrated to discover this.

I did however reach out to the creator of the original circuit whom uses it for the exact same purpose and he’s given some part numbers which help clarify a few things to me. So that along with some of the suggested changes I’m going to draw the PCB, there’s not a lot of components on the board and to fabricate 5 boards doesn’t cost too much and if they do work properly I can sell on the 4 spares populated.

As IRF830 is 500V transistor than I don’t suppose 12V Fan can generate (when switched off) bigger then 500V pulse (internal capacitance will not allow, I think). So from that point of view diode is not needed.
But there could be the other reason to use diode in parallel to fun - do you want to reduce the current as fast as possible when you switch IRF off generating probably high voltage (may be 100V) pulses (no diode) or do you wont the current to be reduced slowly being kept by diode.

Being a student I used to earn extra money fixing electronic things. Among others I got some Mercedes electronic turn signal interrupters (in other cars there were not electronic ones). There were a small npn transistor driving a relay and there were no diode across the relay coil. The reason of not working each time was that 80V transistor being burned. I always replaced it and added a diode to protect transistor against overvoltage. Many years later I learned that the effect of slowing the switching of the current (by diode) is that contacts move away from each other more slowly what makes bigger chance the spark between them arises. So may be there were intentionally no diode to protect contacts. But the transistor they used should simply be for a higher voltage. May be in original design someone used such, but later someone else ‘improved’ that replacing transistor with cheaper one. Who knows :slight_smile:

For driving a load totalling around 600 mA you could probaly get away with directly driving a logic level mosfet. Maybe take a look at parts ending with 2302. Various manufacturers add their own prefixes to the part number and slightly change the specs, but it’s usually a 20 V, > 2.5 A logic level n-channel mosfet.

For brushless fans you usually don’t need a flyback diode, but it doesn’t hurt. You certainly don’t need a DPG10I200 as specified in your schematic. Any reasonably fast diode (schottky or maybe something from the UF400x series) should suffice there.

Thanks, the 2302 mosfet needs a minimum logic of 4v? (if I understood the datasheet correctly) I’ll be using 3.3v PWM, I found a bunch of others that should be ok, the one I’ve zoned in on is AO3416 as it’s for PWM applications, for the diodes I was also recommended a Schottky by the creator of the design, he had suggested SS56, unfortunately no online sources locally, however SS54 5A 40V is available, which should be fine.

This is an improvement, but with a 10k “turn-on” resistor and zero turn-off you are going to face issues. How sever depends on the switching frequency

On the ESP-32 the PWM is in software so can be changed, I’m not sure if the code that I’ll be using allows the frequency to changed on each channel, otherwise I’m limited to 100-1khz as that’s the LED driver PWM frequency range.

Edit, the creator of the code had written this in regards to the ESP-32 PWM “The frequency on 16 channels 33 kHz at a depth of 10-12 bits is already there, this is what I checked with an oscilloscope” translated from Russian.

No, most datasheets have a spec for R_DS(ON) at 2.5 V. But your alternative is fine and has more current capability.

As for the diode current rating, you don’t need any more than your maximum load current (as that will be your peak current through the diode for an inductive load). There is also no need to go for a higher voltage rating than the mosfet, as your supply voltage is limited by the lower rated of the two. Schottky diodes are also much more abundant and work better for lower voltage ratings (because physics). So even an SS12 would be fine, but of course check pricing and availability.

You will struggle todo 33k and a 10kR turn on resistor

Hi,

I know I’m a bit late to the party here but I figured I would share my thoughts anyway. It seems that this circuit is unnecessarily complex.

The circuit above should work fine given a few assumptions.

  1. The FET will be fully on with a gate voltage of 3.3V (Assuming thats the power rail of your MCU if the MCU is run from 5V you have opened up the range of MOSFETs you can pick)
  2. The FET can handle the sum off all the currents for each fan
  3. The Vds max is above 12.5V (your power supply plus the drop of the schottky)
  4. The MCU is configured as a push pull output.
  5. The schottky needs to be rated for the same current as you are expecting through the FET. Although you can get away with one it may be prudent to place a schottky right at the connection to each fan (4 schottkys) to reduce noise.

Without knowing the current draw of the fans I cant say this part will work for sure but this FET could be a good candidate:
https://www.digikey.com/en/products/detail/diodes-incorporated/DMN6068LK3-13/2179793

Let me know if the image doesn’t show and I can try to repost

Why do you think it is

Real-world applications often have extra protection circuitry to compensate for possible events.
For example, during a reset state, outputs of a microcontroller are often floating, and R1 prevents the fet in that case from turning on. When turned partially on because of a floating input, the FET can overheat and let out it’s magic smoke. (Fet’s don’t work no more after the magic smoke escapes).

The extra diode is also just an extra precaution. Sure, in some instances (avalanche rated FET’s) it can be omitted, but even in such cases it reduces EMI even if the circuit works without the diode.

By unnecessarily complex I was referring to the NPN/Opto coupling level shifting circuit to drive the NFET gate. IMO a level shifter would only be required if the FET chosen didn’t have the proper Vgs threshold. In addition to adding extra components, you can no longer drive using a push pull configuration. This limits the PWM frequency dramatically due to the MOSFET gate capacitance in combination with the pull up/pull down (I believe someone mentioned this earlier in the thread).

To account for start-up condition I recommended using a 10k pulldown. This should bias the circuit off unless driven on. That was R1 in the schematic. I also support the use of a flyback diode to protect the MOSFET (D1) however I think a zener is the wrong type of diode for the job which is why I recommended a schottky. Maybe my schematic didnt come through?

I do design circuits professionally so I have at least a decent idea of how circuits look in the real world ;).

I remembered the sentence:

I suppose the author of the schematic used as a start point by OP have heard somewhere than he can use optocoupler to protect controller board from any fault in output power circuits he was aware of.
This beginning circuit looks for me as typical when one software gay starts to design hardware.

Have you heard of the term “cargo cult engineering”? I find that many overcomplicated circuits are described well by it.

By the way,

even though you pronounce with an a sound, it’s written “guy”. To avoid confusion … :smiley:

Before sending it I copied it to Google Translator to check if everything is ok. I was little surprised with translation but assumed that probably there is deeper sense behind what I have written seen by translator and I accepted that meaning.
When the translation of my text I copied to be back translated into English I get:
“when one cheerful programmer starts designing hardware”.
Now I suppose it may be not exactly what I have written :slight_smile:

If you get four-pin fans, the fourth pin is a PWM pin, and then you don’t need a MOSFET or a flyback diode.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.