mounted on the milling machine 

and the SFH900 sensor should be approximately 2-3mm. That's why I machined a small PVC wedge to the right distance.


After cleaning with acetone, the bottom of the spindle pulley is first painted with matte black paint. Take enough time to completely dry this black paint. The template is cut from self-adhesive cardstock. It's in the best central location. The white markers are drawn through the stencil. Note that the black part is at least twice as large as the white markings, you have to choose whether you want one or more reflective strips per revolution.


Number of reflective marks on pulleys that need to be inserted correctly in "Tachymetre.ino" in the line "#define nbrPulsePerTurn"

Since "timeOut" is 2s, the number of reflection marks determines the minimum speed that can be displayed, for example:


1 Reflective Marker - 30 RPM


2 Reflective Markers - 15 RPM


4 Reflective Markers - 8 RPM


10 Reflective Markers - 3 RPM

But the more markers there, the lower the maximum speed. For example, with 1 mark, you should be able to hit 7000 or 8000 RPM without precise settings. By using an oscilloscope to display the pulses on pin 2 of the arduinos and fine-tuning RV2 precisely, I can get to 20,0000RPM. To go higher, you have several levers. First, use a single marker with the best reflection. Mirror grade tape is the best I can test. Second, you can increase the current in the sensor LED (decrease the value of R1). Third, you can increase the cutoff frequency of the low pass filter (decrease the value of C4). Each time, set RV2 to the lowest possible value to get a signal at the D2 input of the arduino.

Set up the program 

as the spindle rotates slowly (100-300 rpm is fine), adjust the RV2 potentiometer so that the "LED_BUILTIN" on the Arduino turns steadily on or off as the white reflective bar passes the sensor. Try to find the limit by turning the RV2 clockwise and counterclockwise. If the limit is exceeded, the LED will flicker wildly or stay solid or off. Try setting it closer to the center, or counter-clockwise. With this basic setup, my tachometer can measure over 10,000 rpm for reflective marks per revolution or over 2,500 rpm for 4 reflective marks per revolution.

If you have access to an oscilloscope, display the signal on arduino pin D2. At faster spindle speeds, you can adjust it very precisely to measure the highest possible speed. 20,000 - 22,000 rpm can be achieved without modifying the low pass RC filter.

possible extension

If you need to measure higher speeds, here are a few things to start with:


Get strips that are more reflective than white paint

Increase the current in the sensor LED by lowering R1. Be careful not to exceed the maximum rating (for example, for the SFH900, the maximum LED current is 50mA. It is safe to stay under 30-40mA. The recommended operating current for all sensors I've tested so far is usually 20mA)

Increase the cutoff frequency of the RC filter by reducing the value of C4 and C13.