I'm little confused about this one and don't know where to start. The idea is to have micro-controller or FPGA output PWM signal (5V or 3.3V while PWM is 100%), and then use a transistor to power ventilator that needs 12V to run.

I know that I need to connect grounds of ventilator's power supply and FPGA's (or μC's) power supply together. After that, I use resistor in series with transistor's collector to limit current.

The part that's bugging me is how to connect the base and the PWM output pin? Which resistor value do I need to chose if I want 3.3V to be 100% ? And which value do need if I want 5V to be 100% ? I mean, how can I "tell" transistor that 3.3V (or any other voltage that I'm operating on) is when it needs to power ventilator at 100% capacity?

I hope you can understand my question. Thank you for any answers !!


A (two-level) PWM signal has two states: high and low. Regardless of whether the supply for your FPGA/MCU is 5 V or 3.3 V, you want the low state to turn into 0 V across your fan, and the high state to turn into 12 V across it (or vice versa). That way, by varying the duty cycle of the PWM signal, you will be able to drive the fan all along its working range.

The transistor (which can be BJT or MOSFET) has to work either completely off or completely on, to dissipate the minimum possible. If the supply is 12 V, you don't need any resistor in series with the fan. The transistor's collector or drain will be directly connected to the fan. Also, use a Schottky diode in parallel with the fan, so that the cathode is at your +12 V node, and the anode is at the collector or drain. The fan is an inductive load, and you need to provide a path for its current, once you turn off the transistor. Otherwise, excessive voltage may build up at the collector/drain of the transistor, and you may damage it.

Assume BJT: You only need a resistor in series with the base, to limit the base current. We need to know how much current your fan draws, at 12 V (let's call that \$I_{fan}\$), and also the \$\beta\$ of your transistor (the current gain from \$I_{base}\$ to \$I_{collector}\$). Choose the resistor this way:

\$ R_1 = \dfrac{V_{supply}-0.7}{10*\dfrac{I_{fan}}{\beta}} \$

\$ V_{supply} \$ is 3.3 or 5. The factor 10 is to have enough margin as to make sure that the BJT will never work in the linear region.


  • \$\begingroup\$ you're answers are so good and relatively detailed. Puts ppl like me to shame :( \$\endgroup\$ – efox29 Apr 26 '12 at 11:44
  • \$\begingroup\$ @efox29 Thank you, but never a shame. \$\endgroup\$ – Telaclavo Apr 26 '12 at 11:57
  • \$\begingroup\$ Proportional to \$D\$, not \$1-D\$. The transistor indeed inverts: collector is low when input voltage is high, but makes that the voltage over the fan is 12V when input is high. No inversion here. \$\endgroup\$ – stevenvh Apr 26 '12 at 12:07
  • \$\begingroup\$ @stevenvh Right, just a lapsus. I'll edit. \$\endgroup\$ – Telaclavo Apr 26 '12 at 12:09
  • 1
    \$\begingroup\$ @xx77aBs \$\beta\$(f) is in fact a function of frequency. hFE is \$\beta\$ at DC (f=0), and for common-emitter configuration (as in this case). So, strictly, I should have written hFE, but it is common to use \$\beta\$ instead. \$\endgroup\$ – Telaclavo Apr 26 '12 at 12:55

I see that Telaclavo has given you a good answer for a bipolar transistor. Here is what it would look like with the right kind of FET:

For low voltages like 12 V, FETs are available that turn on well enough with only 5V or even 3.3V on the gate. These are sometimes called logic level FETs. The gate can then be driven directly from a CMOS digital output.

The diode is essential to not damage the FET. A motor will look inductive, so when you attempt to switch it off it will raise its voltage to whatever it takes to maintain the current until the resulting reverse voltage eventually causes the current to go to 0. This is sometimes called inductive kickback. Without the diode, that kickback current has no place to go and would raise the FET drain to a high voltage so that the FET eventually breaks down and thereby allows the current to flow. This is not good for the FET. A Schottky diode is a good idea here since they are fast, and at your low voltage they are readily available for suitable characteristics.


If I understand your question correctly, you are looking to control the power across your ventilator using PWM.

In which case, by having 100% duty cycle, the transistor will be switched on, and you would have your ventilator turn on at 12V



Another angle on this problem is to use a fan with a dedicated PWM input. Many suppliers offer this as a standard feature.

In my experience, many brushless DC fans don't like operating with chopped input power - you aren't able to get fine control of the RPM. Using a dedicated PWM input allows you very fine control of the speed, and since you're controlling a digital input (not chopping power) you only need a modest MOSFET and don't need a clamping diode.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.