Upload
  • counter

  • speed

  • rotation

  • meter

  • tachometer

  • metre

  • tach

  • rpm

Warning: The potentiometer on some IR sensors may be in a slightly different position. I used the model of https://grabcad.com/library/hw-201-1. Make sure yours lines up.
Also, please adjust your potentiometer to a known rpm. Some readings may be too high because of debounce. Lower sensitivity until its as low as possible. 

Parts are designed to be glued in place.

DESOLDER PINS FROM OLED DISPLAY (removing black header spacer helps a lot). solder directly to pads

Hardware:
Arduino Nano with USB-C port, without headers (i used a chinese knock-off)

128X64 I2C OLED display (white text, 0.96)

IR proximity sensor (one clear led, one black LED.)


Wiring:
IR sensor OUT → D2
Display SDA → A4
Display SCL → A5
Connect all GND together
Connect all 5V together

Code:

#include <Adafruit_SSD1306.h>
#include <Wire.h>

#define OLED_RESET -1
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);

#define PULSE_PIN      2
#define DEBOUNCE_US    10000   // debounce threshold in microseconds

volatile unsigned long pulses = 0;
volatile unsigned long lastPulseTime = 0;
unsigned long lastTime = 0;

// Interrupt Service Routine with debounce
void countPulse() {
  unsigned long now = micros();
  if (now - lastPulseTime > DEBOUNCE_US) {
    pulses++;
    lastPulseTime = now;
  }
}

void setup() {
  pinMode(PULSE_PIN, INPUT);
  attachInterrupt(digitalPinToInterrupt(PULSE_PIN), countPulse, RISING);

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.clearDisplay();
  display.setTextColor(SSD1306_WHITE);
}

void loop() {
  if (millis() - lastTime >= 1000) {
    noInterrupts();
    unsigned long count = pulses;
    pulses = 0;
    interrupts();

    unsigned int rpm = count * 60;

    display.clearDisplay();
    display.setTextSize(1);
    display.setCursor(0, 0);
    display.print("RPM:");
    display.setTextSize(3);
    display.setCursor(0, 20);
    display.print(rpm);
    display.display();

    lastTime = millis();
  }
}

Originality of the Model

The author declares that this work is their personally original model

This model is licensed under the following terms:

Credit must be given to the creator

Models(3)

  • tachometer-bottom.stlDesigner

    125.08 KB

    2025-06-19

  • tachometer-top.stlDesigner

    130.55 KB

    2025-06-19

  • model file image
    Tachometer.3mfDesigner

    93.99 KB

    2025-06-21

  • View all(3)

No more