Hello Guest it is September 23, 2021, 10:27:28 AM

Author Topic: Setting up limit switches, Mach3  (Read 8637 times)

0 Members and 1 Guest are viewing this topic.

Setting up limit switches, Mach3
« on: May 04, 2018, 06:40:55 AM »
Hello all,

I recently bought a chinese CNC Router, controlled by an "Nmotion Mach3 USB motion card" (which seems to be quite shady (?), see attached picture).
The manufacturer won't answer my requests for support and didn't send any documentation, so I'm a bit lost.

I'm trying to configure the limit switches (end stops), but I can't get them to work. When they are active, they are detected by Mach3 on the Diagnostics screen, but it doesn't stop the machine as it should.
How can i configure Mach3 so that is stops the machine when the limit switches are active ?

Thank you !

Re: Setting up limit switches, Mach3
« Reply #1 on: May 04, 2018, 07:09:56 AM »
are you trying to set up limit switches or home switches?

Limit switches are at each end of the axes, so two per axis, three axes, ergo  six switches. They would be X++, X--, Y++, Y--, Z++ and Z--.

What you have shown in your screen shots is home switches. You have one home switch per axis ergo three switches. You can set it up that three of the limit switches
do double duty as home switches but it is preferable to have separate homes and limits.

How many switches have you fitted? Where are they mounted? Are you actually trying to prevent the machine from banging into the endstops or would you be better with
home switches and softlimits?

« Last Edit: May 04, 2018, 07:16:49 AM by joeaverage »
My wife left with my best friend...
     and I miss him!
Re: Setting up limit switches, Mach3
« Reply #2 on: May 06, 2018, 01:46:20 AM »
some background to the choices....

Industrial machines have both limit switches AND home switches.

Industrial machines usually have powerful servos through reduction gears driving the axes and have a great deal of thrust and momentum. It is vital that limit switches
protect the machine and operator in the event of an overlimit excursion.

In Mach3 its common that a limit event will cause Mach to issue an Estop command and therefore stop all motion. This relies on the computer to recognize a signal and shut the machine
down. An industrial machine cannot rely on a computer, its just too dangerous. Consequently the limit switches are hooked into the power supply. If a limit event occurs the main contactor
drops out and the machine de-powers....no ifs....no buts. This will often result in damage to the workpiece and will certainly require considerable time before the machine can be reset and put back
in service. For an industrial machine to hit its limits is a bad bad thing, the limits  are there as a last resort and probably legally mandated that they work in an absolutely certain way and so you try
to avoid overlimit excursions by all means possible.

There are those on the forum whom advocate that our hobby machines should operate the same way. I did not bother with my mill and lots of other hobbyists ignore that advice as I have. I suppose
it depends on your machine, if you had an axis powered by a hydraulic ram you'd certainly have to think about it!

One means of preventing overlimit events is 'Soft Limits' It means essentially that Mach keeps track of where the spindle is and if you create a move one meter to the right say, and it knows the
X boundary is only 500mm in that direction it will not do the move. This relies on Mach being able to keep track of the machines position. Mach does a very good job of this  except under fault
conditions. When you first start Mach though it has no idea where the machine is, you have to tell it or 'Reference' it. This is where home switches come into play. An axis, lets say X, will drive
at a slow (you nominate how fast) speed towards the X axis home switch. When the switch activates it backs up until the switch deactivates again and Mach 'declares...we are at X 0' and sets the
machine coordinates of the X axis to zero. It will then home the next axis in your nominated home order. Once all three axes have completed homing the machine is now at 0,0,0.

The Home Direction, Home Order, Home Speed are part of the data you will be required to populate the Home/Limits page. You will also tell Mach where the boundaries of your machine are relative
to the 0,0,0 point. They are known as the Soft Limits. If for instance you had you X home switch 100 mm in from the right hand most end of the X axis and the axis had 1000mm of travel the the soft
limits would be -900mm and 100mm.

Because Mach relies on the numbers you have supplied to protect both the machine and you its important that the home switches reliably and very repeatibly  signal the 0,0,0 location. I use quality
Honeywell Roller Plunger microswitches with activation ramps which allow good repeatability. I get 0.02mm which I am happy with. I can for instance be doing a job and stop it part way through, turn the
machine off and come back the next day, re-reference my machine and start from where I left off yesterday within 0.02mm without having to reset or re-measure anything.

I operated my mill without home switches for about 9 months and had a few crashes, especially as I was learning. Then I got around to fitting home switches and I've had one crash in the four years
since, and that was because I was doing something oddball and forgot to home the machine before I hit Cycle Start......dummy!!! All in all good home switches have done more to improve my mill
than any other modification.  I highly recommend you fit good home switches.

You may have noted that the home switch DOES NOT HAVE TO BE at one end, its common but not actually required. Sometimes its much easier to mount a switch somewhere inside the ends. Limit
switches on the other hand have to be mounted so that they operate and the ends of travel. That brings us to the next point. In the early days of Mach when everyone use a single parallel port
which has only five inputs it was necessary to economise on inputs and try to combine both home and limit switches. Many people still do but I think its a mistake. If you use one or more of your limit
switches as a home switch as well when homing Mach treats it as a home switch. If the machine cocks up it will sail past the home switch....remember while homing it ignores limits and you crash. Whereas if
you have separate home and limit switches then Mach will ALLWAYS treat a limit switch as a limit event and Estop, even and especially when homing. If you are going to have a cock-up whats the bet
it will happen when you are trying to sneak up on a switch, particularly if that switch is right at the end, a few mm more and CRASH!!!

I think that your controller has plenty of inputs and so you can arrange homes an limits for best performance rather than be limited by available inputs. I would have three separate home switches,
each with its own input pin. All the normally closed contacts of your limit switches (six of them) can ALL be connected in series to one pin for limit protection. You probably have enough inputs to
have each limit switch on its own pin, a modest advantage only.

A few ideas to think about!

My wife left with my best friend...
     and I miss him!
Re: Setting up limit switches, Mach3
« Reply #3 on: May 09, 2018, 08:24:17 AM »
^ Great reply from Joe as usual. It looks like your actual limit switch inputs are currently disabled so you'll need to activate that and run something into that pin.
Inductive proximity sensors are usual for home switches, and sealed NC microswitches are usual for limits. My machine is set up like this with the homes almost at the maximum + direction of each axis - The limits are at the absolute maxima.
I've used a series loop for all six limit switches so that all the switches trigger one pin. It makes very little difference operationally speaking and uses less wire.
Noise can be a problem on home and limit circuits so it's worth letting a nominal current through the loop (say 50mA) by fitting a decent pulldown resistor to the pin and 0V. This ensures that when the pin is held high by the power supply to the switch loop there is little enough loop resistance that any noise trying to pull the pin voltage down will make no difference, and when the limits are triggered the pin falls to 0V promptly and can't float up or be driven high by spurious signals. It's a common strategy in antenna controllers where long wiring systems may be subject to electrical interference, noise, microwave pulses and other mischief. How you implement this on the home switches will really depend on the sensor you use but it's just as important.