10-07-2020, 04:35 PM
Hello,
Preface:
I'm planning an Electronic Leadscrew (ELS) conversion for my lathe, it involves an incremental rotary encoder driven by the spindle, and a stepper motor driving the leadscrew. An MCU decodes the spindle encoder's output and outputs appropriate steps signal to the stepper motor driver, depending on the thread pitch or a feed ratio selected by the user.
By reading the spindle encoder, the ELS MCU has very accurate knowledge of spindle RPM. It would be nice if this RPM can also be displayed on the laptop, to which Caliper2PC is connected. I would like to connect the ELS MCU to Caliper2PC in a way that Caliper2PC will "think" it's connected to an opto interrupter sensor.
My guess is:
Stereo Jack 2.5 mm
VCC - not connected
Signal - MCU pin configured as an output pin
GND - MCU ground
Every X counts of the spindle encoder, toggle the MCU pin value. X should be chosen based on spindle encoder counts per revolution, and max possible spindle RPM. In my case the spindle encoder is 1800 pulses per revolution, and I will process the quadrature output in either 2x or 4x mode (undecided yet), let's assume 2x mode, then it's 3600 counts per revolution. Let's say that the max spindle speed is 2000 RPM. According to Caliper2PC website, "The measurable spindle speed ranges from 3000 – 300 000 rpm (50 – 5000Hz)". 2000 * 3600 = 7 200 000 max impulses per second, we have to scale it down to 300 000. X = 7 200 000 / 300 000 = 24. This should make the MCU output a square wave similar to what would be produced by an opto interrupter with a 150 (3600 / 24) slot disk. Unless I made a mistake somewhere in my calculations
Am I on the right track with regards to the connections and the calculations? Would I need any pull-up or pull-down resistors? My guess is that there's a pull-up resistor on the Caliper2PC's side of the Signal pin, and no resistors would be needed on the ELS MCU side?
Thanks
--Gene
Preface:
I'm planning an Electronic Leadscrew (ELS) conversion for my lathe, it involves an incremental rotary encoder driven by the spindle, and a stepper motor driving the leadscrew. An MCU decodes the spindle encoder's output and outputs appropriate steps signal to the stepper motor driver, depending on the thread pitch or a feed ratio selected by the user.
By reading the spindle encoder, the ELS MCU has very accurate knowledge of spindle RPM. It would be nice if this RPM can also be displayed on the laptop, to which Caliper2PC is connected. I would like to connect the ELS MCU to Caliper2PC in a way that Caliper2PC will "think" it's connected to an opto interrupter sensor.
My guess is:
Stereo Jack 2.5 mm
VCC - not connected
Signal - MCU pin configured as an output pin
GND - MCU ground
Every X counts of the spindle encoder, toggle the MCU pin value. X should be chosen based on spindle encoder counts per revolution, and max possible spindle RPM. In my case the spindle encoder is 1800 pulses per revolution, and I will process the quadrature output in either 2x or 4x mode (undecided yet), let's assume 2x mode, then it's 3600 counts per revolution. Let's say that the max spindle speed is 2000 RPM. According to Caliper2PC website, "The measurable spindle speed ranges from 3000 – 300 000 rpm (50 – 5000Hz)". 2000 * 3600 = 7 200 000 max impulses per second, we have to scale it down to 300 000. X = 7 200 000 / 300 000 = 24. This should make the MCU output a square wave similar to what would be produced by an opto interrupter with a 150 (3600 / 24) slot disk. Unless I made a mistake somewhere in my calculations
Am I on the right track with regards to the connections and the calculations? Would I need any pull-up or pull-down resistors? My guess is that there's a pull-up resistor on the Caliper2PC's side of the Signal pin, and no resistors would be needed on the ELS MCU side?
Thanks
--Gene