DIY Non-Contact Tachometer (RPM Meter) With Arduino and IR Sensor

by jendam99 in Circuits > Arduino

8370 Views, 125 Favorites, 0 Comments

DIY Non-Contact Tachometer (RPM Meter) With Arduino and IR Sensor

IMG_20220220_153532_HDR.jpg

A RPM meter is a simple device that is especially useful for example in a machining workshop to meassure the RPM of a machine's spindle and thus determine the surface speed of a tool or workpiece.

I decided to build this one device after seeing a video by GreatScott, but unfortunately his design did not work well for me. I only took the basic principle of the project from his work and modified and improved it so that I would be happy with it.

Supplies

To make this project, you will need:

  • 1x Arduino Nano
  • 1x IR distance sensor module (link to AliExpress here)
  • 1x 0,91" 128x32 OLED display module (link to AliExpress here)
  • 1x 90 degree tactile switch
  • 1x slide switch
  • 1x TP4056 charging module with a mini USB connector (link to AliExpress here)
  • 1x Li-ion battery (I used a 48x30x6 mm, 900 mAh one)
  • Project PCB (single sided, can be made at home, if you know how)
  • Some resistors and capacitors
  • Some screws, washers, nuts and stand-offs
  • 3D printed case (made of 5 parts)

Make (get) the PCB

Schema_2.0.png
LAyout.png
IMG_20220207_190822.jpg
Snímek obrazovky 2022-07-13 004147.png

First step is to make (or order) the PCB. It was designed as a single sided THT board with one wire jumper on the top side. If you want to make the PCB yourself, you can find a ready to print PDF file in attachments (just make sure your printing it in 100% scale).

Once the PCB is etched, most holes can be drilled with a 0,8 od 1 mm drill bit. Only the mounting holes (in the corners), the hole for securing the IR module and holes for the tactile switch need to be drilled larger.

If you can not make the PCB yourself, use this link to download gerber files. With gerber files you can order the PCB at basically any manufacturer.

Next the board needs to be populated according to the schematic and part layout. Use a female header for connecting the OLED display. The IR module and Arduino need to be soldered directly to the PCB so that the board would fit in the case. (If you don't want to, you do not have to solder all the pins of the Arduino. Only the pins that are being used have to be soldered. It is easier to remove or replace the Arduino if not all pins are soldered).

During the assembly, don't forget the one wire jumper on the top side of the board (red on the board layout picture).

Downloads

Upload the Sketch to the Arduino

Once the board is made a assembled we need to upload code to the Arduino Nano, which will serve as the brain of the whole device. The code is quiet simple. First we include the library for the oled display. Here the correct display type needs to be selected. If you are plannning on using a different version of the OLED display than I used, you need to change the display type. For different display types look either at the github page of the display library, or into the exapmle sketch.


Once the display is set up, some variables need to be declared as well as the IO pins need to be defined. If you use my board design, you do not have to change anything in this section.


The IR module used to sense the reflection of the IR beam from the white (tape) spot is connected to the interrupt pin 2. Once it gets pulled LOW, meaning the light got reflected, predefined interrupt routine is executed. In our case simply "RPM" sequence is started, which first writes the count from a timer to a variable called "rpmtime", then resets this timer and finally sets the boolean variable tooslow to 0, saying the meassured RPM is in the meassurable range.


The rest of the code is than basically checking states of the button and "tooslow" variable and adjusting the on display shown data accordingly. The displayed RPM value is calculated from the previously recorded "rpmtime" value which simply represents the period of one rotation (time between two following beam reflections).

3D Printing the Case & Final Assembly

Spodni dil.png

At this point, most of the electronics is done and programming is finished too. Now we can move to the mechanical aspect of this project.


The construcion consists of 5 parts. All of them are designed to be 3D printed and are meant to fit my board design. If you want to use this enclosure, is very important, to use my PCB design because of the hole spacing and component placement.

All parts can be printed from PLA at 0.2 mm layer hight and about 30 % infill. For the small parts (button and support) it is better to use lower layer hight.

Parts description:

  • Middle part: is meant to hold the PCB, ON/OFF switch, button and is the most important in the whole construction. (Yellow in the picture)
  • Bottom part: houses the Li-Ion battery and its charger board. There are holes all aroung it to allow for same airflow around the battery and charger, as well as to let the user see the status LEDs of the TP4056 module. This part gets mounted under the middle part with wires going from the battery, through the predesigned hole in both parts up to the Arduino. (Blue in the picture)
  • Button: is... well... simply a button. It can be printed in a different colour to make it more visible. (Greem in the picture)
  • Support: is an afterthought part. After first build I noticed, that due to the display module being only supported on the header side, it tilted a little bit. This parts is meant co be glued to the under side of the display (with thin doublesided tape) to support it on the far end, where it would otherwise sag.
  • Top part: is basically a top cover which covers and protects the electronics and only makes the screen visible. (Red in the picture)


Case is held together with M3 screws. Three screws screwed directly to the plastic connect the top and middle part (The holes might need to be pre drilled with 2,5 mm drill bit).

4 M3 screws go from the bottom and screw into 8 mm plastic standoffs which have to be mounted to the PCB with a nut. These 4 screws hold together to middle and the bottom part.

There has to be one more standoff mounted to the PCB to secure the IR module in place. This standoff will be the only one facing upwards (towards the display). This standoff needs either a plastic nut to secure it, or a non conductive washer under the nut since there if the risk, that the nut could short some traces.

Both the battery and charging module are meant to be secured with doublesided tape. There are recesses in the bottom part for both of them, so it should be easy to position them correctly. The cable from the battery is supposed to go to the middle part through a predesigned hole. Through the hole the cables come close to the slide switch window, where you should mount and solder the slide switch. The slide switch is secured with two M2 or M2.5 mm screwed directly into the plastic.

Meassuring

To use this tachometer, you have to put a piece of white (or simply contrast) material on the meassured rotor (I use white electrical tape). Take a 6 mm wide piece of a white tape and glue it onto the rotor. The white strip acts like reflective spot which can be reliably sensed by the IR module. The module then simply counts the time between two reflections and calculates the RPM acording to it.

Once the strip is glued, simply point the tachometer towards the rotor from about 1 or 2 centimeters distance and press the button. The tachometer will start showing current RPM values and once you release the button, the screen will keep showing the last measured value.

Summary

Now the RPM meter is basically complete. The only thing left to do is to "calibrate" the IR sensor so that it reacts to the white tape reflection well. This is done with the trimmer on top of the IR module and it has to be done before closing the case from the top since there is no access to the trimmer through the cover.

Thank you for reading my instructable and enjoy your new tachometer. :-)