Caliper2PC
Tachometer signal generation - Printable Version

+- Caliper2PC (https://www.caliper2pc.de/forum)
+-- Forum: English (https://www.caliper2pc.de/forum/forumdisplay.php?fid=4)
+--- Forum: Hardware (https://www.caliper2pc.de/forum/forumdisplay.php?fid=5)
+--- Thread: Tachometer signal generation (/showthread.php?tid=25)



Tachometer signal generation - gene-pavlovsky - 10-07-2020

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 Smile

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


RE: Tachometer signal generation - Tomer - 10-17-2020

Hi Gene, and welcome to our Forum.

Your plan using an MCU output pin to emulate an RPM sensor is interesting and feasible without great effort. The throttling of the MCU output frequence is mandatory to stay within the range of 50 - 5KHz for the Caliper2PC S1 / S2 sensor sockets inputs.

In order to avoid damages, short circuits, false voltages etc. on the MCU and / or on the Caliper2PC interface, please use an optocoupler. The MCU output pin will drive the IR LED. A resistor must be used in series with the IR LED to limit the current to the working point of the LED (e.g. 10 mA). Please check that your MCU can deliver the current needed by the optocoupler's IR LED.

   

The optocoupler's transistor can be connected to the to the Caliper2PC interface the same way you would connect an ordinary optical sensor. Please follow the pin assignment for the transistor according to the picture attached.

   

Within the Caliper2PC software's Tachometer settings window the pulses / revolution and the multiplier can be set to fit the pulses generated by the MCU to your spindle's RPM.

   

Some pictures of your project will be very much appreciated.


RE: Tachometer signal generation - gene-pavlovsky - 10-20-2020

Tomer,

Thanks for the welcome and for the detailed reply. I do have some PC817 optocouplers.
Your explanation is clear, it seems easy to implement.
By the way, one period of HIGH signal and then one period of LOW signal - is that 1 pulse or 2 pulses?
Although I'm sure I can find that out experimentally Smile
I will share pictures once my project is done, which will be probably some time next year, as there are so many things to do Smile

Gene