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?

BeginnerProtip1 hour78,744
Use a PC Fan as a Sensor

Things used in this project

Hardware components

3-Wire PC Fan
×1
Arduino UNO
Arduino UNO
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

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 • 314 followers
I lead a software development team for a large Chicago based organization. I also develop applications personally.

Comments