The Tachometer library allows you to measure the rotational speed (RPM) using a tachometer sensor with an Arduino. It provides an easy interface to initialize the sensor, handle interrupts, and calculate RPM based on sensor pulses.
- Simple Initialization: Easy setup of the tachometer sensor pin.
- RPM Calculation: Accurate calculation of RPM with debounce handling.
- Customizable Revolutions: Configure the number of revolutions for averaging RPM calculations.
-
Manual Installation:
- Download the
Tachometerlibrary files. - Place the
Tachometerfolder into your Arduino libraries directory, typically found atDocuments/Arduino/libraries.
- Download the
-
Using the Arduino IDE:
- Go to Sketch > Include Library > Add .ZIP Library...
- Select the
.zipfile containing theTachometerlibrary.
You can create only one instance
Here’s a simple example to get you started with the Tachometer library:
#include <Tachometer.h>
const uint16_t SENSOR_PIN = 2; // Replace with your sensor pin
Tachometer tachometer(SENSOR_PIN);
void setup() {
Serial.begin(9600);
if (!tachometer.init()) {
Serial.println("Tachometer initialization failed!");
}
}
void loop() {
double rpm = tachometer.getRPM();
Serial.print("RPM: ");
Serial.println(rpm);
delay(1000); // Update every second
}