Driving 2 steppers on the same axis.
- norbertfarquharsh
- Offline
- Senior Member
Less
More
- Posts: 58
- Thank you received: 0
20 Dec 2015 11:42 #67165
by norbertfarquharsh
Driving 2 steppers on the same axis. was created by norbertfarquharsh
Hello,
I am an inexperienced Linux user working on a gantry style CNC. The machine is essentially mechanically completed, but there are problems that I am trying to work out by reading in this forum. However, I have read and worked on trying to get the (two) Y axes to work together and admit defeat so far. X and Z work fine, I think, and home okay. But I am a failure on Y.
Just updated to 2.7.3 this morning and worked on the 'probe_parport' problem but made no other progress.
Following are the .ini and .hal files Probably some obvious and foolish mistake(s) but it is beyond me and I would certainly appreciate help.
I have other problems but would like to get over this hurdle.
Joe
# Generated by stepconf 1.1 at Sat Dec 19 15:54:51 2015
# If you make changes to this file, they will be
# overwritten when you run stepconf again
[EMC]
MACHINE = mygantry
DEBUG = 0
[DISPLAY]
DISPLAY = axis
EDITOR = gedit
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
ARCDIVISION = 64
GRIDS = 10mm 20mm 50mm 100mm 1in 2in 5in 10in
MAX_FEED_OVERRIDE = 1.2
MIN_SPINDLE_OVERRIDE = 0.5
MAX_SPINDLE_OVERRIDE = 1.2
DEFAULT_LINEAR_VELOCITY = 0.10
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 1.00
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/norbert/linuxcnc/nc_files
INCREMENTS = .1in .05in .01in .005in .001in .0005in .0001in
PYVCP = custompanel.xml
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[RS274NGC]
PARAMETER_FILE = linuxcnc.var
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
BASE_PERIOD = 100000
SERVO_PERIOD = 1000000
[HAL]
HALUI = halui
HALFILE = mygantry.hal
HALFILE = custom.hal
POSTGUI_HALFILE = custom_postgui.hal
[HALUI]
# add halui MDI commands here (max 64)
[TRAJ]
AXES = 3
COORDINATES = X Y Z
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_VELOCITY = 0.10
MAX_VELOCITY = 1.00
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
[AXIS_0]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 1.0
MAX_ACCELERATION = 30.0
STEPGEN_MAXACCEL = 37.5
SCALE = 6400.0
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -0.01
MAX_LIMIT = 8.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 0.100000
HOME_LATCH_VEL = -0.078125
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 1
[AXIS_1]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 1.0
MAX_ACCELERATION = 30.0
STEPGEN_MAXACCEL = 37.5
SCALE = 6400.0
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -0.01
MAX_LIMIT = 8.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 0.100000
HOME_LATCH_VEL = -0.078125
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 2
[AXIS_2]
TYPE = LINEAR
HOME = -0.0
MAX_VELOCITY = 1.0
MAX_ACCELERATION = 30.0
STEPGEN_MAXACCEL = 37.5
SCALE = 6400.0
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -0.01
MAX_LIMIT = 6.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -0.100000
HOME_LATCH_VEL = 0.078125
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
# Generated by stepconf 1.1 at Sat Dec 19 15:54:51 2015
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt gantrykins coordinates=XYZY
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
#loadrt probe_parport after 2.7.3 upgrade
loadrt hal_parport cfg="0x378 out"
setp parport.0.reset-time 2000
loadrt stepgen step_type=0,0,0
addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
net spindle-cmd <= motion.spindle-speed-out
net spindle-at-speed => motion.spindle-at-speed
net estop-out => parport.0.pin-01-out
net xstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
net xdir => parport.0.pin-03-out
net ystep => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
net ydir => parport.0.pin-05-out
net zstep => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
net zdir => parport.0.pin-07-out
net xstep => parport.0.pin-08-out
setp parport.0.pin-08-out-reset 1
net xdir => parport.0.pin-09-out
net max-x <= parport.0.pin-10-in
net min-home-x <= parport.0.pin-11-in
net min-home-y <= parport.0.pin-12-in
net min-home-z <= parport.0.pin-13-in
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 17200
setp stepgen.0.dirsetup 17200
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable
net min-home-x => axis.0.home-sw-in
net min-home-x => axis.0.neg-lim-sw-in
net max-x => axis.0.pos-lim-sw-in
setp stepgen.1.position-scale [AXIS_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 17200
setp stepgen.1.dirsetup 17200
setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable axis.1.amp-enable-out => stepgen.1.enable
net min-home-y => axis.1.home-sw-in
net min-home-y => axis.1.neg-lim-sw-in
setp stepgen.2.position-scale [AXIS_2]SCALE
setp stepgen.2.steplen 1
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 17200
setp stepgen.2.dirsetup 17200
setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.2.step
net zdir <= stepgen.2.dir
net zenable axis.2.amp-enable-out => stepgen.2.enable
net min-home-z => axis.2.home-sw-in
net min-home-z => axis.2.neg-lim-sw-in
net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in
loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
I am an inexperienced Linux user working on a gantry style CNC. The machine is essentially mechanically completed, but there are problems that I am trying to work out by reading in this forum. However, I have read and worked on trying to get the (two) Y axes to work together and admit defeat so far. X and Z work fine, I think, and home okay. But I am a failure on Y.
Just updated to 2.7.3 this morning and worked on the 'probe_parport' problem but made no other progress.
Following are the .ini and .hal files Probably some obvious and foolish mistake(s) but it is beyond me and I would certainly appreciate help.
I have other problems but would like to get over this hurdle.
Joe
# Generated by stepconf 1.1 at Sat Dec 19 15:54:51 2015
# If you make changes to this file, they will be
# overwritten when you run stepconf again
[EMC]
MACHINE = mygantry
DEBUG = 0
[DISPLAY]
DISPLAY = axis
EDITOR = gedit
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
ARCDIVISION = 64
GRIDS = 10mm 20mm 50mm 100mm 1in 2in 5in 10in
MAX_FEED_OVERRIDE = 1.2
MIN_SPINDLE_OVERRIDE = 0.5
MAX_SPINDLE_OVERRIDE = 1.2
DEFAULT_LINEAR_VELOCITY = 0.10
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 1.00
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/norbert/linuxcnc/nc_files
INCREMENTS = .1in .05in .01in .005in .001in .0005in .0001in
PYVCP = custompanel.xml
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[RS274NGC]
PARAMETER_FILE = linuxcnc.var
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
BASE_PERIOD = 100000
SERVO_PERIOD = 1000000
[HAL]
HALUI = halui
HALFILE = mygantry.hal
HALFILE = custom.hal
POSTGUI_HALFILE = custom_postgui.hal
[HALUI]
# add halui MDI commands here (max 64)
[TRAJ]
AXES = 3
COORDINATES = X Y Z
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_VELOCITY = 0.10
MAX_VELOCITY = 1.00
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
[AXIS_0]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 1.0
MAX_ACCELERATION = 30.0
STEPGEN_MAXACCEL = 37.5
SCALE = 6400.0
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -0.01
MAX_LIMIT = 8.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 0.100000
HOME_LATCH_VEL = -0.078125
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 1
[AXIS_1]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 1.0
MAX_ACCELERATION = 30.0
STEPGEN_MAXACCEL = 37.5
SCALE = 6400.0
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -0.01
MAX_LIMIT = 8.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 0.100000
HOME_LATCH_VEL = -0.078125
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 2
[AXIS_2]
TYPE = LINEAR
HOME = -0.0
MAX_VELOCITY = 1.0
MAX_ACCELERATION = 30.0
STEPGEN_MAXACCEL = 37.5
SCALE = 6400.0
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -0.01
MAX_LIMIT = 6.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -0.100000
HOME_LATCH_VEL = 0.078125
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
# Generated by stepconf 1.1 at Sat Dec 19 15:54:51 2015
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt gantrykins coordinates=XYZY
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
#loadrt probe_parport after 2.7.3 upgrade
loadrt hal_parport cfg="0x378 out"
setp parport.0.reset-time 2000
loadrt stepgen step_type=0,0,0
addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
net spindle-cmd <= motion.spindle-speed-out
net spindle-at-speed => motion.spindle-at-speed
net estop-out => parport.0.pin-01-out
net xstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
net xdir => parport.0.pin-03-out
net ystep => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
net ydir => parport.0.pin-05-out
net zstep => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
net zdir => parport.0.pin-07-out
net xstep => parport.0.pin-08-out
setp parport.0.pin-08-out-reset 1
net xdir => parport.0.pin-09-out
net max-x <= parport.0.pin-10-in
net min-home-x <= parport.0.pin-11-in
net min-home-y <= parport.0.pin-12-in
net min-home-z <= parport.0.pin-13-in
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 17200
setp stepgen.0.dirsetup 17200
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable
net min-home-x => axis.0.home-sw-in
net min-home-x => axis.0.neg-lim-sw-in
net max-x => axis.0.pos-lim-sw-in
setp stepgen.1.position-scale [AXIS_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 17200
setp stepgen.1.dirsetup 17200
setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable axis.1.amp-enable-out => stepgen.1.enable
net min-home-y => axis.1.home-sw-in
net min-home-y => axis.1.neg-lim-sw-in
setp stepgen.2.position-scale [AXIS_2]SCALE
setp stepgen.2.steplen 1
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 17200
setp stepgen.2.dirsetup 17200
setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.2.step
net zdir <= stepgen.2.dir
net zenable axis.2.amp-enable-out => stepgen.2.enable
net min-home-z => axis.2.home-sw-in
net min-home-z => axis.2.neg-lim-sw-in
net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in
loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
Please Log in or Create an account to join the conversation.
20 Dec 2015 12:12 #67166
by andypugh
How do you want to do it? There is a string of signals all the way from the "Y" commands in the G-code to the machine pulleys, and you can split the signal to the two motors pretty much anywhere in that sequence, according to how you want to do it.
I assume at the moment you only have one stepper moving?
Replied by andypugh on topic Driving 2 steppers on the same axis.
However, I have read and worked on trying to get the (two) Y axes to work together and admit defeat so far. X and Z work fine, I think, and home okay. But I am a failure on Y.
How do you want to do it? There is a string of signals all the way from the "Y" commands in the G-code to the machine pulleys, and you can split the signal to the two motors pretty much anywhere in that sequence, according to how you want to do it.
I assume at the moment you only have one stepper moving?
Please Log in or Create an account to join the conversation.
- norbertfarquharsh
- Offline
- Senior Member
Less
More
- Posts: 58
- Thank you received: 0
20 Dec 2015 16:13 #67174
by norbertfarquharsh
Replied by norbertfarquharsh on topic Driving 2 steppers on the same axis.
Thank you for your prompt response.
Yes, only one stepper is moving.
As to how I want to do it, I tried to follow what I have read in previous posts and have attempted to implement gantrykins by editing the .hal file entry that implemented trivikins (hope that is the correct spelling). to gantrykins and then editing other lines to account for the hardware on the machine. There are various posts on this method and I read through all of them that I could find and tried to work those out.
I am open to any suggestions.
By the way, drive is screw driven with two screws for the Y axis.
Thanks again.
Joe
Yes, only one stepper is moving.
As to how I want to do it, I tried to follow what I have read in previous posts and have attempted to implement gantrykins by editing the .hal file entry that implemented trivikins (hope that is the correct spelling). to gantrykins and then editing other lines to account for the hardware on the machine. There are various posts on this method and I read through all of them that I could find and tried to work those out.
I am open to any suggestions.
By the way, drive is screw driven with two screws for the Y axis.
Thanks again.
Joe
Please Log in or Create an account to join the conversation.
20 Dec 2015 18:59 #67177
by Rick G
Replied by Rick G on topic Driving 2 steppers on the same axis.
If you are not using separate home / limits switches for the 2 y axis you could just use a regular xyz configuration.
As Andy pointed out there are many way to do and split the signal. For example...
In your configuration file you have...Which connects the step and direction pins to the 2 parallel port pins for the y drive.
Add the correct parallel port pins for the second y drive to ystep and ydir in the same manner.
You may need to invert the direction signal to get the motor turning the correct direction. or swap a pair of wires on the stepper motor (with the power off!).
Rick G
As Andy pointed out there are many way to do and split the signal. For example...
In your configuration file you have...
net ystep => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
net ydir => parport.0.pin-05-out
Add the correct parallel port pins for the second y drive to ystep and ydir in the same manner.
You may need to invert the direction signal to get the motor turning the correct direction. or swap a pair of wires on the stepper motor (with the power off!).
Rick G
Please Log in or Create an account to join the conversation.
20 Dec 2015 20:10 #67178
by andypugh
It only makes sense to us gantrykins if you want to be able to jog the two sides of the gantry separately, and if they have separate home switches for auto-squaring. Otherwise it adds trouble (and potential risk) for no advantage.
The simplest way is to just allocate 2 parport pins to Y-step and another two to Y-dir, and then connect the two stepper drivers to those pins.
Replied by andypugh on topic Driving 2 steppers on the same axis.
As to how I want to do it, I tried to follow what I have read in previous posts and have attempted to implement gantrykins by editing the .hal file entry that implemented trivikins
It only makes sense to us gantrykins if you want to be able to jog the two sides of the gantry separately, and if they have separate home switches for auto-squaring. Otherwise it adds trouble (and potential risk) for no advantage.
The simplest way is to just allocate 2 parport pins to Y-step and another two to Y-dir, and then connect the two stepper drivers to those pins.
Please Log in or Create an account to join the conversation.
- norbertfarquharsh
- Offline
- Senior Member
Less
More
- Posts: 58
- Thank you received: 0
20 Dec 2015 21:22 #67180
by norbertfarquharsh
Replied by norbertfarquharsh on topic Driving 2 steppers on the same axis.
Many thanks to Andypugh and RIck G as, with their suggestions, now it is working and I am on to other problems.
Joe
Joe
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19250
- Thank you received: 6447
21 Dec 2015 01:17 #67185
by tommylight
Replied by tommylight on topic Driving 2 steppers on the same axis.
To late but still, you had two outputs configured for X axis, not for Y axis as you need it in your hal file. Glad you made it work.
Tom
Tom
Please Log in or Create an account to join the conversation.
Time to create page: 0.083 seconds