

This driver would allow the PNP’s base to see a wide voltage range. If we add a NPN transistor before the PNP, it can be used to switch the high-voltage supply on and off. It seems kind of silly doesn’t it? Well, doing things right isn’t always easy.
#Arduino nano pinout pwm how to
To solve the problem of how to use a PNP transistor with an Arduino, you need to add an NPN driver. If you looked at the collector (shown as pin 2 in this diagram) on an oscilloscope, you’d see it stay a steady DC voltage. And you create an awkward voltage divider between the I/O pin and the base of the transistor. So the problem is that when the I/O pin is HIGH or LOW, there isn’t enough voltage to turn off the transistor. This circuit does present a problem when using 5 volts on the base and 12 V on the emitter.įigure 2: Oops. Instead, we can use a PNP transistor for the high-side switch. You were probably expecting it to be 11.3 volts, weren’t you? Well, that’s not how a NPN BJT works. Which means if there is 5 volts at the base, you only get 4.3 volts at the collector. When configured as a high-side switch the voltage from across V BE remains 0.7 volts. This circuit type switches the high voltage on and off, instead of ground. The proper way to power a fan is with a high-side switch. However, the lack of ground path means the switching can create electromagnetic interference (EMI). Regarding the fan’s operation, it will turn on and off as you expect. This method doesn’t provide a return path when the FAN is turned off. However, the problem with this approach is that you are switching the ground (GND) path. Most tutorials show an NPN transistor driving a motor as a low-side switch.
#Arduino nano pinout pwm Pc
This post addresses all three issues regarding how to PWM a 3-pin PC fan with an Arduino. Create a non-blocking RPM measurement (with millis()).Working through the question, I found three issues to tackle: The noise made it impossible to measure the fan’s rotation. The problem was that the hall effect sensor, or TACH signal, was incredibly noisy. Controlling the fan was seemingly straightforward.

A question came up on IRC regarding how to PWM a 3-pin PC fan with an Arduino using analogWrite().
