Daniel Porrey
Published © GPL3+

Use a PC Fan as a Sensor

Did you know that a standard three-wire PC Fan can be used as a sensor?

EasyProtip1 hour43,457
Use a PC Fan as a Sensor

Things used in this project

Story

Read more

Schematics

Fritzing

Code

Sample Sketch

Arduino
#include <Arduino.h>
#include "FanMonitor.h"

// ***
// *** Pins
// ***
#define FAN_MONITOR_PIN 5

// ***
// *** Define the FanMonitor instance to monitor
// *** the 3-wire fan.
// ***
FanMonitor _fanMonitor = FanMonitor(FAN_MONITOR_PIN, FAN_TYPE_BIPOLE);

void setup()
{
  // ***
  // *** Initialize the serial port.
  // ***
  Serial.begin(115200);

  // ***
  // *** Initialize the fan monitor.
  // ***
  _fanMonitor.begin();
}

void loop()
{
  // ***
  // *** Get the fan speed.
  // ***
  uint16_t rpm = _fanMonitor.getSpeed();

  // ***
  // *** Print the speed to the serial port.
  // ***
  Serial.print("Speed = "); Serial.print(rpm); Serial.println(" RPM");
  
  // ***
  // *** Delay 1 second.
  // ***
  delay(1000);
}

PC Fan Monitor Library

Credits

Daniel Porrey

Daniel Porrey

50 projects • 210 followers
I lead a software development team for a large Chicago based organization. I also develop applications personally.
Contact

Comments