A question came up on IRC regarding how to PWM a 3-pin PC fan with an Arduino using analogWrite(). Controlling the fan was seemingly straightforward. The problem was that the hall effect sensor, or TACH signal, was incredibly noisy. The noise made it impossible to measure the fan’s rotation. Working through the question, I found three issues to tackle:

  1. You need to use a PNP transistor
  2. Filter capacitors help
  3. Create a non-blocking RPM measurement (with millis())

This post addresses all three issues regarding how to PWM a 3-pin PC fan with an Arduino.

While the Arduino Project Team provides their official Arduino forums, sometimes real-time help is just a bit better.  When that is the case, I encourage you to visit the freenode.net IRC channel, #arduino.  While as of today it is not an official channel, there are a number of great people available to help. You can find me under the nick “baldengineer”, big surprise, I know.  Others like kline, Yoston and pwillard are also excellent people to ping with questions.