Inductive Sensors for Homing and Limit Detection

Overall I’m pretty happy with my Longmill but I do feel that it should come with inductive homing and limit sensors as standard (and have no issue with the price reflecting that cost). Homing sensors are necessary in order to have stable repeatability.


Homing sensors help the machine find machine 0,0,0 when it is first powered on, so you can always begin your work from a known location. I’m not a fan of the (cheaper) mechanical sensors as hitting them will eventually break them, it might break them quickly at high speed and then you’ve defeated the whole purpose.

Limit sensors help detect the approach of the end of the physical travel of the machine, so you can avoid crashing the machine - either during cutting or repositioning. Crashes are bad and can be dangerous. At ~$10/sensor for inductive ones, I consider it money well spent. When measured in wrecked work pieces, the sensor investment is tiny.

Technically you only need 3 sensors to home but for safety reasons you should have sensors on all axis max and min. Homing sensors are a subset of a complete limit sensor setup.

I made a suggestion almost a year ago that more thought should go in to sensor placement and also general adjustments to the design to improve accessory connection. I am hopeful that will appear in future revisions. In the mean time, I spent a substantial amount of my time and effort thinking, measuring, designing and making prototypes of a way to easily mount sensors to the Longmill.


If you have a 3D printer you can probably cobble something together, but I don’t have one and there are no ready mounting points in the foot designs for the Longmill. If sensor mounts are not built in to the machine itself, at least design files would be good that can be cut on the machine without requiring a 3D printer. Perhaps that is an option in the future, if including sensors isn’t in the product plan.


So, for those who wanted to see what my setup looks like, here are a few videos. Please pardon the mess in the shop and the condition of the wasteboard. The wasteboard is about to be replaced and shows the scars of a year of learning.


I’m no expert at wiring and I didn’t solder my wires as I still consider my setup a work in progress. I use Wago 221 electrical connectors because they are very flexible and secure. I used a 10’ Cat5 ethernet patch cord with the ends snipped off for the signal lines and to carry 5V & GND from a simple USB wall power supply. I cut the end off a USB cable (not the end that plugs in the wall/power supply, left that so I can plug it in normally) and used a Wago 221 to connect the 5V and GND to the ethernet cable in the drag chain.

At the router, I used separate Wago 221 connectors for each of the signal lines on the machine side and at the XZ gantry.

Here is a video of where I ultimately put my sensors:

XZ Axis:

Y Axis:

Homing Sequence:

4 Port Relay for Noise Suppression:



Excellent work, Jeff!

I really could have used a machine zero reference to resume cuts many times.
I’ve ruined many parts because I could not reproduce my workpiece zero accurately enough to resume a cut.

Can you share some more details?, e.g.

  • schematic / wiring diagram
  • part numbers (PNP or NPN sensors?)
  • any GRBL config settings to change?
  • any special G-Code sequences (is it just the G28 command?)

I am wondering how accurate the sensors. Do you have a sense for how repeatable homing is?

Why did you use a USB power supply instead of a power supply from the LongBoard?

@jwoody18 That is a great write up, Jeff.

I bought mechanical switches for my Mill some time ago and have yet to install them.

There is one thing that I have never figured out, and that you can likely educate me on.

After installing the switches and telling grbl that they are there, when I first start the Mill, I would click on “home machine” in UGS and the machine would go to the same place every time. That being, where the switches are. I get that.

Here is my confusion. Let’s say that I do that, then I jog the machine to the middle of my work piece, and set XYZ0. I start my job. The job is going to take several hours, so after a few hours, I stop the job, disconnect the Mill from UGS, shut down UGS and turn off the Mill controller. (This is my nightly routine.)

Now, the next day, I want to continue. I have not moved the material on the bed. I turn on the controller, start UGS, connect it to the Mill, then hit “home machine” again. The machine returns to the same place as the day before. That is, where the switches are.

Now, my question (finally). How do I get the machine back to the XYZ0 that I set the day before?

Set your zero for your work coordinate system for the first cut.
Make a note of the machine coordinate for you work zero.
To reproduce the position later, move the machine to the same machine coordinates and zero your work coordinates.

@mark Tks, Mark. That’s what I thought, but I can do that without switches, so I figured that I was missing something.

Your working XYZ0 is not lost when you shut down and restart the controller. The problem is that without the homing switches the Machine XYZ0 are set to wherever the servos happen to be when the controller is turned on. Since the Working Home position is relative to the Machine Home you have issues when you don’t have the homing switches. With them you start the controller and home the machine and should be good to go.

@alanbabb Tks, Alan, but, with respect, you seem to be saying something different than Mark.

Let’s say that for one reason or another, I had run part of a job, shut down the Mill controller and closed UGS. Now I want to get back to it. If I understand you correctly, you are saying that, with switches, I would turn the machine on, open UGS, and click on “home machine”. The router would travel to the machine home/switches position. However, if I am understanding you, at that point, I can click on return to 0 and the router will travel to a saved working home position.

Mark seems to be saying that is not the case and that I would need to make a note of the machine position at work 0 when I first start the job. Then in the event of a re-start, I would home the machine, then enter the machine position that I had previously noted to get back to the position that was previously work 0.

Now, I am fully prepared to admit that I have misunderstood one or both of you. I have read pages and pages of documents on this subject and still can’t get it through my thick skull. I guess the only way to figure it out is to install switches and play.

I know for certain that there is a whole lot of incorrect information out there on how UGS works with homing, machine coordinates, work coordinates and on the functioning of G28.1 and G28 commands.

I currently use CNCjs and so I don’t have UGS available for testing but I know that Incan restart CNCjs and not lose my working home position. I would need to Home my machine when I restarted and my working home would still be correct. I can shut the power off to Longmill controller and when I turn it back on I am also still ready to go after Homing.
I use G28 and G30 a lot. I have stainless dowels I use for position jigs and have set positions with G28.1 and G30.1 for different spots on my table.
I spaced on the fact you were using UGS and so maybe there is a difference related to that I am missing.

I use CNCjs as well, but I have noticed that I can’t always rely on it to keep the working coordinates.

Is it expected standard behaviour of all CNC machine software (CNCjs or UGS) to save and restore working coordinates between sessions? Currently, I write down my working coordinate zeros on paper just be safe.

I have accidentally zeroed/changed my working coordinates many a time. So I would find it a useful feature of the machine software to be able to show a history of work coordinates that have been set, in case you make a mistake and need to go back.

The machine zero is not remembered by CNCjs. Plus, you can easily loose your machine zero by hitting the emergency stop button, running into a clamp or to the limits of the machine, or just by pushing too hard into a material causing the stepper motor to skips a few steps.

Currently, I set my machine zero manually by moving each axis close to the limit then slowly crashing into the limit. According to Sienci, this should not cause any damage to the machine.

Still, I would prefer a solution that performs the machine zero automatically with a press of a single button and without crashing into the limits of the axis.

Another criteria for a good solution is reproducibility. Ideally, each time you machine zero you should be within +/- 1 stepper motor tick (1/200th of a mm) of the actual machine zero.
In terms of reproducibility, I don’t know which of these option are best:

  • crashing into the axis limit
  • a mechanical switch
  • proximity sensor
1 Like

Yet another criterial for a good machine zero solution is squaring (X and Y rails at exactly 90 degrees).
There are two Y rails and it is possible that they could be slightly offset from each other and you would be cutting parallelograms instead of rectangles.

Currently, I assume that I have mounted both Y rails perfectly and that when I run into the limits of both Y rails that I am close enough to true square. Maybe having an adjustable screw at the end of one of the Y rails would allow for fine tuning of the square.

The LongBoard has only one input for a Y limit detector.
How could limit sensors be use to square the machine?

1 Like

@alanbabb Thanks, Alan. I have no experience with CNCjs, only UGS. I have been in discussions on the UGS google group and learned quite a bit, but not near enough. Without limit switches enabled in grbl, I do know for certain, though, that in UGS, G28.1 and G28 do not work as some people in grbl groups have stated. That, I could and did test for myself. Each time UGS starts, it overwrites any G28.1 setting stored in the eeprom. The new position is wherever the router is when UGS starts.

@mark Tks, Mark. With thanks and respect to everyone who has chimed in here, I hope that you can all see why I am confused. Each of you seem to have different experiences and opinions on how the Mill will function with limit switches. This divergence seems to be prevalent all over the net. I’ve done well without them to date. I think that maybe I’ll be doing without them for some time.

I get the confusion. You are correct that without homing switches, G28 and 30 do not work in any system. Because the Machine Zero becomes wherever the Serbia are parked when starting up.

Everything I have been talking about is based on my experience with inductive homing switches installed on my Longmill with CNCjs.

Since I am not using UGS I will try and stop adding to any of the confusion.

@alanbabb I hope that you didn’t think that I was taking shots at you (or anyone else for that matter). I appreciate your input. I may try to see how UGS works with switches, just by wiring up a couple of switches, without mounting them to the Mill. Thanks again.

I did not take it that way at all. I simply realized that I missed the UGS component. I have been on message boards with you for enough time to realize that you do take shots at people.

I was going to try out UGS with my setup but since I went to a RPI for a controller interface it would not very easy.

1 Like

I’d like to respectfully disagree with the statement “Homing sensors are necessary in order to have stable repeatability.”

I think this is misleading in two important ways:

#1) Inherent in the design of the long mill is that the machine can put itself out of square easily if one of the v-wheels encounters an obstruction. For me, the main source of this problem is the wire for the z-axis touch block, which I have run into no fewer than 3 times, causing the y-axis to go out of kilter. The fix for this is to ram the machine into the rear to square it up, and homing sensors will not help me fix this problem (quite the contrary).

#2) The absolute origin of the machine is seldom where I want to begin cutting my workpiece. Normally I want to index off of the stock itself, which will be attached to the wasteboard in different spots every time, necessitating setting up the origin afresh every time. Having an absolute 0,0 is no help at all in this situation as it is not possible to repeatably fasten your work material in the same spot on the machine.

So while it’s great that you like having end stops, I think you are overselling their importance on this machine and I currently have no plans or need to install stops on mine, nor a desire to pay for them built into the cost of the machine. If I thought the opinions of the folks at scienci differed from mine, I’d suggest you get them to sell it as an add-on to the machine, but I suspect that they feel end stops are not necessary for the machine and are reluctant to sell people accessories that aren’t really needed.

I’d legitimately love for you to tell me what workflow you are using where homing the machine to absolute 0 plays an important role in giving you ‘stable repeatability’, which I interpret to mean that you are making multiples of the same design and feel that they won’t come out the same without homing to absolute 0. Thanks!

1 Like

@anicolao While I clearly am not a salesman for limit switches, and I do not have them on my machine, I routinely do jobs of many pieces and I can, with no problem at all, fasten my material to the same spot every time. If I could not, I would not be able to do the projects that I do. There are numerous ways to index your material on the bed. In another thread here, Jeff showed his dowel indexing system. I use blocks clamped to the spoil board that I just place the material against and then clamp the material in place. I have fences on the sides of my vacuum pucks that make it dead simple to ensure my pieces are in the same place each time.

Finally, I do picture frames that require two-sided routing. Using dowel pins, I can place the piece in exactly the same place when I flip it. If I could not, the double-sided job could not succeed.

edit: My apologies to Jeff for taking this off topic.

1 Like

@gwilki Thanks for the helpful response! In my setup, I make no effort to get the material in the same spot – though I will need to do it for double-sided routing, I will accept errors of a fraction of a mm when doing that.

For your setup, with blocks permanently clamped to your wasteboard, you can easily get a repeatable 0 without end stops by using the z-limit aluminum block on the corner of one of your fixed blocks. Then if you want a different 0 for your workpiece you merely need to do what @mark suggests and note the coordinates of your workpiece 0 vs your fixed block 0 and you can recover from any situation if your goal is to continue a cut that has failed for any reason.

With solutions like that supported out of the box, I still don’t see the need for limits on the axes, but hopefully someone who does can enlighten me. Nothing like new toys or add ons for the machine :slight_smile:

1 Like

@anicolao Tks, Alex. I can live with my double-sided pieces being out by a fraction of a mm, but there is really no need for them to be out at all - within the capabilities of the Mill. I use aluminum dowels as locator pins and they fit very tightly into the 1/4" locator holes in the frames.

I started using my fixed blocks when I was asked to do 40 double-sided name coasters for a wedding. They were oval in shape and I simply cut the same oval out of a piece of 3/4" MDF that I screwed down to my spoil board. Each coaster fit into the oval in that holder. A cam clamp, also with half the oval shape cut out of it held the coaster in place while it was being carved. As there was no room for movement between each coaster and the holder, I did not need to reset any of the axes between carves. As a result, the job went very quickly.


I do not spend much time on here and just came back to the forum looking to see if there was any info on the rpi version of the Gsender program. I noticed in my update list this old string. I also noticed that in my response to one of your posts my darn autocorrect or my bad typing removed the word “not” from a sentence. I was trying to say I know you do “not” take shots at people in the forums and on Facebook. Somehow I managed to make a mistake correction into an insult.
Sorry about that, even if it was a few months ago!