Digital tachometer with an IR sensor and I2C LCD on Arduino: design worksheet and code

A ₹910 design worksheet for measuring shaft speed in RPM with an IR sensor and reflective tape, with the period-to-RPM maths, an interrupt-based sketch and the limits of the method.

About the author · Editorial & verification standards

  • Parts₹910
  • Bench time3–5 h
  • LevelIntermediate
  • ReviewedNov 2026

A ₹910 non-contact tachometer for fans, motors and wheels. A small IR sensor sees a piece of reflective tape on the shaft each turn, the Arduino measures the time between pulses and converts it to RPM, and a 16×2 screen shows the result. The page covers the maths, why timing beats counting at low speeds, and what limits the top speed.

Scope: intermediate. This is a design worksheet with illustrative costs. It has not been bench-tested by this site. The period-to-RPM table was computed by script. Do not hold anything near a spinning fan blade or shaft while it runs; fix the sensor to a stand and keep fingers, loose hair and sleeves clear. The speed limits of the sensor module depend on the part and are not stated here as fact.

How it works

With one piece of tape, the sensor gives one pulse per turn, so RPM = 60,000,000 divided by the period in microseconds. A 20 ms period is 3,000 RPM and a 100 ms period is 600 RPM. With two pieces of tape the pulses per turn doubles, so divide by that number as well.

Timing the gap between two pulses with micros() gives fine resolution even at low speed. Counting pulses for a fixed window gives only whole counts, which is coarse when the shaft is slow: at 60 RPM with a one-second window the count is 1, which is a 100 percent step. The sketch shows RPM as zero if no pulse arrives for two seconds, which sets its lowest reading at about 30 RPM.

Bill of materials

PartQtyUnitTotal
Arduino Uno R3 (or compatible)1₹550₹550
IR obstacle or reflective sensor module1₹40₹40
16×2 LCD with I2C backpack1₹250₹250
Reflective tape1₹20₹20
Jumper wires1₹50₹50
Parts total₹910

Scroll the table sideways to see every column.

Prices checked Nov 2026. Shipping and tools are not included.

Prices are illustrative figures for Indian sellers in November 2026, before shipping, and have not been checked against current listings.

The numbers

Pulse periodPulses per turnRPM
500 ms1120
100 ms1600
20 ms13,000
10 ms16,000
10 ms23,000
5 ms26,000
RPM = 60,000,000 / (period in µs × pulses per turn).

The Uno’s micros() counts in steps of 4 microseconds, so even at 6,000 RPM (10 ms period) the timing step is 0.04 percent, which is far smaller than other errors. The real limits are the sensor’s response time and whether the tape pulse is wide enough to register.

Power and wiring

PartConnects toNote
IR module OUTD2 (interrupt)Check whether the output goes low or high on tape
IR module VCC and GND5V and GND
LCD SDA / SCLA4 / A5I2C backpack address is often 0x27 or 0x3F
LCD VCC and GND5V and GND
Aim the sensor 1 to 3 cm from the tape; adjust the module’s potentiometer until its indicator LED switches reliably.

The sketch

// Digital tachometer: Uno + IR sensor module + I2C LCD
// Design worksheet: check the LCD address and the sensor polarity.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

const int SENSOR = 2;
const int PULSES_PER_TURN = 1;
const unsigned long MIN_GAP_US = 1000UL;       // ignore pulses closer than 1 ms
const unsigned long TIMEOUT_US = 2000000UL;    // no pulse for 2 s: show 0

LiquidCrystal_I2C lcd(0x27, 16, 2);

volatile unsigned long lastUs = 0, periodUs = 0;

void onPulse() {
  unsigned long now = micros();
  unsigned long gap = now - lastUs;
  if (gap < MIN_GAP_US) return;                // reject noise
  periodUs = gap;
  lastUs = now;
}

void setup() {
  pinMode(SENSOR, INPUT);
  attachInterrupt(digitalPinToInterrupt(SENSOR), onPulse, FALLING);
  lcd.init(); lcd.backlight();
  lcd.setCursor(0, 0); lcd.print("RPM");
}

void loop() {
  noInterrupts();
  unsigned long p = periodUs, last = lastUs;
  interrupts();

  float rpm = 0;
  if (p > 0 && (micros() - last) < TIMEOUT_US) {
    rpm = 60000000.0 / ((float)p * PULSES_PER_TURN);
  }
  lcd.setCursor(0, 1);
  lcd.print(rpm, 0);
  lcd.print("      ");
  delay(250);
}

If readings are double what you expect, there is probably a second reflective patch or the module triggers on both edges of a wide strip; use only a narrow tape and one edge. If the module output goes high on tape, change FALLING to RISING. The sketch has been proofread but not compiled on this site.

Test plan

  1. Known speed: measure a fan or a drill at a speed you can verify another way, such as a phone slow-motion count of a marked blade.
  2. Tape width: try narrow and wide tape and compare how steady the reading is.
  3. Distance: find the range of sensor distances that gives a reliable pulse.
  4. Ambient light: try in sunlight and indoors; IR in sunlight can wash out the module.
  5. Low speed: turn the shaft by hand and see the reading around 30 to 60 RPM.
  6. Two patches: add a second tape patch and set PULSES_PER_TURN to 2.

What usually goes wrong

SymptomLikely causeFix
Reads doubleTwo pulses per turnUse one narrow patch or set PULSES_PER_TURN to 2
Reads zeroNo pulsesCheck sensor distance and the indicator LED
Jumps aroundReflections from other surfacesBlack out the surroundings and use narrow tape
LCD blankWrong address or contrastTry 0x3F and adjust the contrast screw
Wrong at high speedSensor too slowUse a faster sensor and less tape

Upgrades

  • Averaging: average the last few periods for a steadier display.
  • Max hold: add a button that holds the peak RPM.
  • Logging: send RPM over serial and plot it.
  • Hall sensor: use a magnet and a Hall sensor on dirty shafts.

Cost and parts notes

The ₹910 total is an illustration and does not include shipping. Use the cost calculator to compare sellers.

Common questions

Why measure the time between pulses?

It gives much finer resolution at low speed than counting pulses in a fixed window.

How do I measure a wheel?

Put a patch on the wheel; each turn gives one pulse. Multiply RPM by the wheel circumference for distance per minute.

Why show zero after two seconds?

With no pulse for that long, the speed is below about 30 RPM or the shaft has stopped.

Is it safe on a fan?

Only with the sensor clamped clear of the blades. Never hold your hand near a spinning part.

Last reviewed: November 2026. This is a design worksheet with illustrative costs. It has not been bench-tested by this site; library names, pins and limits must be checked against your board and the current library versions, and measurements from your build are welcome.

More builds

Next builds to try

Free: the final-year project pack

A shortlist with BOMs, a report outline that matches the usual chapter scheme, a costing sheet and 40 viva questions. Built for the February–April submission season.

The Build Note

One short email when something is worth your bench time.

A new build sheet, a part price that moved, or a mistake worth avoiding. No daily drip, no recycled news.

One short email when a build or a price is worth your time. Unsubscribe in one click.