In this tutorial, we are going to make Digital Tachometer using an IR Sensor with the help of Arduino for measuring the number of rotations of the rotating Motor in RPM. Here we have interfaced the IR sensor module with Arduino and the 0.96 Inch OLED display to display the RPM count. The IR sensor module consists of an IR Transmitter & Receiver that can work as a Digital Tachometer for speed measurement of any rotating object. There are two types of tachometer one is mechanical and another one is digital. Here we are going to build an Arduino-based digital tachometer using an IR sensor module. So let's make it.


What is Tachometer and RPM?

The Tachometer is an RPM counter used to measure the number of rotation per minute. The unit of measurement of the tachometer is the revolutions per minute (RPM). So in short we can say that tachometer is an instrument that measures RPM.


IR Sensor Module

IR Sensor Module

IR sensor consists of an Infrared LED and a Photodiode. An IR LED is a special-purpose LED, that emits infrared rays ranging from 700 nm to 1 mm wavelength. Such types of rays are invisible to our eyes. In nutshell, a photodiode or IR Receiver LED detects infrared rays.

 IR Sensor Module Pinout



Operating Voltage

3.0V – 5.0V

Detection range

2cm – 30cm (Adjustable using potentiometer)

Current Consumption

at 3.3V : Approx. 23 mA
at 5.0V: Approx. 43 mA

Active output level

Outputs Low logic level when an obstacle is detected


Working Principle of Tachometer

A tachometer works on the principle of Infrared waves. When we power the InfraRed sensor module to the 5v,  Infrared LED  starts emitting infrared rays. These infrared rays reaches the object’s surface and this radiation gets reflected back to the IR receiver. The Photodiode or IR receiver detects the infrared light and produces output accordingly. In our case, this reflected infrared light is used to measure the RPM of the motor.


oled display pinout

OLD Display Module Pinout


Components required

Software Required

  • Arduino IDE


Circuit Diagram

RPM Meter Circuit Diagram

Follow this table to make your connections.

IR module pins

Arduino pins


3.3 V






OLED pins

Arduino pins










Arduino Source Code

Here is a code for Digital Tachometer using IR Sensor and Arduino. Simply copy the code and upload it to your Arduino board using Arduino IDE software.

#include <Arduino.h>

#include <U8x8lib.h>

#include <SPI.h>

#include <Wire.h>

U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);

unsigned long rpmtime;

float rpmfloat;

unsigned int rpm;

bool tooslow = 1;

void setup() {



  TCCR1A = 0;

  TCCR1B = 0;

  TCCR1B |= (1 << CS12); //Prescaler 256

  TIMSK1 |= (1 << TOIE1); //enable timer overflow

  pinMode(2, INPUT);

  attachInterrupt(0, RPM, FALLING);


ISR(TIMER1_OVF_vect) {

  tooslow = 1;


void loop() {


  if (tooslow == 1) {


    u8x8.drawString(1, 0, "SLOW!");


  else {

    rpmfloat = 120 / (rpmtime/ 31250.00);

    rpm = round(rpmfloat);






void RPM () {

  rpmtime = TCNT1;

  TCNT1 = 0;

  tooslow = 0;




Project not working?

Ensure that the circuit you have made is according to the circuit diagram. Check for loose connections.

IR sensitivity issue?

There is a potentiometer on the IR sensor module. Adjust with the help of screwdriver as per your requirement.

OLED not showing values?

Ensure that OLED must be supplied with the proper voltage value. It works on I2C communication protocol.

  • SDA (Serial Data) – The line for the master and slave to send and receive         data.
  • SCL (Serial Clock) – The line that carries the clock signal.

Both the SDA and SCL must be connected to the arduino as per circuit diagram.

How to measure RPM of a rotating object?

Simply put a black paper on the rotating part and add some white paper over it such that the IR wave will get reflected from the white paper. 

Leave a comment

Please note, comments must be approved before they are published

Your cart