leser This article will describe how to non-contact measurement of spindle speed using an optical reflective sensor.

Purpose 

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

First try 

I built a simple tachometer with an IR reflective sensor. Everything works fine on the lab table. But after testing on a milling machine, the tachometer showed fluctuating values and incorrect speeds. The cause of this failure is a lot of electrical noise and weird high frequency stray currents on the ground in my workshop. I identified part of the cause of the glitch as the contactor when switching and the low cost switching power supply. But some other issues remain unrecognized.

I tried using an LC low pass filter to suppress high frequency glitches. But with little success.

How to fix 

I used a new tachometer to create optical isolation between the light reflection sensor and the arduino. The DC/DC converter provides current to the sensor and amplifier stages. Then the signal is transmitted to the arduino through the optocoupler.

The capacitance should be kept as low as possible between the sensor area and the Arduino area. Therefore, the isolation distance should be as good as possible, and the traces should be avoided.

tachometer 

I used SFH900 as the sensor. But any other reflective optical sensor like the TCRT5000 (not yet tested) will do the job as well. The cable recovered from the PS2 mouse connects from the sensor to the circuit board.

I also tested the sensor ITR20001, as well as the RPR220 and ST188. All three sensors work well. The distance between the sensor and the reflective marker should increase (6 to 12 mm, depending on the sensor). After fine-tuning the RV2, all three can measure up to 20,000 rpm with a white mark on each wheel revolution.

The sensor's LED is powered by R1 of the isolated DC/DC converter. C3 provides a low impedance path to reduce possible interference on the wires. For the sensor output, C4 and R2+RV2 are low pass filtered at approximately 530Hz (0Ω for RV2) to 120Hz (10KΩ for RV2). This leaves room to measure at least 7200RPM. This signal is amplified by PNP transistor Q6. The optocoupler U4 then transmits 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" I2C OLED (128x32 dots).

Isolated DC/DC Converter 

It surrounds Q4, Q5, C5, C6, C7 and a homemade transformer. They operate as symmetrical oscillators around 120kHz. The output is rectified through a Schottky diode bridge to lose as little voltage as possible.

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

Transformer 

The transformer is built around a yellow + red toroid (13 x 6.6 mm - 7.2 mm holes) recycled from an old PC power supply. The measured AL values are approximately 25-26 nH/N². A 2 mm thick PVC insulating wall is glued with cyanoacrylate in the toroid. The primary winding is wound with 2 wires. The secondary winding is then wound in the free hole. The most protruding part of the insulating wall is glued to a piece of perfboard and the wires are attached to the pins. A bit of tape can help hold the wire in place when wrapping.

After soldering the wires to the pins on the perf board, secure the copper coils with insulating paint.

Ring: Yellow + Red (13 x 6.6mm - 7.2mm hole)

Primary: 2 x 24 turns gauge 31 (Ø 0.22mm) (≈ 16 µH)

Secondary: 70 turns gauge 32 (Ø 0.20mm) (≈ 138 µH)

Insulation wall: PVC sheet, 2mm thick

Note, if you want to build it on perf board, be careful to respect the insulation barrier. In my case, I milled the PCB on a CNC 3018. MOS, bipolar transistors and optocouplers are not important. You just need to make sure the package and pinout are the same. Note that the resistors and capacitors are almost all in the 0805 SMD case. With the exception of the tantalum capacitors and R1 and C3 in the 1206 SMD chassis, there is plenty of room for the rails to run underneath. The value of the tantalum capacitor doesn't matter as long as the case fits in the footprint. But if possible, they should be 10V (minimum 6.3V).