This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.
Hello There, Guest! Login Register

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Title: Tachometer signal generation


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?

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.

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


Forum Jump:

Browsing: 1 Guest(s)