I've recently started playing with an Arduino and learning about circuit's. I was trying to learn a bit about using some transistors as a switch and I think in the process I ended up ruining one of the pins on my Arduino. When set to HIGH the pin only outputs 0.5 now rather than the 4.6ish the rest of the pins do.

The circuit I built involved two transistors. One to control a 12v fan via a PWM signal off the Arduino and another to act as a switch for turning on/off an ATX power supply which I used to provide power for the fan.

Here's an approximation of the circuit. I'm not really sure how to properly diagram it.


simulate this circuit – Schematic created using CircuitLab

To try and explain a bit, The Arduino was powered via the USB connection to the computer. Pin 11 is setup as a PWM output to control the speed of the fan. Pin 12 is setup as a HIGH output to switch on an external ATX power supply when the Arduino board turns on. I use one of the 12v rails on the power supply to power the fan, and have it's ground connected to the Arduino's ground.

Not shown in the diagram is a simply push button to increase the speed of the fan and a 7-segment led display showing a number representing the speed. I don't think these are related to my pin problem and I'm fairly certain it was all wired up correctly.

After doing a little more research I think the main issue which caused my pin problems is I should have had a current limiting resistor in between the Arduino pin and the base of the transistor. Is conclusion accurate?

Any additional comments/criticisms welcome.

  • \$\begingroup\$ Which transistor type are you currently using? What is the ohmic resistance of the fan? \$\endgroup\$ Jan 26 '16 at 7:05
  • \$\begingroup\$ "I'm not really sure how to properly diagram it.", a good start is to draw the voltage source the right way around, instead of upside down. \$\endgroup\$
    – pipe
    Jan 26 '16 at 7:37

Yes, your conclusion is correct. Just insert a 1K resistor in series with the base. But first try with a 10 K resistor and then keep on reducing it by 1K. For a more accurate value of the resistor, use this formula:

$$ R_{base} \approx {h_{FE}} \times \frac {V_{OH} - 0.7V} {I_{FAN}} $$


  • hFE is the transistor's current gain,
  • IFAN the fan current as measured when connected to the 12VDC source and
  • VOH the microcontroller's output high level voltage.
  • \$\begingroup\$ You discussed only Q1. But, one should add also a 10k resistor before the base of Q2 which pulls down PS_ON. \$\endgroup\$ Jan 26 '16 at 22:27

Yes, you should add a current limiting resistor in series with transistor base. You can design that transistor as a switch. Hope you know following parameters.

  • Ic - Required collector current
  • Vcc - Intended Collector Voltage
  • Vin - Input voltage to transistor, ie arduino output voltage

Now you can design it as follows.

  • Ib = Ic/ß (You can find ß or hFE from the transistor datasheet)
  • Rb = (Vin – Vbe)/Ib (You can take Vbe as 0.7V )
  • If you don't know the value of Ic, you can easily calculate it : Ic = (Vcc – Vce)/Rc

Try this link for more details : Design Transistor as a Switch

  • \$\begingroup\$ Vcc is not the intended collector voltage. It is the positive collector supply line voltage in a NPN circuit. The voltage at the collector is Vce here, and it should be near zero with a switch configuration. \$\endgroup\$ Jan 26 '16 at 22:22

i am assuming the "COM" in the ATX power supply is also connected to GND and the system ground. dunno what PS_ON means ("power supply ON") but is it an open circuit meant to be left floating for "OFF" and connected to ground (or COM) for "ON"?

in both cases, assuming the emitters are connected to ground, you want some resistance between the digital output and the transistor base. the \$V_{BE}\$ is only about 0.6v or 0.7v and the digital output is around 3 to 5 volts when high. so something needs to drop that voltage.

what value of resistance? what is the current gain (\$\beta\$) of the transistor? how much collector current flows when it is "on" (in saturation) given the loads hooked up to them?


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.