Limit switch behavior

More
02 Jan 2016 14:04 - 02 Jan 2016 14:20 #67704 by rvj
Limit switch behavior was created by rvj
Hello Forum!

This is my first request in that forum. Although I studied other requests and the documentation I did not find an answer to my question.

I have a tiny three axis mill running with stepper motors. The Axis GUI driven control unit consists of a mesa 5i25 card with a 7i76 extension. The machine has limit switches at X-minus, X-plus, Y-minus, Y-plus and Z-plus. The X-minus, Y-minus and Z-plus limit switches serve also as home switches.

When I hit on of those switches say X-minus, I would expect that the machine does not allow jogging into the X-minus direction but X-plus jogging is possible. The X-minus should be forbidden until the limit switch is released.

Unfortunately this does not happen. If I hit the switch the machine is switched off and can only be moved if "override limits" is checked. If I check this I need to be extremely careful to jog into the right direction.

Is there any possibility to get the desired behavior?

Thanks for help

Reinhard
Last edit: 02 Jan 2016 14:20 by rvj.

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

More
02 Jan 2016 14:20 #67705 by andypugh
Replied by andypugh on topic Limit switch behaviour

Is there any possibility to get the desired behavior?


No, but if you home the machine and the axis limits are set up correctly it should then be impossible to jog into any limit switch.
The following user(s) said Thank You: rvj

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

More
02 Jan 2016 14:33 #67706 by rvj
Replied by rvj on topic Limit switch behavior
Thanks a lot for answering so quickly.

I guess that there is also no chance to create an user exit program to achieve that. Is this right?

I will try what you proposed since it sounds reasonable. However the described behavior is available in CNCUSB and I found it really useful for a beginner, because it is nearly impossible to make errors.

You may state use CNCUSB but I decided to make use of LinuxCNC because it offers parametric programming, which I want to learn in the future.

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

More
02 Jan 2016 14:47 #67707 by andypugh
Replied by andypugh on topic Limit switch behavior
LinuxCNC expects the limit switches to be a last line of defence. In normal use it should be impossible to hit them, unless something has gone wrong (such as losing a lot of steps so that the axis is not where it should be, or where the computer thinks it is.

Once you have homing and soft limits set up you will see how will it works.

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

More
02 Jan 2016 14:54 #67708 by rvj
Replied by rvj on topic Limit switch behavior
Thank you Andy, I reread the manual and try to do what you proposed.

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

More
02 Jan 2016 21:43 #67724 by rvj
Replied by rvj on topic Limit switch behavior
Hello Andy,
meanwhile I tried to setup my switches with pncconf. pncconf seems to multiply my entries given in mm, that I have chosen as machine unit, by 1000. So I used an editor to modify my ini.
I tried to specify my switch at -20 mm and my home location at 0 mm.
Unfortunately it did not work until now. Is there a working sample? English is not my mother tongue and maybe I misunderstood the manual.
Cheers Reinhard

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

More
02 Jan 2016 22:48 #67729 by andypugh
Replied by andypugh on topic Limit switch behavior
At this point I would stop using pncconf, it has done itsjob and now it will be easier to make changes directly in the HAL and INI files.

What about your setup doesn't work?

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

More
03 Jan 2016 22:06 #67782 by rvj
Replied by rvj on topic Limit switch behavior
Hello Andy,

you are right, at this point the job of pncconf is done. I made some progress and I will report my experience in this thread.

I studied the homing documentation linuxcnc.org/docs/2.6/html/config/ini_homing.html and I made some progress although there are still questions about that. Please give me some time to express these - at the moment my questions are not precise enough and maybe the anwers are given in the documentation. I will report my findings belonging to this topic in this thread. For now I only can tell that I am unsure about the terms INDEX and SWITCH. Maybe I did not notice the hints given in the documentation. As already mentioned English is not my mother tongue and there is some language barriere, so I will ask about these things after rereading the documentation. If you know some other forum threads that treat that topic, please let me know.

At the moment it works like you described. After homing the machine motion is restricted to be in the specified minimum and maximum positions and as you told the machine does not touch the switches under normal, error free conditions.

However, during the setup I had to allow "override limits" several times. When I did that I had to concentrate to avoid mistakes. Short if the limit switches have separate inputs, a bahavior like I thought would be advantageous. If LinuxCNC has some system for improvement proposals I think about asking for that. Andy this is no critisism! I am more than happy with the intelligent homing procedure, that detects the switch with a high velocity, moves away from the switch and starts a final homing with low speed. Absolutely cool! I also like the soft limits.

Thanks a lot. Cheers

Reinhard

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

More
04 Jan 2016 01:53 #67795 by andypugh
Replied by andypugh on topic Limit switch behavior

I am unsure about the terms INDEX and SWITCH.


In this context the switch is a sensor of some sort on the actual moving axis. It could be an actual microswitch, a proximity sensor or an optical sensor.

The Index is a once-per-revolution signal from an encoder on the motor. If your motor has this signal then the position of that is far more accurate than the sensor on the axis, but it happens every motor rotation, so you need the axis sensor to tell when the motor is n the correct revolution to look for the index pulse.

If you have stepper motors then you probably have no encoders, and can ignore any mention of Index.

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

More
04 Jan 2016 20:34 - 04 Jan 2016 20:38 #67873 by rvj
Replied by rvj on topic Limit switch behavior
Hello Andy,

thank you very much for your patient advice. Since I make use of stepper motors I ignored all the INDEX stuff. It works like you described and I want to add a few notes for the interested readers. Such forum entries are a great source of knowledge and I use these as a supplement to the documentation.

Please have a look and correct if I tell nonsense.

Cheers Reinhard


Perform as follows to establish a homing procedure and to restrict the axis motion to a certain interval.

  1. If you make use of steppers ignore all the INDEX parameters
  2. Study the figure given in linuxcnc.org/docs/2.6/html/config/ini_homing.html
  3. In the figure the home switches are located at the positive side.
  4. The parameter HOME_SEARCH_VEL specifies the speed that is used to detect the switch. This value is signed. The direction of travel is determined by the sign.
  5. After the switch is detected, it is released by driving the the axis in the opposite direction. It is the goal of the next step to detect the switching point more accurately with lower speed. This lower speed is called the HOME_LATCH_VEL, which is a signed floating point number. There are two procedures, i.e. directions for approaching the switching point, which are chosen by setting the sign of the HOME_LATCH_VEL.
    • First approaching procedure: The sign of HOME_LATCH_VEL is chosen to be equal to the sign of HOME_SEARCH_VEL. That means the final more accurate search with HOME_LATCH_VEL speed is performed in the same direction as the switch detection with HOME_SEARCH_VEL speed. To be able to perform this first the switch is detected with HOME_SEARCH_VEL. Then the direction is reversed and the switch is released with HOME_SEARCH_VEL. Finally the direction is reversed again to detect the switching point more precisely with the reduced speed HOME_LATCH_VEL.
    • Second approaching procedure: The sign of HOME_LATCH_VEL is chosen to be not equal to the sign of HOME_SEARCH_VEL. That means the final more accurate search with HOME_LATCH_VEL speed is performed in the reversed direction as the switch detection with HOME_SEARCH_VEL speed. So first the switch is detected with HOME_SEARCH_VEL. Then the direction is reversed and the switch is released with the reduced speed HOME_LATCH_VEL.
  6. After the switch is detected accurately, the axis is moved to HOME with the speed defined in HOME_FINAL_VEL. HOME_FINAL_VEL is meant as an absolute value so it shall not posess a sign, i.e. it is always a positive number.
  7. Use the MIN_LIMIT and MAX_LIMIT to restrict the axis motion to the desired interval. By doing that the limit switches are only needed as the last defense.
  8. Commented samples of the AXIS section of a machine are given below.

#********************
# Axis X
#********************
[AXIS_0]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.005
MIN_FERROR = 0.0005
# machine units per second
MAX_VELOCITY = 20.0
MAX_ACCELERATION = 5.0
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 25.0
STEPGEN_MAXACCEL = 6.25
# these are in nanoseconds
DIRSETUP = 20000
DIRHOLD = 20000
STEPLEN = 15000
STEPSPACE = 15000
STEP_SCALE = 400.0
MIN_LIMIT = 0.0
MAX_LIMIT = 110.0
# The switch is on the negative side, the distance to zero is 2 mm.
HOME_OFFSET = -2.0
# Travel with 2.5 mm/s into the negative direction to detect the switch.
# Note that this value is signed to indicate the direction.
HOME_SEARCH_VEL = -2.5
# The final switch search is performed with reduced velocity and shall also be excuted
# in the negative direction after a move into the positive direction for releasing the
# switch. This final switch search is carried out with a speed of 1 mm/s.
# Note that this value is signed to indicate the direction.
HOME_LATCH_VEL = -1.0
# Move to HOME with 10.0 mm/s after the homing procedure.
# Note: This is an absolute value, i.e. a positive floating point number.
HOME_FINAL_VEL = 10.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 1

#********************
# Axis Y
#********************
[AXIS_1]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.005
MIN_FERROR = 0.0005
MAX_VELOCITY = 20.0
MAX_ACCELERATION = 5.0
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 25.0
STEPGEN_MAXACCEL = 6.25
# these are in nanoseconds
DIRSETUP = 20000
DIRHOLD = 20000
STEPLEN = 15000
STEPSPACE = 15000
STEP_SCALE = -400.0
MIN_LIMIT = 0.0
MAX_LIMIT = 40
# The switch is on the negative side, the distance to zero is 2 mm.
HOME_OFFSET = -2.0
# Travel with 2.5 mm/s into the negative direction to detect the switch.
# Note that this value is signed to indicate the direction.
HOME_SEARCH_VEL = -2.5
# The final switch search is performed with reduced velocity and shall also be excuted
# in the negative direction after a move into the positive direction for releasing the
# switch. This final switch search is carried out with a speed of 1 mm/s.
# Note that this value is signed to indicate the direction.
HOME_LATCH_VEL = -1.0
# Move to HOME with 10.0 mm/s after the homing procedure.
# Note: This is an absolute value, i.e. a positive floating point number.
HOME_FINAL_VEL = 10.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 2

#********************
# Axis Z
#********************
[AXIS_2]
TYPE = LINEAR
HOME = 0.0
FERROR = 0.005
MIN_FERROR = 0.0005
MAX_VELOCITY = 20.0
MAX_ACCELERATION = 5.0
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 25.0
STEPGEN_MAXACCEL = 6.25
# these are in nanoseconds
DIRSETUP = 20000
DIRHOLD = 20000
STEPLEN = 15000
STEPSPACE = 15000
STEP_SCALE = -363.636
MIN_LIMIT = -120.0
MAX_LIMIT = 0.0
# The switch is on the positive side, the distance to zero is 10 mm.
HOME_OFFSET = 10.0
# Travel with 2.5 mm/s into the positive direction to detect the switch
# Note that this value is signed to indicate the direction.
HOME_SEARCH_VEL = 2.5
# The final switch search is performed with reduced velocity and shall also be excuted
# in the positive direction after a move into the negative direction for releasing the
# switch. This final switch search is carried out with a speed of 1 mm/s.
# Note that this value is signed to indicate the direction.
HOME_LATCH_VEL = 1.0
# Move to HOME with 10.0 mm/s after the homing procedure.
# Note: This is an absolute value, i.e. a positive floating point number.
HOME_FINAL_VEL = 10.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
Last edit: 04 Jan 2016 20:38 by rvj. Reason: Add the interval description

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

Time to create page: 0.134 seconds
Powered by Kunena Forum