"Limit" Switches Finally!

So I thought it would be good to make a new topic now that I have this sorted out.

As you all know by now or are about to figure out after starting to get to know your machine, The X-Carve has the option when buying to add Limit switches. The only thing is, just because they have them listed in the configurator as limit switches doesn’t mean they actually work as limit switches as many of us found out the hard way after crashing our rails and breaking out switches. In anycase they will work as homing switches right out of the box.

For clarity

  • Homing your machine is a procedure that lets the machine know where on the board it actually is by going through a setup where it touches 3 switches on the X,Y & Z rails.

  • Limit Switches stop a machine from going to far and crashing into the rails causing damage to your machine.

Now not having your switches work as limit switches in Easel is not so bad as the program is such that it doesn’t allow many mistakes (of cause, I’m sure we all smashed 1 or 2 Z axis switches when pressing the wrong button setting your home spot). But the real issue comes when you start getting more advanced and using chilipeppr or Universal Gcode Sender or another 3rd party program as you will quickly do when you want to start doing 2.5D and 3D carving.

Ok so after many of us on the forum figured out they didn’t actually act as limit switches we started looking for workarounds to this. The best way Grbl to handle limit switches is by enabling Hard Limits which set off an alarm and stop the machine when a rail hits a switch. The big issue we have been having is when you enable your hard limit command $21=1 your machine automatically trips false alarms and locks the machine. Some say it’s the spindle noise but it happens with the spindle off, some say it’s the steppers, other say noise from the electronics etc… In any case the first work around found was replacing the original limit switch cables with shielded cable, the issue I had with this was who in there right mind wanted to go through the hassle of changing out all that cable and rewiring through the drag chains (especially if you have the X-Carve 1000) Plus there’s the obvious expense as well of $50-$75 for the shielded cables. So after a lot of research I designed 3 small circuit boards pictured below (1 for each axis) although I should’ve just made it into one board (next time I guess) that filtered any noise from anywhere and guess what! I know have real working limit switches. No more rail crashing, no more broken switches, etc… I posted a video showing it work, of cause I ran out of space on my phone half way through :smile: in any case here’s what i’m thinking as I had to buy all these resistors, capacitors and screw terminals in bulk as well as design the board and I really need a Gopro to document my X-carve makes and adventures I thought if others are interested in this and would like me to have new boards made up and soldered ready to install I could put the profit towards a new Gopro, so let me know if your interested. Of cause I am posting the circuit below for those who wish to take on the challenge themselves of making them as I am here to share the knowledge not to make a living out of it. So I hope in any case everyone uses some sort of work around to get the limit switches operating correctly so they don’t break something at some point down the road.

Video of it in action
https://www.youtube.com/edit?video_id=Jq3hmWLEPSc

4 Likes

My machine never goes places I don’t want. I show stick to it. Under tide discipline. :rage:

2 Likes

I would always press the Z instead of Y direction when I had it set to jog at like 2 inches and crush the Z switch and scare the s#$% out myself when i heard the noise :smile:

2 Likes

Well, I have already post Z switch guard idea, it takes one simple hole, screw and two nuts. Let me know If you didn’t see that, I can find it.

Just saw what you did, but isn’t that putting a lot of strain on the motor and z axis when and if it crashes?

Isn’t it same thing when you hit top plate and crash the switch in same time. At least stops before crashing the switch.

I still think that soft limits are a better solution to keep your machine in bounds.

I take away the argument that software failures would still allow the machine to crash with soft limits because the hard limits still use the same hardware pins and software as the homing switches to stop the machine when a limit is hit. So, if there is a software failure neither soft nor hard limits will prevent a crash.

With soft limits the software checks the co-ordinates before the move and alarms if they are out of bounds with no movement of the machine.

Hard limits only stop the software when a limit switch is triggered. Your machine may be doing a fast move when the limit switch is triggered which means you are going to try to stop a fast moving spindle in less than a millimeter.

So, it’s my opinion that unless you are going to implement true “limit switches” that cut power independently from the Arduino/gShield you are no better off with hard limits than you are with soft limits.

BTW, even with independent power shutdown, you still have a fast moving spindle 1 mm away from a hard crash when the limit switch is triggered.

However, I’m glad that your low pass circuit worked on eliminating false triggers. It gives people a choice in retro-fitting their X-carve.

Yes the soft limit is an option unless of cause you forget to home your machine or are using Easel in which they remind you, but you are correct both are software based. I like this cause it takes all the what if’s out of the equation and operates like a more professional cnc, plus the maker in me had fun figuring it out. But like i said above as long as you use some kind of work around to stop a crash. it had just always bothered me since I ordered it and thought it was coming with what said “limit switches” so really wanted to get it working.

Yes. I think there are a few issues that come up because expectations are not met and product descriptions are a bit off the mark.

I am trying to implement magnetic switches based on normally-open reed sensors.
So far, the achievements have been as following:

  • I built three little boards, installed the sensors on the axes and placed the magnets (see photo)
  • If checked with a multimeter, the limit switches are reliably triggered at the end points, with accuracy < 1 mm.
  • grbl v 0.9j recognizes the switches and reports correct closure (e.g. ? Lim=101 if Z and X are at the end-point, and Y is not.)
  • However, if I try to run the homing cycle ($H), grbl stops randomly. Sometimes a homing error is reported, sometimes is not, but reliable homing is not achieved.

By digging into the issue, I realized that 20K internal pull-up resistor in the Uno board is adequate to handle simple breadboard projects with several cm of wiring, but can’t handle sensor wires several meters long. As the wires move, the capacitance between them changes, creating transients, and the digital pin reacts to the change. To add to the problem, different makes/batches of Uno boards are slightly different, and my have different resistors and such. The result: everybody plays with wire gauges, shielding, resistors and capacitors until some result is achieved (sometimes it’s never achieved). But: creating a dynamic system with stable capacitance parameters is tricky!

The obvious solution would be to condition the input signals. The proposed (simple) diagram is as below:

Attaching the reed sensor between the test point and the ground should do the trick. As a side benefit, the LED is lit if the reed is triggered.

The more complex option is to condition each sensor with a Schmitt trigger and an invertor, to achieve a reliable logical ones and zeroes on the line.

Does anybody have experience powering the limit switches from the external power?

You’re over thinking it, use the circuit i posted above (one for each axis) and you will be fine with your magnetic switches

Thanks. Are you using Arduino’s 5 V pin to power up your boards?

Yes

One more question: are you disabling the pull-up resistors in GRBL?

define DISABLE_LIMIT_PIN_PULL_UP

No just enabling hard limits

Well, all works! The final wiring diagram was like this:

The resistors are packaged within the control box:

Fundamentally, the “classic” approach with large-gauge shielded wires can be simply addressed by an extra 5V connection. As suspected, the internal 20K pull up resistor cannot supply current for the long wires fast enough, creating transients. It does not matter what exact value resistors are used to power up the sensors as soon as they are less than 3-5K. The inputs are limited by 10K resistors. Perhaps, the Inventables should include this into the standard limit switch kit? The cost of 6 resistors and 3 capacitors in next to none.

The debouncing in my machine is set to 32, pull-off 6 mm, hardware limits control:

$20=0 (soft limits, bool)
$21=1 (hard limits, bool)
$22=1 (homing cycle, bool)
$23=3 (homing dir invert mask:00000011)
$24=25.000 (homing feed, mm/min)
$25=750.000 (homing seek, mm/min)
$26=32 (homing debounce, msec)
$27=6.000 (homing pull-off, mm)

The code is compiled with:

define HOMING_CYCLE_0 (_Z_AXIS) // First move Z to clear workspace.
define HOMING_CYCLE_1 (_X_AXIS) // Then move X (to left).
define HOMING_CYCLE_2 (_Y_AXIS) // Then move Y (to front).
// (homing by each axis separately)

define HOMING_FORCE_SET_ORIGIN // Uncomment to enable positive machine coord.
define LIMITS_TWO_SWITCHES_ON_AXES // magnets on both sides
define DISABLE_LIMIT_PIN_PULL_UP // hence we are pulling pins with external resistors

Thanks BrainSaban for timely advice!

3 Likes

Where do I send money? I could build them but the closest Radio Shack is far away.
I am very tiered of crashing it and Inventables does not understand what a limit switch is.
I even have a large diagram to show what direction is what.

Sent you a message with the info

This is much like moving the Z axis down before moving the X and Y to start position. Auto crash.
I have been a CNC machinist for about 40 some years, The Z is moved last so to clear all obstacles.

This brings us to the limit switch. The limit switch is a hard stop limit which keeps the machine from hitting the end of travel and attempting to continue.
They are present on all commercial CNC machines for that reason.
A homing switch can double as one end but a second is required at the other end so over travel does not happen.
Has nothing to do with device or function, it has to do with hardware and machine safety.
Just as moving the X and Y before the Z.
I quit using Easel because of that. I now do some designing and then export to CNC editor to remove bad moves and useless lines.
Just to clarify.

Isn’t there a way to put the limits within the machine? (I don’t have my Xcarve yet)