Arduino ProjectsDIY Projects

DIY Tachometer to Measure Accurate RPM using Arduino ESP8266 ESP32

Learn how to create DIY Tachometer by interfacing IR sensor module with Arduino or ESP8266 or ESP32 to measure accurate RPM.

In this tutorial, learn how to interface IR sensor module with Arduino or ESP8266 or ESP32 to build an accurate Tachometer which measures RPM of a rotating object and display the measured values on 16×2 LCD display module. This cheap DIY IR based Tachometer is accurate than other laser based Tachometers which comes under the range of 50$ in the market.

What is Tachometer and RPM?

The tachometer is nothing more but measuring instrument that is used to measure rotating elements, to determine the number of turns that it makes on its own axis in certain amount of time, which depends on its speed.

The unit of measurement of the tachometer is the revolutions per minute (RPM), since you have to understand that revolutions mean turns, then it would be the number of turns that the element makes, for each minute.

The word tachometer has an origin in the Greek vocabulary, the prefix “Tacko” means speed or high speed and for its part, the suffix “Metron” is translated as measure. So, this is why I affirm that the tachometer is an instrument that measures speed.

Working of IR sensor module

This DIY Tachometer is cheap and works with the principle of Infrared waves. Infrared waves has wavelength longer than the visible light, so they are not visible to our human eyes.

Here we are using an IR sensor module which contains two IR LEDs, one is to emit the IR rays which is called IR Transmitter, and another IR LED which is also called as IR Photo Diode which acts as a IR rays receiver or IR sensor.

IR transmitter LED looks same as normal LED but the IR rays emitted through it are not visible to human eyes, and IR receivers comes in the forms of photo diodes which are not same as normal Photo diodes as IR diodes receive only InfraRed rays.

When the IR sensor module is powered on, IR transmitter emits IR rays and reaches to an object in front of it and few amount of IR rays are reflected back and according to the intensity of the received rays the IR receiver receives the IR rays and generate the voltage and outputs it through the OUT pin with the help of LM358 IC.

DIY Tachometer to Measure Accurate RPM using Arduino

In this method we are using Arduino to build the tachometer by interfacing it with IR sensor to calculate the RPM to display the RPM on 16X2 LCD display module with I2C adapter. Lets look at the required component and build it according to the Circuit diagram below.

Required components:

  • Arduino UNO board
  • IR sensor module
  • 16X2 LCD display module
  • Few connecting Wires.

Circuit Diagram interfacing Arduino and IR sensor module:

Connect all the Required components as shown in the below Schematic diagram.

diy tachometer interfacing arduino and ir sensor with lcd display

From the above wiring diagram you can see the IR sensor and LCD display VCC and GND are powered from 5V and GND pins of Arduino respectively. The OUT pin from the IR sensor module is connected to the digital pin 2 on Arduino. SDA and SCL pins from the LCD display are connected to A4 and A5 of Arduino respectively. That’s it for connection now lets upload the below code and see how this works below.

To connect the LCD display without I2C refer:

Source code:

After connecting all the components as explained above now copy the below code and paste it in Arduino IDE and Upload to Arduino after selecting the board as Arduino UNO and correct port number which you can get through device manager of your PC.

To download LiquidCrystal_I2C library click : Libraries

Working of IR tachometer:

After uploading the code when this device is powered on the, IR sensor’s IR transmitter transmits the IR rays and when an object comes in front of the sensor at a certain distance which can be adjusted with the help of onboard 1k potentiometer, these rays will get reflected back to the sensor photo diode which receives only IR waves and generates a voltage signal which outputs through the output pin as digital output with the help of LM358 IC.

According to the IR sensor working when an object comes in front of the emitted rays the sensor detects it as an obstacle and signal led lights up, and outputs a signal through OUT pin. When a rotating object rotates, for example a fan which has 3 wings rotates if we place the sensor in front of the rotating wings the sensor detects the wings and we can count the number of times the wings comes as obstacle before the sensor.

This output pin is connected to one of the digital pins of Arduino, with the help of interrupts and calculating the time, we can get the RPM value of the rotating object.

NOTES:

If you are using the disc type rotating object with black or other color other than white use a white tape as shown in the below image

diy tachometer disc shape rotating object applying tape

This IR sensor is light sensitive so, it may give errors in high lighting conditions.

Output:

You can see the below out on the LCD display module

diy tachometer with Arduino output on lcd display module

DIY Tachometer to Measure Accurate RPM using ESP32 or ESP8266.

In this method principle and working of the device is same except the interrupts and wiring. The interrupts which we used in the above Arduino example doesn’t work with ESP 32 and ESP8266( NodeMCU, Wemos D1. etc.) . So below you can get the wiring diagrams and source code which you can use to get the accurate RPM readings from the rotating objects.

First lets learn for ESP32

DIY Tachometer to Measure Accurate RPM using ESP32

Here we are using ESP32 instead of Arduino and ESP 32 has different type of interrupts than Arduino so the source code differs slightly than with Arduino. Through this we can measure the Revolutions per second and Revolutions per minute (RPM) of the rotating objects. This device gives stable results.

Circuit Diagram Interfacing ESP32 with IR sensor and LCD display

diy tachometer interfacing esp32 and ir sensor with lcd display

From the above wiring diagram you can see the IR sensor and LCD display VCC and GND are powered from 5V and GND pins of ESP32 respectively. The OUT pin from the IR sensor module is connected to the digital pin D2 (GPIO2) on ESP32. SDA and SCL pins from the LCD display are connected to D21 and D22 of ESP32 respectively. That’s it for connection now lets upload the below code to make it work.

To connect the LCD display without I2C refer:

Interfacing 16X2 LCD Module with ESP32 without I2C

Source code:

After connecting all the components as explained above now copy the below code and paste it in Arduino IDE and Upload to ESP32 after selecting the board as ESP32 Wrover board and correct port number which you can get through device manager of your PC.

To download LiquidCrystal_I2C library click : Libraries

After uploading the code the IR sensor reads the Rotations per second and Rotations per minute(RPM) and display those values on to the LCD display as shown from the above diagram.

DIY Tachometer to Measure Accurate RPM using ESP8266 – NodeMCU

This method is same as above ESP32 and this also measures the Revolutions per second and Revolutions per minute (RPM) of the rotating objects. This device also gives stable results. the only thing which differs from the ESP32 method is the Wiring which you can get from the below circuit diagram.

Circuit Diagram Interfacing ESP8266-Nodemcu with IR sensor and LCD display

diy tachometer interfacing esp8266 nodemcu and ir sensor with lcd display

From the above wiring diagram you can see the IR sensor and LCD display VCC and GND are powered from 5V and GND pins of ESP8266 respectively. The OUT pin from the IR sensor module is connected to the digital pin D6 (GPIO12) on ESP8266-NodeMCU. SDA and SCL pins from the LCD display are connected to D2 and D1 of ESP8266-NodeMCU respectively. That’s it for connection now lets upload the below code to make it work.

Source code:

After connecting all the components as explained above now copy the below code and paste it in Arduino IDE and Upload to NodeMCU after selecting the board as NodeMCU 1.0 and correct port number which you can get through device manager of your PC.

To download LiquidCrystal_I2C library click : Libraries

After uploading the code the IR sensor reads the Rotations per second and Rotations per minute(RPM) and display those values on to the LCD display as shown from the above diagram.

If you find this project helpful please share it with your friends, and if you have any doubts or got any issues regarding this project please feel free to comment below or ask us on Facebook community page “Circuit Schools“. Your interest makes us happy and help to add more projects. Thanks and happy creations.

CircuitSchools Staff

We at CircuitSchools publish on basics of electronics and electric components and everything related to evolution of electrical technology with complete analysis of development boards and modules along with latest projects with innovative ideas.

Related Articles

3 Comments

  1. Thank you so much for adding the code for ESP32, I searched a lot but dint found a working code, but when I added your code on Arduino IDE and compiled gave 0 errors, and I am getting stable results but are those accurate?
    Thanks,
    william

  2. Do you test these files before you post them? The Arduino file does not work. the first problem is there are no comment // on the first line in the code, the second problem is the LCD address in the code is different in the comment (0x3F) and where it is called out in the file (0x37). Once I got the LCD working. the code does not read RPM.
    would you please let me know what i have done incorrect

    //DIY Tachometer to Measure Accurate RPM using Arduino
    //This code is published by https://www.circuitschools.com
    //Attribution required to republish.
    < **** CODE ****>

    1. Updated few lines of code and tested on ArduinoIDE and got 0 errors, please check again and if you still found any errors, please let us know we will fix as soon as possible.
      Thanks
      Circuitschools Team.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button