Main Content

Measure contactless the spindle speed with an optical reflection sensor.

I wanted to measure the spindle speed of my milling machine after replacing the motor and installing the PWM variable speed drive.

My first attempt
I had built a simple tachometer with an IR reflection sensor. On the table in the laboratory everything worked fine. But after tests on the milling machine the tachometer was showing fluctuating values and incorrect speeds. The cause of this misfunction was a lot of electrical noise in my workshop and strange high frequency stray currents on the ground wire. I identified part of the the source of the glitches as being contactors while switching and low cost Chinese switching power supplies. But some parasites remained unidentified.

I have tried filtering with LC lowpasses to reject high frequency glitches. But only with little success.

How the problem could be solved
The new tachometer is built with an optoisolation between the light reflection sensor and the arduino. A simple DC/DC converter supplies the current for the sensor and the amplifier stage. The signal is then transmitted to the arduino by an optocoupler.

Between the sensor area and the Arduino area, the parasitic capacitance should be kept as low as possible. So the isolation distance should be as good as possible and tracks proximity shall be avoided.

The tachometer itself
I’ve used as a sensor a SFH900. But any other reflective optical sensor like the TCRT5000 can probably do the job. A cable recovered from a PS2 mouse goes from the sensor to the board. The PS2 connector was salvaged from an old Pc’s motherboard…

The sensor’s LED is powered by R1 from an isolated DC/DC converter. C3 offers a low impedance path to short possible disturbances on the wires. For the sensor’s output, low pass filtering is achieved by C4 and R2+RV2 at around 530Hz (RV2 at 0Ω) down to 120Hz (RV2 at 10KΩ). This leaves room to measure at least 7200RPM. The signal is amplified by the PNP transistor Q6. The optocoupler U4 then transfers the signal to the D2 pin (Interrupt input) of the arduino. At the input there, a 530 Hz low-pass RC filter (R12-C13) removes the remaining oscillations. The speed is displayed on a 0.91 inch I2C OLED (128x32 dots).

The isolated DC/DC converter
It is buit around Q4, Q5, C5, C6, C7 and and a home made transformer. They work as a symmetrical oscillator at around 120kHz. The output is rectified with a Schottky diode bridge to lose as little voltage as possible.

If the output voltage is at the given value U3 (TL431) lets the current flow through the LED of the optocoupler (U2). The optocoupler output transistor shorts the Q3 gate to GND which then stops powering the oscillator.

The transformer
The transformer is built around a yellow + red Toroid (13 x 6.6 mm - 7.2 mm hole) recovered from an old PC power supply. The measured AL value is approximately 25-26 nH/N². A 2 mm thick PVC insulation wall is glued with Cyanoacrylate in the toroid core. The primary is wound with 2 wires in hand. The secondary is then wound in the free hole. The most protruding part from the insulation wall is glued on a piece of perfboard and the wires are connected to the pins. A little tape can help hold the wires in place while winding.

After the wires are soldered to the pins in the perf board, fix the copper coils with an insulating varnish (e.g. PLASTIK 70 from Kontakt Chemie).”

Link to article