7i96s + 7i89 analog spindle and mpg troubles

More
01 Jun 2024 09:56 #302049 by JohnnyBeluga
ChatGPTCertainly! Here is a corrected version of your post for the LinuxCNC forum:Hi!I need some help with my LinuxCNC setup. I'm having trouble adding an MPG pendant and getting the spindle to work correctly. I have tried different solutions, but I'm obviously missing something. When I launch my configuration, I can jog the three axes through the GUI, but the MPG doesn't work. I tried adapting the custom HAL file with an example file and setting up the jog wheel through PNCconf. I'm also struggling with the spindle's analog control. I tested the spindle, and it works as expected with a variable voltage supply, reaching 2500 RPM at 5V.
Any hints or suggestions on what I might be doing wrong or what to check would be greatly appreciated!Thanks in advance for your help!

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

More
01 Jun 2024 13:05 - 01 Jun 2024 13:38 #302055 by PCW
net spindle-vel-cmd-rpm => [HMOT](CARD0).pwmgen.00.value

should be

net spindle-vel-cmd-rpm-abs => [HMOT](CARD0).pwmgen.00.value

Spindle section should be:
(assuming you are supplying 5V to 7I96S TB2 pin 24)


[SPINDLE_0]
P = 0.0
I = 0.0
D = 0.0
FF0 = 1.0
FF1 = 0.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 2500.0
OUTPUT_SCALE = 2500
OUTPUT_MIN_LIMIT = 0
OUTPUT_MAX_LIMIT = 2500


What is the issue with jogging?
Last edit: 01 Jun 2024 13:38 by PCW.

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

More
01 Jun 2024 15:00 #302062 by JohnnyBeluga
Thank you for the help, Yes I suppy 5v to TB2 pin 24. I made the changes in the .hal and ini files but spindle still doesn't move.

The jogging work trough the GUI but my MPG pendant doesn't work I tried to adapt the example file avaible for MPGs. The MPG switches part is in custom.hal and the handwheel in the main hal file.

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

More
01 Jun 2024 15:12 #302065 by JohnnyBeluga
After re-checking I had the wiring changed yeasterday to try the spindle with the variable power supply. I rewired and with your changes it's working well.

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

More
01 Jun 2024 15:25 - 01 Jun 2024 15:30 #302066 by PCW
As far as MPG jogging goes, you have the signal "axis-selected-count"
created but it does not seem to be connected to anything:

net axis-selected-count <= [HMOT](CARD0).encoder.02.count
Last edit: 01 Jun 2024 15:30 by PCW.

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

More
01 Jun 2024 15:44 #302069 by JohnnyBeluga
In need to connect each MPG function to a function present in the HALUI section ?
For the rotary switches to select the axis and the scale I used the example file :

loadrt mux4 count=1
addf mux4.0 servo-thread

setp joint.0.jog-vel-mode 0
setp joint.1.jog-vel-mode 0
setp joint.2.jog-vel-mode 0

setp axis.x.jog-vel-mode 0
setp axis.y.jog-vel-mode 0
setp axis.z.jog-vel-mode 0

setp mux4.0.in0 .0001
setp mux4.0.in1 .001
setp mux4.0.in2 .01

net scale1 mux4.0.sel0 <= [HMOT](CARD0).inm.00.input-04
net scale2 mux4.0.sel1 <= [HMOT](CARD0).inm.00.input-03

net mpg-scale <= mux4.0.out
net mpg-scale => joint.0.jog-scale => axis.x.jog-scale
net mpg-scale => joint.1.jog-scale => axis.y.jog-scale
net mpg-scale => joint.2.jog-scale => axis.z.jog-scale

net mpg-x joint.0.jog-enable <= axis.x.jog-enable <= [HMOT](CARD0).inm.00.input-02
net mpg-y joint.1.jog-enable <= axis.y.jog-enable <= [HMOT](CARD0).inm.00.input-01
net mpg-z joint.2.jog-enable <= axis.z.jog-enable <= [HMOT](CARD0).inm.00.input-00

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

More
01 Jun 2024 16:18 #302073 by PCW
Not related to halui, you need to connect the hardware jog count to
LinuxCNC's joint and or axis jog counts:

 net axis-selected-count axis.x.jog-counts joint.0.jog-counts
 net axis-selected-count axis.y.jog-counts joint.1.jog-counts
 net axis-selected-count axis.z.jog-counts joint.2.jog-counts

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

More
01 Jun 2024 19:18 #302092 by JohnnyBeluga
I tried to add this to my previous config and then decided to go from the original example hal.

# Include your custom HAL commands here
# This file will not be overwritten when you run PNCconf again

########MPG_Pendant##########

loadrt encoder num_chan=2
loadrt mux4 count=1
addf mux4.0 servo-thread
addf encoder.capture-position servo-thread
#addf encoder.update-counters base-thread

# If your MPG outputs a quadrature signal per click set x4 to 1
# If your MPG puts out 1 pulse per click set x4 to 0
setp encoder.0.x4-mode 0

# For velocity mode, set to 1
# In velocity mode the axis stops when the dial is stopped
# even if that means the commanded motion is not completed,
# For position mode (the default), set to 0
# In position mode the axis will move exactly jog-scale
# units for each count, regardless of how long that might take,
setp axis.x.jog-vel-mode 1
setp axis.y.jog-vel-mode 1
setp axis.z.jog-vel-mode 1

# This sets the scale that will be used based on the input to the mux4
setp mux4.0.in0 0.1
setp mux4.0.in1 0.01
setp mux4.0.in2 0.001

# The inputs to the mux4 component
net scale1 mux4.0.sel0 <= [HMOT](CARD0).inm.00.input-04
net scale2 mux4.0.sel1 <= [HMOT](CARD0).inm.00.input-03

# The output from the mux4 is sent to each axis jog scale
net mpg-scale <= mux4.0.out
net mpg-scale => axis.x.jog-scale
net mpg-scale => axis.y.jog-scale
net mpg-scale => axis.z.jog-scale

# The MPG inputs
net axis-selected-count <= [HMOT](CARD0).encoder.02.count

# The Axis select inputs
net mpg-x axis.x.jog-enable <= [HMOT](CARD0).inm.00.input-02

net mpg-y axis.y.jog-enable <= [HMOT](CARD0).inm.00.input-01

net mpg-z axis.z.jog-enable <= [HMOT](CARD0).inm.00.input-00



# The encoder output counts to the axis. Only the selected axis will move.
net encoder-counts <= encoder.0.counts
net encoder-counts => axis.x.jog-counts
net encoder-counts => axis.y.jog-counts
net encoder-counts => axis.z.jog-counts

There the hardware jog count is already connected to the linuxcnc one. I don't understad about the scale. I have 3 output on my pendant and there is only 2 in this config with mux4. It's a multiplexer so I need to put 0,0 and 0,001 in the same physical input ? I add to delete this line #addf encoder.update-counters base-thread because it was giving me an error at launch "base-thread not found". I also changed the MPG input part because I connected my MPG to channel 2 encoder on the 7i89.

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

More
01 Jun 2024 19:37 - 01 Jun 2024 19:38 #302096 by PCW
The example uses a software encoder so that can be deleted

This should be closer:

I tried to add this to my previous config and then decided to go from the original example hal.

# Include your custom HAL commands here
# This file will not be overwritten when you run PNCconf again

########MPG_Pendant##########

loadrt mux4 count=1
addf mux4.0 servo-thread


# For velocity mode, set to 1
# In velocity mode the axis stops when the dial is stopped
# even if that means the commanded motion is not completed,
# For position mode (the default), set to 0
# In position mode the axis will move exactly jog-scale
# units for each count, regardless of how long that might take,
setp axis.x.jog-vel-mode 1
setp axis.y.jog-vel-mode 1
setp axis.z.jog-vel-mode 1

# This sets the scale that will be used based on the input to the mux4
setp mux4.0.in0 0.1
setp mux4.0.in1 0.01
setp mux4.0.in2 0.001

# The inputs to the mux4 component
net scale1 mux4.0.sel0 <= [HMOT](CARD0).inm.00.input-04
net scale2 mux4.0.sel1 <= [HMOT](CARD0).inm.00.input-03

# The output from the mux4 is sent to each axis jog scale
net mpg-scale <= mux4.0.out
net mpg-scale => axis.x.jog-scale
net mpg-scale => axis.y.jog-scale
net mpg-scale => axis.z.jog-scale

# The MPG inputs
net encoder-counts <= [HMOT](CARD0).encoder.02.count

# The Axis select inputs
net mpg-x axis.x.jog-enable <= [HMOT](CARD0).inm.00.input-02

net mpg-y axis.y.jog-enable <= [HMOT](CARD0).inm.00.input-01

net mpg-z axis.z.jog-enable <= [HMOT](CARD0).inm.00.input-00



# The encoder output counts to the axis. Only the selected axis will move.

net encoder-counts => axis.x.jog-counts
net encoder-counts => axis.y.jog-counts
net encoder-counts => axis.z.jog-counts


The mux4 component uses a binary code on the
select pins so 2 pins can select 4 different inputs:

SEL1  SEL0    INPUT
0,       0         in0
0,       1         in1
1,       0         in2
1,       1         in3
Last edit: 01 Jun 2024 19:38 by PCW.
The following user(s) said Thank You: JohnnyBeluga

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

More
01 Jun 2024 21:51 #302112 by JohnnyBeluga
It makes sense now. [HMOT](CARD0).encoder.02.count was not really connected to axis.N.jog-counts. I think I finally understand the working principle of mux4 and how to adapt it to my setup and wiring. I rechecked the wiring and the output of the MPG on my oscilloscope. The switches also go high (+24V) when selected and the enable button is pressed.

Should I link the final motion function axis.N.jog-counts somewhere in the main HAL file ?

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

Moderators: cmorley
Time to create page: 0.092 seconds
Powered by Kunena Forum