Saturday, April 23, 2011

Limit switches, part 2

In the previous post, I showed how I added limit switch inputs to my CNC driver box. Now its time to attach the actual switches to the machine.

The limit switches can be wired in a variety of different ways. Since I only had three available input pins, I combined both switches for each axis (and have them perform double duty as homing switches too.) The combined switches can be wired in series (normally closed) or parallel (normally open). I chose to wire them in series, as normally closed (i.e. circuit is broken when the switch is triggered) has one major advantage over normally open: If the switch is broken or just unplugged, you notice it before any movement starts rather than when the machine crashes against the physical stop!

In the above picture is the finished switches for the Z axis. Right after taking the picture I realized I shouldn't have soldered the plug on until after threading the cable through the cable chain. I had to find smaller microswitches for this axis. The small switches are just the right size to fit between the Z assembly and the gantry column.

In the above picture, X, Y (not visible) and Z switches are superglued in place.
I reran stepconf and selected "Both Limit + Home X", "Y" and "Z" for pins 11, 12 and 13. This enabled the "Home all" button in Axis GUI, which automatically homes the machine using the (in this case) limit switches.


  1. Calle, please can you post a simple electrical layout diagram for the limit switch modification you have made. You say you have fitted 4.5K pull-up resistors but I can not see them in your photos. I have the same board as you and I wish to make the same modification, to avoid damage to the machine.
    Thanks in advance.

  2. I did not need to add the pull-ups, they were already in place. (At least on my board.) If you look at the closeup photograph of the circuit board on the part 1 post, you should see a black five legged component right next to the unpopulated header on the left side. It contains four 4.5K resistors that pull up the lines.

    Even without a pull-up, the machine won't break, but since the inputs would be left floating, you'd constantly get spurious limit errors from random electrical interference.

  3. Can you post close up photos of how you have the switches mounted, especially where they are and the Z axis switches?

    I have a CNC 3040 and a hand full of Omron lever action switches, but I'm kind of at a loss where/how to mount these to allow maximum travel on Z.

  4. Hi Steve.
    I can't get to the machine right now, so I can't upload a photo, but I'll try to describe how the Z switches are mounted.

    I had to use smaller microswitches on the Z axis as there is less room. (Seen in the middle picture). Those switches fit snugly in the little gap between the Z column and the side when the X axis is at the far left position. The switches themselves are superglued to the Z carriage. I used superglue because I didn't want to take the machine apart to drill & tap proper mounting holes. The switches have come loose once or twice, so I do recommend doing it properly if you need the reliability.

    Above and below the switches, to the static part of the Z assembly, I glued little pieces to aluminum to make contact with the lever just before the axis has reached its extreme positions.