Explain Limit Switches and Homing To Me

speedre9

Active User
Registered
Joined
Aug 26, 2013
Messages
167
So, whats the skinny on this subject. I can put them on my machine but, how do I set them up?? I know they stop the travel in the x,y,z but how do they resume travel. Once travel is stopped does, Mach 3 then move them off the switch a little so the machine will resume movement or, does the operator need to intervene?
What about homing? Does that mean the machine will go back to that point when the machine is done whatever process it is doing? Like a "zero point" where everything starts and stops? So much brain fog about these things!!:dunno::bitingnails:
 
My 3cents -There are several good youtube vids which helped me! It was something that I did get running on my Mill but honestly do not use too much as yet. The Mach3 pages had some really good vids and their online manual/docs do OK. Gotta run. CG.
 
My very limited experience with CNC are the following, Homing is any point within the machining area you send the table to where the table or vise is clear of the cutter so finished part(s) can be removed and new blanks can be loaded. I ran production for several months. Limit switches are usually located near the end of travel and are considered emergency stops. They are there in case of a programing error. Without them one can cause serious damage to the drive screws. Even experienced programmers make mistakes.

I hope this helps, I never programed but loaded enough stock to understand your concerns.
 
I am going to be doing exactly this in the next few days on a table top CNC router. I'll post pictures and give an explanation of what I am doing and why. I am not sure exactly how Mach3 will handle the travel limits, but I'm going to find out when I get it set up. I think there is an override in the Mach3 software that allows you to jog the machine off of a travel limit. I am going to use the travel limits for the Home limits also. It's been a while since I worked with Mach3, so I expect my frustration level will be pretty high by the time I'm done setting up, at least based on my last experience with it.

As Bill C said, the home (or parking) position is normally where the tool or work parks at between loads, 0,0,0 could be anywhere you want it. The home limit switches are needed in a system to be able to set the maximum travel limits in software, in other words, a known starting point.
 
You are right Jim Mach3 has a box to check for override jog off the limit switch.
As far as homing I hardly ever use it on my mill but my router table has 2 motors on the X axis. I use homing to ensure the Y axis is not cocked and runs straight and square on the machine.

Ray
 
Im using Mach3 on my plasma table, it senses the direction you're traveling when it hits the home or limit switches and lets you back out of them.

Greg
 
Speedre9

[SUB]These are notes I made to digest my understanding of home and limit switches. I installed them on a Patriot CNC 3-in-1.[/SUB]

Installing Home and Limit Switches in Mach 3

There is no real need for physical home and limit switches as Mach3 can replicate these switches virtually in the software. You can set up virtual Limit switches or Software Limits. In Config/ Homing Limits/Motor Home Soft Limits tab, you can set actual dimensions that specify the maximum and minimum distance the machine can travel on each axis. Mach 3 scans the GCode to check if the max. and min. limits of axes travel is within the soft limits. If any movement is outside the soft limit, the code signals this and does not run. The only risk is you forget to turn on Soft Limits (see below) and then the axes drive motors could crash against the ends of an axis. Physical switches can prevent operator error causing damage.


  1. Setting Soft Limits

    The Shopmaster does not have physical limit or home switches but here's how I set up soft limits on my 2012 machine:

    1) jog each axis to the spot that you want to designate Home. In my case, Z Home was at the tailstock end (Z++), X Home was the furthest away from the spindle-tailstock center-line towards the operator (X++), and Y Home was at the top most position of the mill head. (Z,X and Y here are from Mach3 Turn's perspective). All movements are then in the -ve direction.

    2) Select Machine coordinates in Mach3 Turn's Manual screen and then click Set Home Z and Set Home X. The axes DRO in the top left should now be 0.0.

    3) From this position I also set Soft Limits in under Config/Homing Limits. My Soft Max for both the X and Z axes was 0.0. The Soft Min for the Z axis is -12.5" and for the X axis -6.7". I did not move the Z axis to the very end near the tailstock as I wanted some clearance in front of anything I mounted in the tailstock. At the other -ve end of the Z axis, my -12.5" Soft Min was a function of allowing a safe clearance between my LH tool and the chuck jaws.​
    4) In the Auto Cycle screen, click the Set Soft Limits On/Off to set Soft Limits On so that the light is green. Otherwise, Mach3 will ignore any soft limits you entered. When a program is loaded in the Auto Cycle screen, Mach3 scans ahead to see the max. and min. of axes travel and if any move is outside the soft limit, a warning pops up and it asks if the program should continue.

    5) Click Auto Override in the Diagnostic Screen so that you can jog off a limit though this is for physical switches.​
    You have to reset Home each time you turn the machine on so that Z and X Home Referenced lights turn on in the Manual screen.​




Terminology Basics for Physical Limit and Home Switches

Normally Closed (NC) and Normally Open (NO) Switches

A normally closed (NC) switch is exactly what its name says: under normal operation of the machine, when the switch is ON, the circuit is closed allowing voltage to flow through the circuit from the power source to the ground. When a normally open (NO) switch is ON, no voltage flows through the circuit as the open switch prevents the circuit from being completed.


Active High and Active Low states


NC and NO switch systems can be designated as Active High or Active Low. Usually in the transistor-transistor logic (TTL) circuits found in a PC, a high voltage is between 2.8v to 4.8v and could be assigned a binary value of 1, while a low voltage is between 0v and 0.8v and could be assigned a binary value of 0. Input pin #s 10 through #13 and #15 take voltage inputs from the machine to send signals to the software.Pin #s 1 through #9 and #14 send signals out of the PC to the machine. In my wiring system, pin #2 is used to send PC power (4.8v) to the limit switch circuit and pin #11 is used to receive an input from a limit switch.



In an Active High system, under normal operating conditions, the voltage measured at an input pin (#10 through #13, #15) is Low since the high voltage is bled away to ground before reaching the input pin. When a limit switch in an NC system is activated - the switch is now Active - the circuit opens and the high voltage is redirected to the input pin changing it from its normal operating Low voltage state to an Active High state. This kind of a system is called a NC Active High system.


The advantage of using a NC system is that if a wire breaks, the circuit opens, lowering the voltage and triggering an alarm. In a NO system, a broken wire is viewed as just another normally open "switch" in the circuit. NC systems are also better at managing electrical "noise" that might confuse the switch because a closed circuit has low impedence. Another problem is that a NO Active High system (tells the machine to do something when the voltage is high) can be accidentally triggered by a voltage spike.

In an NC Active High system all the limit switches can be wired in a series (from one to the next to the next and so on) and connected to just one input pin. This kind of a system (a series of 6 switches on my machine) is called an "OR" system. If either switch 1 OR switch 2 OR ...switch 6 is triggered open, Mach 3 will recognize a Limit or Home switch has been activated. Under an OR system ,in the Diagnostic Screen, the LEDs for all 6 switches will light up when any one switch is tripped.


Hardware setup:


Wiring the Switches

My switches were bought from Dan Mauch of Camtronics (www.camtronics-cnc.com). Each switch has a NC, NO and Com prong (see photos at the link below). On my 2012 Patriot, each axis has an NC limit switch on one end and a second NC switch that doubles as a Home and Limit switch at the other end. All 6 NC switches are wired in series as follows: the wire first goes from the NC prong in switch 1 (Y++ Limit and Y axis Home) to Common (COM) in switch 2 (Y- Limit), then from NC of switch 2 to COM of switch 3 (X- Limit),and so on to X++ (X++ Limit and X axis Home), and then to Z- Limit and Z++ (Z++ Limit and Z Home at the top of the mill. Finally, NC of switch 6 is connected to the V-ground on the CNC power supply panel which for my 2012 Patriot also has a black wire that connects to pin #12 (power supply ground) on the Gecko 540 board.The COM of switch 1 is connected pin #2 on the Gecko 540 board. None of the NO prongs is connected. The circuit is as follows: 4.8v PC power from pin #2 flows through all 6 NC switches and goes to ground at pin #12 (power supply ground) on the Gecko 540 board through the V- ground onthe CNC power supply. When a switch is tripped, the circuit opens and 4.8v is diverted from ground to pin #11 (now Active High) and tells Mach 3 to stop the machine.



https://picasaweb.google.com/116982968384326297223/PatriotCNC?authkey=Gv1sRgCMfNg5G004XGIA#

I use 16 guage wire inside plastic protective sheaths, kept at least 1" away from any stepper motor and power cables to prevent "noise". The longest run for a wire is less than 4'. I did not use shielded cables. Finally, protective plates are mounted over the switches to keep swarf and any fluids off the rollers.I used a multimeter to check continuity each time I added a switch. After the system was wired, I measured approximately 4.5v across each switch (Active High). Since the voltage was more than 4v, I did not need the 470 ohms "pull-up" resistor shown in the Mach3 manual that should be added to the wire before it goes to the v- ground. After each switch was connected I checked for continuity.

Software setup:

Getting Mach3 to recognize the switches:

I used Mach3 to define the Limit and Home switches. Select Config/Port & Pins/Input Signals. Then click Automated Setup of Inputs. Select the appropriate switch - say, X limit++ at the tailstock end of my lathe - and click Autoset. Now manually trigger the X++ switch. Mach3 beeps, signalling that it has recognized the switch. Select the next switch, click Autoset and trigger the switch. Repeat for all switches and then click OK.

Once all switches have been activated, the Input Signals tab should show a green check mark next to each switch, with the pin #. All my switches are assigned to Port #1, pin #11. There will be a red cross mark in the Active Low box for each switch. This indicates an Active High system - at input pin#11, the default operating voltage is Low, but when activated the voltage at the pin becomes high. Mach 3 now recognizes that there are Active High Home and Limit switches for each axis.



Trigger each switch to make sure the wiring works and that the Limit activated LEDs light up. If they don't, and the wiring has been checked for continuity, change the Active status and test.

Limit Switches in Normal Use

When axis over-travel triggers a Limit switch, the Active High signal to Mach3 stops all movement and the red Reset button will flash. In the Diagnostic Screen, since all switches have been wired in series and connected to one pin, all Limit lights will be on. You cannot move the machine unless:

Auto Limit Override is on in the Diagnostic Screen.This allows you to click the Reset button and then use the arrow keys on the keyboard to jog off the Limit switch. The machine and part need to be re-referenced because stepper motors lose some steps due to inertia and do not know at which machine coordinate they stopped.

Preventing noise from triggering the switches

Unless you have shielded cables there is a fair amount of noise - electrical disturbance - in the switch wiring. Mach3 needs a way to distinguish "noise" from "signal". Debounce is the time a signal must be continually "on" before Mach3 realizes that it is a signal and not just noise. In the General Config tab, in the Input Signal Debouncing / Noise Rejection section in the top right corner, each value in the Debounce Interval box corresponds to 1/kernel speed of time. Since I have my machine set to a kernel speed of 25,000Hz, a debounce interval of 500 is 500/25,000 or 0.02 or 2 milliseconds which is long enough for the computer to realize that it is a signal and not a random electrical disturbance. Since in Config/Motor Tuning I have set my axis velocity to be 50 ipm, the actual distance the machine will move before it realizes that it is a "signal" is 50 ipm * 0.02 / 60 sec = 0.017" of travel beyond the Limit switch. Lowering the interval reduces the overtravel (and damage) but increases the probability of a false signal.

Setting Home:

Home is the location that the machine recognizes as 0,0,0 on the X, Y and Z axes (Machine Coordinates 0,0 which should be displayed in the axes DROs). In Mach3 Turn's Manual Screen, for example, click Machine Coordinates and then click Set Home Z. The machine moves slowly in the z+ direction towards the tailstock. (If the Home Neg box is checked - see below - the machine moves in the z-ve direction towards the chuck looking for the Home switch). When Homing, Limits are not active. When the axis reaches Home, the machine reverses in the -ve direction to move off the switch.Clicking Set Home X will repeat this for the X axis. The machine is now at 0.0 Z and 0.0 X. All movements will be in the -ve direction from Home. This procedure needs to be repeated each time the machine is turned on. The X and Z Home Referenced lights in the top right corner of the Manual Screen will now be green.

If the machine has been referenced to Home on start up, clicking the Home X or Home Z or Home All in the Manual or Auto screen will move the machine to the respective Home location. Clicking Home All first Homes X (moving it clear of the chuck or tail stock) and then Homes Z (in the positive direction towards the tail stock).

If the machine is not referenced to Home on startup, none of the Home buttons will work.You need to reference Home each time you start up the machine.



Diagnostic Screen

All the Limit and Home switche lights in the Input/Output Status Inputs grouping should be off when the switches are closed, and the X and Z DRO should read 0.0 or the value in the Home Off. cell when Homed. The Auto Limit Override switch should be turned on to allow movement off the Limit switches using the arrow keys on the keyboard.

Setting the G28 Home Location

The G28 command returns the machine to its Home position. However, if you share the Limit switch with a Home switch, this would trigger the Limit switch requiring a reset and a re-reference to be done. To avoid this, I set the G28 location to be -0.25" for both the X and Z axes. When the G28 command is issued in a program, the machine moves to -0.25" off the Home switch for both axes.



If there is no Home Off. value entered (see below), the axis will move -0.25 off the location of the Home switches. However, if there is a Home Off. value entered (say, 4.349"), a G28 command of -0.25 would move the axis to -0.25" off the spindle center line and not -0.25" off Home! It could crash into the stock!
Auto Limit Override

Turn Auto Limit Override on in the Settings. In case you trip a Limit switch, this option lets you click Reset and use the keyboard arrow keys (manual motion control) to move off the Limit switche.The movement away from the Limit switch will be at a slow jog speed so that you can react if jogging in the wrong direction.If you release the jog arrow key and press it again, jogging will resume at normal speed.

Override Limits lets you literally override the Limit switches. A red light flashes.

Slow Zone and Speed %

You can slow the machine down as it approaches the Soft Limits or Hard Limits/Home switches by specifying the distance before the Limit the machine should start reducing its approach speed. On my machine, I have set the Slow Zone to 0.20" for both axes which means that Mach3 will slow starting from 0.20" before the Limit.

The speed the machine travels at while in the Slow Zone can be specified in the Speed % cell. In my case, I set it to 10% of the axis speed set in Motor Inputs.This only works when jogging the machine. Even though the shift key is held down to enable fast manual jogging, the machine will slow down when it enters the Slow Zone.It has no effect when a G-code program is running.

Home Neg

This box should be checked if the Home switch is in the -ve direction (at the chuck end for the Z axis or away from the operator on the X axis).

Home Off.

Home Offset is the distance Home (usually Home X) is away from the spindle's center line. Say, using the method described below, Home is offset from the spindle-tail stock center line by 4.349". Moving towards the spindle center line will now progressively decrease the DRO reading from 4.349 until it reaches 0.0 at the center line.



Setting Home Off.

Clear any values in this cell and click Machine Coordinates / Zero World in the Manual screen. Click Set Home X which will move the machine to its X axis Home location. Chuck some stock and using the MDI line take a light skim cut. Note the value in the top left X axis DRO in the Manual screen. It should be a -ve reading. Ignore the -ve sign and call the value X. Now measure the diameter D of the machined stock in the chuck.

Home Offset (HO) = X + D / 2
This is the distance Home X is from the spindle's center line.

Go to Config/Homing Limits and in the Home Off. cell for the X axis input HO. Now, click Set Home X and the machine will move to the Home X location. Once it reaches Home, the X axis DRO should read the value HO. Now, take another skim cut off the stock and note the X DRO reading. It should be the same as the stock's radius. If it does not match, either the measurement was not correct or the Step/Unit is wrong.

What is the advantage of using Home Off.?



The main advantage is that once a Home Off. value has been input, there is no need to take a skim-cut or touch the part that is in the chuck to reference it.


Before you start any GCode program, you need to tell the machine where the Part or Program Coordinate is relative to the Machine Coordinate. This is usually done by touching or skimming the diameter of the stock to reference Part Zero X, and to the face for Part Zero Z. With Home Off., the machine always knows where it is relative to the spindle-tail stock center line. Since this obviously passes through the center line of the part in the chuck, the machine knows where it is relative to the part. This removes the need to take a skim cut saving time and effort. Both X and Z axes on the lathe can have Home Off. values. In the case of the Z axis, using the face of a chuck to measure Home Off. removes the need to reference Z when parts of varying lengths are mounted in the chuck. There is no need to take a facing cut to set the Z 0 coordinate.


Referencing with Home Switches


First Home the Z axis. The Z Home Referenced LED turns green. Next move it to the face of the part in the chuck and touch or take a face cut. In the Manual screen, in Program Coordinate mode, set Part Zero Z = 0.0. Click Part Zero Z which set the axis position DRO for Z in the top left of the Manual screen to 0.0. Next Home X. The X Home Referenced LED turns green. Click Part Zero X in Program Coordinate mode and the axis position DRO in the top left and the X axis DRO in the middle right of the Manual screen take on the Home Off. value. Now, switching between Machine, Part and Program Coordinates will show that the top left axis position and middle right reference DROs all have the same Z and X coordinates. You can mount another part in the chuck and turn the diameter without referencing the diameter again. And, if your Z Home Off. is measured from the face of the chuck, you do not need to reference Z either. This saves time when many parts with varying dimensions need to be machined.


Home Off. however, works only if the Home switches are accurate and can maintain their accuracy repeatedly. Since I have no idea how accurate or repeatable my switches are, I chose the option of not having a Home Off. value and, instead just input 0.0 in the Home Off cell. This means that I have to reference each part before I can start.


Auto Zero

If the Auto Zero option is checked, then the axis DRO will take the value that is in the Home Off. cell.



Tool Tables.


If a Home Off. value is set after the Tool Table has been filled, all tools would need to be re-referenced.






 
^what he said. Hard limits are actual switches that stop the travel to prevent damage. Soft limits are points right before the machine would hit a hard limit, that are retained by the control software, to stop the control from moving before it actual hits the hard limit.

make sense?
 
Homing is done to establish "where things are". Some say that it establishes your "zero" but Mach allows you to have the machine set each axis to any number you like(instead of zero) when homing.

When you home the machine(or an individual axis) the axes will move to the point where they activate the switches, then back off the switch and set the axis value.

The machine will not automatically go to home position when a program is over, unless you write that into the program.

Mach can use a different location as your "safe" or "toolchange" location-it does not have to be the same as your "home" location.

Mach does let you use the same physical switch for both home and limits-in the case where a switch is activated while you are not in a homing move, it will be interpreted as a limit switch, and activate the reset. In this case, you will need to turn off the reset, "override limits", and manually back the axis off the switch. There is also a setting called "auto limit override" which will let you turn off the reset and back off the axis without pressing the "override" button.
 
I will add post #7 to my shop notes, it about covers all my questions but one I think. If I should hit any limit switch does Mach 3 allow the machine to move off the switch and stop the machine untill you can resume the program? If I get an answer to that I'll be golden on this issue.Thanks to j2mariashop, post #7 very concise explanation.
 
Back
Top