Using proximity sensors on a CNC Machine.
An inductive proximity sensor (IPS) is an excellent choice for limit or homing switches on your CNC machine. They are reliable, repeatable and dust/humidity proof. They usually come with an indicator LED which allows you to see when they have been triggered. They are widely available and cost as little as $4 USD each. Any metallic object, when brought close enough to the tip, will trigger it. There are other styles but the screw stud mount type seems to be the most common. While this blog covers using IPSes with the PicoCNC, the information is broadly applicable to other machines though some details will vary.
IPSes differ from mechanical limit switches in that they require external power, typically 6-36V. Internally they use a Hall Effect switch that drives an output circuit which can drive an opto-isolator. These do not require physical contact. As such, they usually have 3 wires though some have 4 wires. More on the 4 wire variant in a bit. The wires are set up as shown below.
The wire colors seem to be standard but consult the documentation for your sensor to make sure. Connect V+ to the 12V supply positive terminal, Signal to the Sig screw terminal for the appropriate limit input on your PicoCNC board and Gnd to the Gnd screw terminal.
There are 2 general types of IPSes - NPN and PNP. This refers to the output circuit. The details are not critical but I recommend you select NPN Normally Closed IPSes. Also, they have Normally Open (NO) and Normally Closed (NC) variants. The 4 wire variants have both NO and NC outputs.
The PicoCNC board was designed to directly support NPN IPSes. Connecting them is easy but you do need to provide 12V power for each one. Connect the Signal and Ground wires to the screw terminals on the PicoCNC PCB. Connect the V+ wire to your +12V source. I recommend using shielded wire to connect the IPS back to your system controller. Also, if you want to have min and max sensors for your axes, use NPN, Normally Open sensors for that. NO allows you to parallel the sensors into one input terminal. Connect the Signal inputs from both sensors to the input screw terminal for the appropriate axis. Similar with the V+ and Gnd wires as well. If you do choose NPN NO IPSs switches you will need to set the Grbl limit settings ($14) to invert. See PicoCNC First Run Settings for more information on that.
You might be asking - how do I power all these switches? Take the power from the PSU (power supply unit) that is powering your input section (Iso 12V). There are lots of ways to get power from one PSU to multiple IPSes but I really like using DIN rail terminal blocks. They are relatively inexpensive, very flexible, easy to install and help keep your electronics box tidy. If you need more connections, you can add on more blocks. You can do similar with ground connections. In the photo below, red is for +12V and black is ground. It would be a good idea to label the blocks.
One of the advantages of this style of sensor is that you can easily create an adjustable target to trigger it. By using a standard bolt head as the target, you can adjust it's position by screwing it in or out. This is particularly useful for auto-squaring. See my blog post about that.
Cheap or expensive?
You can find these sensors in a broad range of prices and quality. Ranging from wildly inexpensive from AliExpress to very expensive ones like from Pepperl+Fuchs. Typically, the more expensive IPSes have built-in, high quality connectors which gives you the option of buying premade cables. The less expensive ones require adding connectors which some people find daunting. The Avid 5 sensor kit that features Pepperl+Fuchs sensors and premade cables is $315. Buying the cheaper sensors, connectors and cables to build your own will cost you around $60. The savings can be significant - I think it is worth trying!
Hopefully this has helped you understand how to use these great little sensors. 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.