Optical system for motor RPM measurement