Jog X axis from external step pulse

More
16 May 2022 12:28 #243079 by Aldulain
Hi all,

I need a bit of help figuring out how to synchronize two dual motor gantries.

One gantry is controlled by WinCNC and the second gantry is controlled by LinuxCNC.
Normally I would issue an MDI command with a set feed rate, however the two systems do not accelerate at the same rate, even though the acceleration values are set equally (150000/min/sec or 2500mm/s²).

My initial thought was to use the step pulse from WinCNC (this has the slower acceleration rate) as an encoder input to "jog" the x axis of LinuxCNC, this however requires two signals (ENCA+ & ENCB+)

So basically I want to know if there is a way to "step/jog" an axis from an external step pulse.

Step pulse is 5v (can be scaled with op-amp)

Alternatively I can put a rotary encoder on another pinion moving with the slower accelerating side and take wiring back to the LinuxCNC side.

LinuxCNC is using Mesa 5i25 with 2x 7i76

I don't want to directly step from drive to drive for a number of reasons, firstly this is unsafe, secondly both gantries are dual motor gantries and thirdly I need LinuxCNC to be aware of its position (otherwise I have to home every time this synchronized motion happens)

Jarryd 

Please Log in or Create an account to join the conversation.

More
16 May 2022 15:35 - 16 May 2022 15:37 #243086 by Aldulain
Hi all,

Ok a quick update.

I have figured out a solution for my use case (I only need one direction operation for this synchronization).

Setting the following parameter allows me to use 1 input signal for the encoder on phase A.
setp hm2_5i25.0.encoder.00.counter-mode 1

This is essentially frequency to velocity mode.
With this mode the counts decrease (negative), which work for my particular case, so I don't have to fiddle much further to get the counts increasing (positive)

Additional note to keep in mind, if you are using a 5v step signal in this way, make sure to common the GND on the mesa @pin 9 to the 0v for the 5v step signal. Your count won't change as expected otherwise.
(Be aware of floating voltages though, this is why you common)

***********
Jarryd
Last edit: 16 May 2022 15:37 by Aldulain. Reason: formatting - clarified phase A for counter-mode

Please Log in or Create an account to join the conversation.

More
16 May 2022 15:38 #243087 by Aldulain
I will do further testing on this tomorrow and post my encoder section should everything work fine.

Please Log in or Create an account to join the conversation.

More
16 May 2022 17:37 #243090 by PCW
You can get bidirectional operation by connecting encoder B to DIR
(Count mode uses B for direction)
The following user(s) said Thank You: andypugh, Aldulain

Please Log in or Create an account to join the conversation.

More
19 May 2022 09:55 #243328 by Aldulain
Hi PCW,

Thanks for the additional information.

Please Log in or Create an account to join the conversation.

More
20 May 2022 14:48 #243409 by dannym
>Step pulse is 5v (can be scaled with op-amp)

Just FYI a literal "op amp" would not be a good choice for a logic inverter. Once the output reaches "the rails", it has a recovery time during which it is going to be stuck there after the input tells it to invert.

A comparator is an analog-input, digital-output version of on op-amp.

But most stepper drives are 5v high-side opto. As such, an open-collector pull-down transistor is all you need. You don't need to drive high, the opto LED requires current to stay active and turns off quickly once the pulldown turns off. Since it's open-collector, it doesn't matter what voltage the drive has as its supply.

We can use optos to do this, but the isolation those provide isn't necessary. Simpler, better, more reliable is just a Darlington array like SN75468. We do prefer bipolar over MOSFET for these.
The following user(s) said Thank You: Aldulain

Please Log in or Create an account to join the conversation.

More
21 May 2022 07:40 #243464 by Aldulain
Hi Danny,

This was just a consideration if the 7i76 didn't react to the step pulses, mosfet would be the ideal candidate here as they are more responsive.
It does react to the pulses so this is not an issue.

I am however not getting any steps being generated when the step pulses are read, even when I connect a small rotary encoder to test.
I can see the x.jog-count changing and with PCW's suggestion I do get bi-directional motion with the direction signal on ENCB+.
x.jog-enable is being turn on/set true via an input on the 7i76.
I've tried with different x-jog-scale values to no avail.

I will be trying the 7i76 with sserial_port_0=200xxx so that I can test on the mpg inputs (TB3.16, TB3.17).
I am currently using the 7i76 high speed encoder inputs for this case (ENCA+ (Step), GND, ENCB+(Dir))

Below is the configuration I have set for the encoder:
loadrt hm2_pci config=" num_encoders=2 num_pwmgens=0 num_stepgens=10 sserial_port_0=100xxx"

# --- External Step Drive Config ---
setp hm2_5i25.0.encoder.00.counter-mode 1

net x-jog-count  <=  hm2_5i25.0.encoder.00.count
net x-jog-enable  motion.digital-input-21 <= hm2_5i25.0.7i76.0.0.input-21
net x-jog-count => axis.x.jog-counts
net x-jog-enable => axis.x.jog-enable
setp axis.x.jog-scale 0.0
setp axis.x.jog-vel-mode 0

I'll probably figure the problem out soon™ but input would be appreciated. I'm sure I've just overlooked something.

Please Log in or Create an account to join the conversation.

More
21 May 2022 08:27 - 21 May 2022 08:29 #243466 by Aldulain
Ok so just as I thought, soon™

I have figured it out and now I am getting the movement required.
The issue was the jog-scale.
I assumed having it at zero would have it be 1 step in = 1 step out (definitely not the case).

And remember to home the machine before testing new jog-scales 

Below is my working setup for the encoder setup.
loadrt hm2_pci config=" num_encoders=2 num_pwmgens=0 num_stepgens=10 sserial_port_0=100xxx"

# --- External Step Drive Config ---
setp hm2_5i25.0.encoder.00.counter-mode 1

net x-jog-count <= hm2_5i25.0.encoder.00.count
net x-jog-enable motion.digital-input-21 <= hm2_5i25.0.7i76.0.0.input-21
net x-jog-count => axis.x.jog-counts
net x-jog-enable => axis.x.jog-enable
# calc: unit / external machines step scale = jog-scale, e.g. 1 / 85.6854
setp axis.x.jog-scale 0.0116706
setp axis.x.jog-vel-mode 0
Last edit: 21 May 2022 08:29 by Aldulain.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

Time to create page: 0.133 seconds
Powered by Kunena Forum