Occasional musings

lasercutter, electronics Richard Chapman lasercutter, electronics Richard Chapman

Optical limit switch woes

One of the limit switch modules from Amazon

I’ve been putting the finishing touches to a motorized bed/Z-axis for my (heavily-modified) K40 laser cutter, and the last thing I needed was to move the limit switch from the bottom of the travel to the top - that way I can adjust the Z zero to be the point where the bed is at the laser focus, and the required Z position is then just equal to the material thickness. This seems to be the best configuration for Lightburn to work with.

There’s very little space to spare inside my modified K40 enclosure, and there’s not a lot of clearance between the bed and the Y axis rails or anywhere else that I might be able to mount a limit switch, so my options a little constrained. The optical limit switch module I had was too large, and any micro-switch would bet in the way of being able to remove the bed, so I set about looking for smaller optical limit switch solutions.

My first plan was to use one of the limit switches that came with the original K40 X/Y axes, which I had removed long ago. This almost worked, but these switches are very small with a very narrow slot, and it wasn’t going to be easy to get everything lined up reliably.

My next plan was to buy an optical detector unit from RS-Online that seemed like it would be perfect - small enough to fit but with a reasonable gap. But when I wired it all up (using the same schematic as the K40 limit switch, where it worked fine) I just could not persuade my controller to recognise it. I could/should have debugged it I suppose, but I decided to go straight to plan C and buy some cheap optical limit switch modules from Amazon for next-day delivery. 5 prebuilt modules for less than the price I had paid for components for two from RS, no soldering required, and hopefully would just work…

Well, some soldering was required as I had to remove the connector on the back and solder wires in place, but it mounted very easily, and initial testing seemed great. But it soon became clear that once the limit was triggered, it was not (reliably) clearing. I tried a couple more modules from the pack of 5, and all had similar behaviour. So much for the “just work” theory.

I was about to give up for the day when I decided to trace the circuitry on the modules to see what was different from the working circuit I had in the K40 module. There was a bit of extra circuitry devoted to driving an LED to signal the state, but the only significant difference was the presence of a pull-up resistor to 5v from the collector/output signal, which is not present in the K40 limit switch.

The top resistor in this picture is the pull-up

Resistor removed. Yes, I could have unsoldered it, but snipping it off was faster.

I have no idea why this resistor caused the problem that it did - but snipping it off seems to have reslved the problem and I finally have an operational Z-axis limit switch.

Z axis limit switch in place.

Read More