NeuroAgent

How to Create a PWM to DC Converter for GPU Fan Control

Building a PWM to DC voltage converter for GPU fan speed control using discrete components: MOSFETs, optocouplers, and bipolar transistors.

How to create a PWM to DC voltage converter for controlling a graphics card fan speed using only n-channel MOSFETs (with a gate threshold voltage of approximately 4.5V), optocouplers, bipolar transistors, and passive components?

Circuit requirements:

  1. The input PWM signal has a duty cycle ranging from 29% to 100% and an amplitude of approximately 2V
  2. The output voltage should be adjustable from N (adjustable via a trimmer potentiometer) to 12V
  3. The circuit should support fan currents from 0.1A to 0.8A
  4. The fan tachometer signal should pass to the graphics card without modification
  5. The use of operational amplifiers, microcontrollers, or other integrated circuits is not permitted
NeuroAgent

Creating a PWM to DC Converter with Discrete Components

To create a PWM to DC voltage converter using discrete components, you’ll need a circuit based on n-channel MOSFETs, optocouplers, and bipolar transistors that will convert a 2V PWM signal into an adjustable DC voltage from N to 12V for controlling a graphics card fan speed.

Contents

Basic Principles of PWM to DC Conversion

PWM to DC conversion is based on filtering the AC component of the signal and obtaining the average value. When you apply a rectangular signal with amplitude U and duty cycle D to the input, the average output voltage will be: Uout=Uin×DU_{out} = U_{in} \times D.

For your case with a 2V PWM signal and duty cycle ranging from 29% to 100%, the output voltage will vary from approximately 0.6V to 2V. However, to control a graphics card fan, voltages up to 12V are required, so a power amplifier is necessary.

The key components used in the circuit are:

  • Optocoupler for galvanic isolation
  • n-channel MOSFET for current amplification
  • Bipolar transistor for additional amplification and control
  • RC filter for PWM signal smoothing

Circuit Design with n-channel MOSFET and Optocoupler

Main Circuit Structure

  1. Input stage with PC817 optocoupler

    • The optocoupler’s LED is connected to the PWM input through a current-limiting resistor
    • The optocoupler’s output transistor controls the amplification stage
  2. Amplification stage with bipolar transistor

    • Operates in switch or linear amplifier mode
    • Provides sufficient current to drive the MOSFET
  3. Power amplification stage with n-channel MOSFET

    • Controls fan power supply
    • Provides necessary current up to 0.8A

PWM to DC Converter Circuit

text
PWM_IN (2V) ──[R1]──┬──[LED PC817]──┐
                     │               │
                    GND             [Collector PC817]
                                       │
                                       │
                                       ├──[R2]──┬──[Base Q1 NPN]
                                       │        │
                                      GND      [Emitter Q1]──GND
                                                │
                                                │
                                                ├──[R3]──┬──[Gate MOSFET]
                                                │        │
                                               GND      [Source MOSFET]──GND
                                                          │
                                                          │
                                                          └──[Drain MOSFET]──[FAN+]──[FAN-]──12V
                                                          │
                                                          │
                                                         [R4]──┬──[RC Filter]──Vout (N-12V)
                                                               │
                                                              GND

Component Parameters:

  • R1: 220-330 Ω (current-limiting resistor for optocoupler LED)
  • R2: 1-10 kΩ (optocoupler collector current)
  • R3: 1-5 kΩ (bipolar transistor base current)
  • R4: 100 Ω (zener diode or resistor for protection)
  • RC Filter: Consists of 1-10 kΩ resistor and 10-100 μF capacitor

Fan Current Control Circuit

To control current up to 0.8A with MOSFET turn-on voltage around 4.5V, components must be properly calculated.

MOSFET Requirements:

  • Drain-source voltage: ≥ 20V (for 12V margin)
  • Drain current: ≥ 1A (for 0.8A margin)
  • Turn-on voltage: ~4.5V (as specified)
  • Type: n-channel, logic level MOSFET

Suitable MOSFETs:

  • IRLZ44N (55V, 47A, Vgs(th) = 1-2V)
  • IRF540N (100V, 33A, Vgs(th) = 2-4V)
  • IRF640N (200V, 18A, Vgs(th) = 2-4V)

MOSFET Control:

Since the MOSFET turn-on voltage is 4.5V and the optocoupler output can only provide 5V, a bipolar transistor must be used as a current amplifier. Transistor Q1 will operate in emitter follower mode, providing sufficient current for fast MOSFET switching.


Tachometer Signal Path

The fan tachometer signal typically has a frequency proportional to RPM and should pass through unchanged. For this, the circuit must have a separate output for the tachometer.

Tachometer Circuit:

text
FAN_TACH ──[R5]──┬──[TACH_OUT]
                 │
                [Protection Zener]
                 │
                GND

Parameters:

  • R5: 1-10 kΩ (current-limiting resistor)
  • Protective zener diode: 5.1V for protecting the graphics card input
  • Connection: Direct connection to fan without affecting control

Component Selection

Optocouplers:

  • PC817 - standard optocoupler with CTR=50-600
  • MCT2E - faster optocoupler for high-frequency PWM
  • PC900 - alternative to PC817

Bipolar Transistors:

  • 2N2222 (NPN, Ic=800mA, Vce=40V)
  • BC547 (NPN, Ic=100mA, Vce=45V)
  • 2N3904 (NPN, Ic=200mA, Vce=40V)

Resistors:

  • Tolerance: 1% for resistances in feedback circuits
  • Power rating: 0.125-0.25W for most applications

Capacitors:

  • Filtering: Electrolytic 10-100μF/25V
  • Bypass: Ceramic 0.1μF for high-frequency filtering

Assembly and Calibration

Step-by-Step Calibration:

  1. PCB preparation:

    • Use a board with sufficient conductor cross-section for currents up to 1A
    • Place components considering heat dissipation at the MOSFET
  2. Input stage assembly:

    • Connect the optocoupler observing polarity
    • Install current-limiting resistor R1
  3. Amplification stage setup:

    • Connect bipolar transistor Q1
    • Set resistor R3 for required base current
  4. Power stage mounting:

    • Install MOSFET with heat sink if necessary
    • Connect RC filter for smoothing
  5. Calibration:

    • Use a trimmer potentiometer to adjust minimum voltage
    • Check speed control linearity

Functionality Testing:

  1. Input signal: Apply PWM with 2V amplitude and 29-100% duty cycle
  2. Output voltage: Measure output voltage (should be from N to 12V)
  3. Current consumption: Check fan current (0.1-0.8A)
  4. Tachometer signal: Verify frequency is proportional to RPM

Alternative Approaches and Optimization

Alternative Circuits:

  1. Two-MOSFET circuits for improved dynamic characteristics
  2. Using Darlington pairs for increased gain
  3. Current source circuits for more stable control

High-Frequency Optimization:

  • Fast optocouplers (6N137) for PWM above 1kHz
  • MOSFET driver circuits (though requirements forbid ICs)
  • Optimized RC filters with faster response time

Noise Protection:

  • Power supply filtering with 100nF and 10μF capacitors
  • Reverse voltage protection with diode across fan
  • Noise reduction with wire shielding

Sources

  1. PWM MOS Driver with Optocoupler | Makerfabs
  2. How to drive a MOSFET with an optocoupler? - Electrical Engineering Stack Exchange
  3. MOSFET switch using an optocoupler - Electrical Engineering Stack Exchange
  4. Converting PWM to DC voltage - Electrical Engineering Stack Exchange
  5. PWM to DC Conversion Circuit Frequency to DC Converter
  6. Driver design for PWM control with MOSFET

Conclusion

Creating a PWM to DC voltage converter using only discrete components is quite achievable. The main points to consider are:

  1. Proper optocoupler selection - PC817 is a standard solution, but faster alternatives may be needed for high frequencies
  2. Signal amplification - a bipolar transistor is necessary to control a MOSFET with 4.5V turn-on voltage
  3. Filtering - the RC circuit should be calculated for the required cutoff frequency
  4. Thermal protection - the MOSFET may heat up at currents up to 0.8A, so a heat sink may be required

For practical implementation, it’s recommended to start with a basic PC817 and 2N2222 circuit, gradually optimizing components for your specific requirements. The tachometer signal should pass directly through a protective resistor and zener diode without affecting the main control circuit.

Alternative approaches include using two amplification stages or optimizing RC filters to achieve better fan speed control linearity.