Why only one limit switch per axis?
I hear this fairly often. Why not have 2 limit switch inputs per axis - one for minimum and one for maximum? And, why not have a separate home switch input? This is a reasonable question and, in fact, you can find some boards that were designed that way.
In a word, the reason is cost. Each input adds cost. Not only because you need more logic and input pins on the microcontroller but also because connectors are a major cost component of any electronic equipment. And, there is almost no overhead to sorting out whether a limit event was due to a maximum or minimum switch being triggered. You can connect the minimum and maximum switches to a single input. A minimum switch will only be triggered when the axis is being moved in the negative direction and a maximum switch only when moving in the positive direction. So, the controller only needs to ask "which direction was I moving" to know which switch was triggered.
This brings up the question - how can you connect 2 switches to the one input? The answer depends on the kind of switch - normally open (NO) or normally closed (NC). In the NO case, when the switch is in its untriggered state (open), it does not conduct electricity. When triggered, it closes and conducts electricity. That indicates a limit event has occurred. So, if you have 2 switches wired in parallel to the input, either one can trigger a limit event.
Normally closed (NC) switches are exactly the opposite of the NO switch. In the untriggered (closed) state, they conduct electricity and when triggered they open and do not conduct electricity. In order to connect two of those switches to a single input they need to be in series so that either switch, when triggered, opens the circuit and stop conducting electricity. Thus, signaling a limit event. In fact, you can connect any number of switches in parallel and any one of them can signal a trigger event. Though, only two are needed.
At this point many people will ask whether NO or NC is better. For 5V limit systems, NC is better because it tends to be more resistant to electromagnetic interference. For higher voltage systems - 12 or 24V - either will work fine because the higher voltage also providesly some resistance to EMI. Another advantage to NC is that a broken wire looks like a limit trigger.
The CNC controller has a way to use either NO or NC switches. In Grbl and grblHAL, there is a setting ($5) to "invert" the pin associated with a given limit switch. A non-inverted pin sees a closed circuit as being triggered. An inverted pin sees an open circuit as triggered.
Moving on to the home switch question. We should first look at why we have the concept of a home position. Basically, it is used to create a known position that the machine controller uses to define its coordinate system. As such, the physical location of the home position on the machine is completely arbitrary as long as it falls within the work envelope. By choosing the home point for a given axis to be where a limit switch exists allows you to also use that switch as a home switch. Thus, avoiding an extra input, connector and wiring. So, in general homing switches are lumped in when discussing limit switches or sensors.
This discussion may cause one to ask "what kind of switches work for limit sensing?" In the electrical world, they are called single pole, double throw momentary. In plain English, one switch with 2 positions, one of which is default and the other position is when triggered. Triggering requires constant pressure. These go by a number of names but the most common is "microswitch" though you can use "limit switch" as a search term with good success. And perhaps even more interesting is that these microswitches can be used for NO or NC switches based on how they are connected. Study the above diagram for a better understanding of that.
Another question that sometimes comes up - why do so many machines not have a minimum Z limit switch. This is more of a preference but in general, a Z minimum limit switch is of limited value on a hobby machine. The situation where it can provide a benefit is to prevent the spindle from being driven into the machine bed. It needs to be placed to be able to catch that situation but not so high that it incorrectly triggers with a short bit in the spindle. The complicating factor is that, with long bits, you can cut pretty far into the machine bed before triggering the Z min limit. They are useful on machines where a crash will cause significant damage. Large milling machines commonly have them.
Switches aren't the only type of device used for limit sensing. Magnetic proximity sensors are used, typically on higher end machines. Their biggest benefit is for homing - the trigger point is generally quite accurate and highly repeatable. Another benefit is you can set them up so if there is a limit sensing failure the ensuing crash does not destroy the sensor. This is why you almost always see them on higher end CNC machines. They come in several flavors. In order to keep this post mercifully shorter, you can read about them in this blog post.
About Me.
I'm Phil Barrett, a long time CNC enthusiast. I run a small company, Brookwood Design, that makes several breakout boards for grblHAL and love to help people get the most out of their CNC machines.