(my) Limit switch hardware solution

I’ve noticed a lot of people seem to have problems with limit switches. Looks like it’s more operational than hardware, but I thought I’d share my solution to the issue.

I’ve been working in electronics just about all my life, I did sell hotdogs from one of those stainless steel carts, but that was long ago…

Having said that, I don’t like “bouncy”, “noisy” mechanical switches. Initially, I used some 5mm proximity sensors left over from an old robotics job. They worked well, but don’t seem to be lasting too long (wire breakage). And are quite expensive to replace. Plus I had to make an input/comparator PCB to power/read them.

So I ended up changing out to a simple Hall Effect switch. Small, solid state, open collector/drain, wide voltage range (supply and switch). Being open collector/drain, they’ll interface to most of the controllers out there (the ones I use anyway). Just pull the input low and the controller sees an input. Some controllers supply 5V for their switches, some 12V. So the wide voltage supply and switching is ideal, no regulator (as it’s built into the HE switch). Change controllers, no problem, just make sure the pinout is the same.

I used a shielded 3 wire cable (GND, VCC and OUT). The sensor comes in a modified TO-32 case, so I bent the leads coming out of the bottom, very tightly next to the body, backwards, then up a little and another right angle (so the leads look like they’re coming out of the back of the switch, instead of the bottom). Straight back would probably be OK, but I’m a little OCD that way…

Solder one wire to each lead, cut the shield back, and almost done. Some drinking straws are pretty dang close to 5mm diameter, so I just cut some sections about an inch long. Stuck the cable, hall effect sensor in there with some JB weld epoxy and let it dry. (some clean up is probably needed, wait for it to dry a little, then some alcohol will do nicely) The sensor just fits in that 5mm straw, so that or anything larger, your choice. Just think sensor placement, centered in the tube is best. And make sure the active face of the sensor comes all the way to the end of the straw, too far back and a weaker magnet may not activate it. (and I’m guessing I don’t need to mention the testing before the epoxy…)

Crimp some connectors for the JST connector, 2 conductors, and the shield crimped with ground. And you’re ready to go.

I ordered some 2mm “super” magnets off Amazon for a couple bucks. These are very small, and more than strong enough to activate the sensor. So you can place them quite easily. I also had some delrin laying around, I made some plastic blocks of it to hold the sensors. How you mount them to your machine is up to you.

Some controllers only have GND and input on them, so you’ll have to come up with your own method of grabbing VCC and wire it to each sensor.

I haven’t finished it yet (I did test this, and it works), but these will also drive an LED as well as activate the controller input. The only problem is you have to make sure the current limiting resistor is correct for the supply voltage of the controller and needed current for the LED. I’m thinking of making a constant current source out of a few left over LM334Z (I think that’s the part). Then I don’t have to worry about it. So, bonus, you get a nice little LED board that displays the current condition of the limit switches.

I also made an extra sensor cable assembly, for use on the rotary attachment. Since those magnets are so small, you can easily stick one on a work piece and and have a solid reference for starting.

Hope somebody can use this.

Did something similar a few years back… Tried the optical home switches on a cnc3018 type machine. Ran that way, then had a pair of instances where the spindle threw debris into the optical path and ruined the job…

I switched them out for hall effect devices… I have 5 home switches.

One at each end of the x and y axes and a single one on the z that triggers at both ends of travel…

The photo is the way it’s mounted on the z axes to allow one sensor to handle both ends of travel. On the right a closeup of the board itself…

Here is the schematic.

LED1 illuminates when the device becomes active from a magnetic field.

D1 isolates the two same axes switches from illuminating both of the leds on an activation … a wired or configuration.


@Microguy Good post… thanks from the group…

:smile_cat:

I can see I’m going to have to make a couple of modifications. Took me a second to see how the Z axis was working, Currently, I have two on all axis, this would simplify a little more.
I wasn’t sure about the two inputs activating at the same time, I just assumed the had two inputs connected (wired OR) to a single CPU pin. It could work just as well, you don’t need to worry about which limit switch was activated, just that you had reached A limit, any limit.
I’ll have to look at that also.

Ah… more stuff to do.

Thanks!

It will work fine with both of them together.

I only want the board that’s active to illuminate, not the limit on the other end of that axes…

Just the way I like to do things… I can tell at a glance which is active or which is failing.

Good luck

:smile_cat: