Homing/Limit Switches

Thanks for the reply sysimgrp. Hmmm…those laser cross hairs are an awesome idea!
I’m going to look at that again once i have the rest of the machine running.
Thanks again


I didn’t want to open a new thread, but hope that some of you have come across more info than i have.
I am looking for some external logic schematic or “wisdom”, which would enable us to home the two Y motors, according to their individual limit switches. As i see, the control board allows one homing switch per axis. Other types of controllers out there use the Slave Axis function and two limit switches, thereby allowing the CPU to independently home the motors.
Some guys did mention wiring up some external logic in order to get this to work.
The option to manually jog the Y axis up to the hard stops and then shut off power to the motors,…turn the screws by hand till they touch, and then power up…does still exist. I just wanted to do this electrically.

JerryBurks on Planet CNC had this idea:

  • each limit switch is logically “AND” connected with the “direction” line to the drive enable input of its own screw. That means if one of the axis is moving into the switch it will stop this motor but the other one keeps going until it also hits its own limit switch.
  • both limit switches are “And” connected to the switch input of the controller board and will trigger it when both switches are active, thus enabling the “home” sequence.
  • once the controller turns the direction around, the enable of the drives is cleared and the screws can move in the other direction away from the switch

Another fellow from Duet3D, Kazolar, posted:
– I feed each driver with output from a single step/dir/enable set, and feed them through CMOS 3.3v logic gates which stop sending the step to the stepper driver which hit it’s end stop, and the result end stop is a logical union of the left and right end stops – so this way I can use 1 duet control signal and end for 2 steppers and 2 end stops –

Ok, I hope there is still someone following me on this…I think there are a few of you who are electronics savvy and can verify this for me… any thoughts?
Or maybe some better results from google searches?

Some may be wondering, why i need this? …I want to have a very repeatable home position, that can be repeated after a power outage, any error and daily start up. Needed when using multiple fixtures and reference offsets, and front/back carvings.

Greatly appreciated

1 Like

Hansi, I may have misunderstand your goal, but it sounds like you want to individually sense and control both y axis motors. I know that on belt-driven machines keeping the two Y axis motors in sync has been an issue, but I haven’t heard of anyone having this problem with the LongMill. Unless you use extremely high travel speeds I would think it would be unlikely that one of the motors will miss a step.
If your machine is aligned so that both Y axis motors would ‘hit’ the end stop at the same time, and you only want to detect them both, you can wire two normally closed switched in series. Either one will stop movement. If you want to make sure they are both at the end of travel you can wire them in parallel so the board has to get signals from both to consider them homed. Make sure you use the capacitors as shown in the GRBL manual. You can also use the series method and put a switch at both ends of the axis and use them as limit switches.

Hi Bill, thanks for the reply. Sorry, little late on my part.
Yes, you understood correctly…I would like to sense both Y motors, independently. I am doing a scratch build, so I don’t have the stock controller like you, but the same from the point of only having one homing input per axis.
I wanted to use this function to “square” the gantry every time I home. I read that on stepper startup, motors index to the nearest full step, but direction is random. So i didn’t want accumulated error. I thought maybe somebody had figured out some external logic, to do this trick.
I guess i could still turn the motors manually with power off…and the half step issue, is kinda small.
Thanks for reminding me about the capacitors…I think they should be 0.1 ceramics and probably help on any kind of controller.

Hansi, once I squared up the frame as well as I could with a tape measure, and before bolting it down, I ran the Z axis back and forth at a slow speed from end to end several times, watching for any movement in the rails. Then I ran the Z almost all the way to the back, turned off power, and manually turned the Y ball screws until each side was up against the end blocks. Then I powered up and ran the Z to the front to be sure they touched the front end blocks. Then I repeated the slow run back and forth looking for any movement in the frame. Then I screwed the support blocks down, being careful not to move them while running the screws in.

I have, like you, wondered if there was enough error from start/stops, rounding from direction changes, etc. to cause any significant , or even noticeable, change in the alignment of the axes. I repeat the back and forth test every once in a while, and have not found any errors. I make qute a few aluminum parts with bearing pockets, alignment holes, etc. and all seems well. True the parts are relatively small so small errors might not be showing up, but I mic the parts and have been pleased with the results.

On an sort-of-unrelated topic, while testing the LongMill’s ability to do aluminum, I was reminded that you can’t always believe the specs from the manufacturer of the end mill you’re using. I use the Sienci 1-flute 1/8" mills for aluminum and they work great. Because of their shape, it is very hard to accurately measure the diameter of the cutting surface. I tried it at 0.125" and the diameter of the holes came out 0.012" too small, so I dropped the mill diameter to 0.113". Then they were 0.008" too big. I finally settled on 0.118 for the end mill and it’s right on. The reason I bring this up is that now that the cutter D is firm, I am getting very repeatable results, which leads me to believe the LongMill is behaving correctly. I’m almost done with the assembly of a drag knife, all the parts of which were made on the LongMill from 3/8" aluminum plate except the shaft that I turned on the lathe. I’ll get assembled pics up in a while.

Good talking to you. Stay safe.



Those look great, Bill. I’ve been looking at plans on line to make one. What are you using for your cam program. Is it, by chance Vcarve (hint, hint).

I assume when you said that you ran Z back and forth, you meant Y. Yes?

Grant, yes I meant Y. I’m easily confused.

Thanks. I designed my own version and then found a set of drawings from Grunblau (I think that’s the way you spell it) for $5. They are his idea for the knife, not plans, so they need some massaging to actually make the part. I liked his design for the frame over mine so I used his. Unfortunately, I used Fusion 360.

The LongMIll with the 1-flute aluminum end mill did a great job. Cutting time was about 35 minutes each for the bearing caps, 55 minutes for the frame, and 10 for the clamp bar. The shaft is aluminum until I find that it needs to be SS, obviously not done on the LM.


Tks, Bill. I bought his plans for a soap dish. I never was able to get the 3D drawings to work in VCarve and the included Gcode would not run, as he clearly was not using grbl inch, but I’ve used his double-sided cutting jig for a couple of projects. So, I feel that I got my money’s worth.

I’ll be interested to see your cutter in action.

Wow! First of all…Nice parts!
You really pushed my hopes for this Mill.
I’m impressed! Yes, dimensional parts? Not just an aluminum carve… That is awesome… Hats off :clap::clap::raised_hands:
And thanks for verifying that the gantry doesn’t accumulate start up error.
I will try an follow your technique for tracking the Y.

You obviously have to go slower and shallower on aluminum, but I’m impressed with the details and repeatability. In this pic of the frame the two raised parts are there to restrain the blade and are 0.025" deep. The pic does not do the part justice - all of the things that look like depressions and defects are really reflections from a surface that’s so smooth you can’t feel them with a finger nail. If you look at the edges of the part you can see how crisp an edge can be. Maybe in 100 years when I get good at this I’ll work on my photography skills.
Have fun. Stay safe.



I’m really impressed! :raised_hands:
This opens up a whole new opportunity for me. Once I get that far :see_no_evil:.
You don’t experience any deflection problems?

I probably get more side-to-side deflection than most people because I mounted the LongMill frame on 1" tall strips of MDF in order to allow room for tall work pieces, and I have to keep the router as far down in the clamp as it will go. This creates a longer lever arm between the clamp and the cutter, so it takes less force to deflect the cutter. Even so, with the slower speeds and shallower depth of cuts, I am getting measurably good results with aluminum. Another down side of raising the frame is that sometimes the dust boot is lower than the bottom of the router, so vac efficiency suffers. I get around it with a sealing plate I milled to sit on top of the dust boot, and by using several layers of MDF under the waste board. Engineering is the science of trade-off and compromise.

I have the 1st pass drag knife assembled waiting for the epoxy that holds the 1/4" shank to the top plate to cure and I’ll see how it works.

Have fun. Stay safe.


Great! Thanks for the info… And you have me in suspense over that drag knife :muscle::open_hands::open_hands:

Philip: I skimmed this thread again, and I don’t see where you have your shield grounded?

Why the .1 uf capacitor?

per the Long Mill Documentation, section 5.0 Advanced, adding limit switches:
“It should be noted that it is very important to shield and filter noise along the lines with the limit switches, as interference can cause the limits to trigger erratically. We have found that placing a 0.1uF capacitor across the input and ground for each limit helps to prevent errant triggers.”

the shields are not grounded.


Not sure if you found an answer to your question yet but I have some code I wrote this week that I could share. I am using magnet switches that appear to be fairly standard and I wired them up to a Raspberry Pi, through a few resistors to take take the voltage down from the 5V I am driving them with to the 3.3V input required for the RaspberryPI GPIO.

In this was I can detect all six of the limit sensors being triggered individually. Also, the way the particular switches I have ended up working is they carry the supply current on the signal pin (they are 3 wire NO switches) and when the switch is activated, the power on the signal pin goes low and it is enough to drive a 5V relay. So you can use them without the Pi but you lose the ability to do fancier things you may want to try.

I had it all working on my bench where any sensor would trigger an alarm and report and log on the Pi with a corresponding outbound signal to a 5V relay that would connect to the input lines on the Arduino. So you can definitely detect two Y motors at the Pi, but what you do with that information - how you get it to GRBL and get it to do something about it, isn’t clear to me.

I’m happy to share my python code and notes with you if you would like, just send me your email address. In the process of preparing for the project I discovered the gpiozero library and it made the work quite enjoyable and easy. You may want to check it out.

In terms of mounting, after multiple prototypes I have milled a piece that sits across the top of the ZX plate and has mounting holes for the sensors for both X± axis and the Z+. As well it provides support for the vac hose which has caused me problems from the outset - so much torque.

I haven’t figured out yet how/where to mount the Z- sensor. My front Y sensor is mounted in the table in the front left corner just in front of the foot. As the gantry rolls up and over it, the sensor triggers. This position works in the front but not in the back due to the leg design, which is unfortunate. Also you loose a bit of Y travel due to the sensor having a small range where it is still active after being triggered and also GRBL having the homing back-off distance. Well worth it for repeatable positioning though.

At the rear I haven’t decided how to mount the sensor yet but have been experimenting with putting it through the opening in the leg somehow, horizontally from the rear. It’s a shame that there aren’t any mounting spots.


Thanks for the info… I’d be happy to see some pictures of your sensor mountings.
A guy from another CNC forum shared some relay logic with me, regarding the two motor Y axis homing circuit. When I get that far, I’d like to test it and ask the fellow for permission to post his solution for others.

Can anyone tell me the whole wiring diagram for wiring the limit switches in a normally closed configuration