Endstops, Limits, Homing and Deracking.

Hi All,

I’ve been using my MPCNC for is a test bed for me to learn more about Machinekit.

I’m running Machinekit on a Beaglebone Black using a Cramps cape.

Anyway, I’m very close to getting converted over to Ryan’s 525 assembly with the T8 nut.

One of the things that I’ve been wanting to try out with Machinekit, is auto homing and deracking.
I’ve been using gantrykin kinematics which seemed like a good idea at the time, doesn’t have that capability.

In machinekit, there is a configuration there that automatically de-racks a gantry

Here a example

So what I’m shooting for is auto-deracking and homing two gantries independently.
If I can manage to get this to work, I think this should be pretty cool.

In order to get auto-deracking to work using Machinekit, I need need to be able to do fine mechanical adjustment on one of the switches to align things. This is pretty much a work in progress for me. In the current issue of Digital Machinist there was an article on limit switches for the Mini-Mill by Don L. Shaffer. He had some configurations in there, that I had not thought about before, that I might wind up trying for a limit over-run.

On a side note, I had not foreseen is that the 525 carriage is slightly taller. I have a cable chain tray that was resting on the steppers that I need to raise.
In addition, I wanted to support the motors a little better because of a mod I did, as well bolt on some aluminum end stops on the printed bracket.
This is totally experimental and I’m sure Ryan can come up with something way cooler.

I thought I throw it out there to get some discussion going on end-stops and homing and de-racking.

The DAM article is the first I’ve heard of MachineKit. I’ll have to do some reading.

To do the auto-deracking, you’d need to have independent motor control, right? You’re not just skipping steps on the front motor, right? Seems like a great idea. I keep wanting to experiment with mesh levelling too. Seems like a great way to get extra Z accuracy from a machine without adding a lot of cost.

I’m currently running a low rider with the piCNC grbl board. It has at least one extra motor driver port. The ramps boards have enough for 5 motors, so that’s also an option. I cannibalized my MPCNC to make it. I will have to look into converting it to MachineKit.

W.r.t. fine tuning the locations of the endstops. Couldn’t you fine tune them in software? Similar to how you might with a Z touch plate. Just have a different offset for each end. I would think mounting them as rigidly as possible would keep it lower maintenance. Any adjustability mechanically would reduce that strength, leading to a bump messing up a calibration. Of course a lot more people know how to use a screwdriver than a configuration page…

Yah, I was thinking the same thing think too. I was talking to Charles Steinkuhler the guy who wrote the deracking module and he says no. I think it makes a certain amount of sense that you don’t want software compensation for deracking. If you had software compensation for deracking it would mean that you would need to intentional rack the gantry into order to home it. Still it might be nice be nice to have the ability to software compensate for a tiny tweak, but at this point it can’t do it.

I mean, we’re talking mm’s here. If your machine is that intolerant to racking, then you better have a different strategy. Is it open source? I. Still looking into it.

Yes it’s totally open source. Machinekit is a fork of LinuxCNC.

Short story is LinuxCNC is X86, Machinekit can run on ARM(Beaglebone)… (It gets a little more complicated than that, but LinuxCNC and Machinekit are very similar.

My MPCNC is fairly tolerance of racking, but machinekit can be used in industrial appliations where things need to be dialed in very closely.


I’m been really pleased with how deracking is working with machinekit. I’ve been working on tuning for optimize performance.

One issue that I’m having is that I having to force my crossbeams into alignment to the end-stops. After deracking, the X carriage rapids to a central home position before homing the Y. This happens at max velocity. Because the carriage rail is forced into alignment one of the motors seizes in the rapid motion. I can prevent this skip from happening by slowing things down, but what fun is that?

I think I have a combination of the carriage being out of square and the x-y rails being a parallelogram. As near as I can tell the updated carriage is not that bad and I suspect the problem is the squareness on the rails.

I want to do some precision calibration of my MPCNC for squareness and parallelism. It’s fairly easy to get the parallelism with a couple of identical cut sticks, but squareness is a bit of an issue. I don’t think cross distance check with a tape measure is precise enough.

I have a framing square that’s about the right length, but I’m having interference issues. I’m thinking about printing a couple of spacers to mount on the square as a workaround. Has anyone been down this path already? If so, any links would be appreciated.

If you can’t see a difference on a tape measure it has to be close.

How fast are you rapids? We use very tiny pulleys so we lose power at the higher speeds. These steppers start losing torque rapidly at higher speeds check your spec sheets but pretty sure 60rpms and things get weak fast.

Maybe home both axis before moving to the center, twice. I figure 2 times eliminates any error you might get from the other axis.

Or. How far off is yours? I have to beat mine up to get it to be not square enough. I actually switched test machines to be able to move it out of square enough to test with.

Gantry rail parallelism:
Using a tape measure, one set of gantry rails looks dead nuts and the other set seems to have about a 1/16 of error across the length

Gantry rail orthogonality:
Checking the cross dimension I’m measuring 38.125 X 37.750 (This is to the corner of the pocket for the machine screws)
(Have you ever considered putting an “X” with a hole in the center for a pin so you can measure directly to the intersection points of the rails?)
This seems like a significant error to me, which annoys me that I didn’t catch earlier. I need to get this tuned in a little better.
I’m the type of guy who will use Jo-blocks to set calibrate the height of my 3d printer and this is bothering me.

Currently I have have the Z max velocity set at 92mm/sec
The X and Y gantry drives are set at 150mm/sec
Currently this is with everything dialed down.
Just curious, Where are you at?

I measure the outer edges from the outer flat surfaces, and cross centers from the corner points.

I am not sure what you firmware is capable of, but the ramps @32nd stepping is not capable of that. The 16th stepping rambo’s are. The real problem with speeds like that is the steppers have zero torque. The steppers I have the torque curve dives off steeply at 45 rpm’s and above. So above ~24mm/s things are getting significantly weaker, and are at half power or less by 180mm/s.

High speeds are fine but they require lower accelerations. I use 400m/s/s and would prefer lower but at that point 3D printing and laser uses suffer.


I remember on my first machine, I printed the feet, but cut the STL at 5mm high, and I printed 4 of them, so I could line them up really well with my marking tools, and then I used them as drill guides to drill the hole for the EMT and for the support screws. If you do that again, and are paranoid like me (it sounds like you are) then I would give that a try. I remember it working pretty well.

The out of squareness is only about 1/200. That doesn’t seem like enough racking to bind up the sides. I’m with Ryan, I think you should try slowing down (at least acceleration, but probably also top speed). If you get things working smoothly, then you can always bring it back up, and find a reasonable compromise. Similar to 3D printing, speed is always something we want more of, but it’s also a pretty easy sacrifice for quality or reliability. That might be different for folks like Ryan, who earn a paycheck with their machines, but I personally don’t mine a bit slower if it means I can mess up fewer projects.

I have my acceleration currently set at about 937 mm/s/s[?]

My MPCNC is customized in that, I have no thrust load going on the motor. I had it running at the Milwaukee running continuously for 2 days straight, plotting out a TSP image of my daughters gecko’s. I was handing them out but when things got slow, I was just re-plotting. People where amazed at how well the track replotted. On the downside, since I didn’t have a tensile load on the screws, 2/3 of them vibrated loose. I’m going to see if a couple of lock-washers will take care of the problem.

@Jeffb could you post a picture of what you’re talking about? I can’t visualize it.
As far as speed goes… I really disliked the original 5/16-18 lead screw… The motor would spin-up and I really had to throttle things down to where it was painfully slow. the T8-4 is sooooo much nicer. I really liked the performance increase I got with the T8 and just want to explore how far I can push it.

One of the reasons for the bbb/cramps/machinekit setup is that has a little more ommph than Ramps. Delta user’s like it since it can do a little more complex math faster than a Mega.

I tried correcting the squareness on the X-Y as best I could.
When the system is powered down, the carriage rails see to want to be out of parallel to the gantry by about 1/8" Give or take. I printed this one out on my printer, I noticed that the W88 kit was much truer than mine. I loosened up the main bolt in the carriage that seems to help.

Slightly OT… My lead screw is starting to squeak, would I be better off with with:
A) Silicon Spray
B) While Lithium grease spray
Any preferences?
(I’m more worried about chemically affecting the PLA)

Lock nuts, lock washers don’t work.

I like white lithium.

We seem to think your are missing steps from the high rapid (3x our common speed, causing low torque form the common steppers we use), and your high accel/decel (more than 2x’s ours and from a higher speed), not really from the very minor non-squareness. During a cut your rapid moves probably are not long enough to reach top speed and that means you see no issues. Thrust load is nothing we are worried about in this scenario, just inertia. TinyG has a 4th derivative in the acceleration control so they can get away with slightly higher speed. Your z axis should be capable of the same max speed just Lower accel as it tends to carry a heavier load.

Pretty easy to fine tune this one. Fully equip your machine with the heaviest tool and hoses etc. then just make a test gcode to run the length of your machine back and forth a few times tune your speed and accel until you don’t get any skipped steps and then turn them both down some more for a safety factor. You should probably run a diagonal as well in case there is some sort of power or processing deficiency. Same with the Z axis, place your heavest tool on it, hose wires and all and make a test code that is full throw and then one that is up and down ±10mm decrement by 1mm each time. That is the torture test I use.

Well, next time the z-motor loosens up, lock-tight here we come.

I tried the silicone spray first(since it was the least messsy) and it didn’t seem to do much. (Either in speed or squeakiness)
The white lithium oth… really seems to make a difference.
I got the z-axis up to 100mm/s vs 92

It seems that I was able to get more speed after the alignment for squareness on the X-Y and loosening up the bolt in carriage.
I when from
(In hindsite, I wish I tested one at a time, so I could see what did what)… I currently have it at 200mm/ss vs 150.

I’m not sure if machinekit/Linuxcnc has a 4 derivative jerk parameter or not(I need to look into that one).
I’m uploading a video showing the homing sequence (which is taking forever)
(Next check squareness to the bed… Time to get the Jo-blocks out)

Here is a little video of the homing sequence and deracking using machinekit





Super smooth, the XY accel seems really low. That is how I prefer it, but printing suffer from bulbous corners. Are there any graphs or anything fancy to show the acceleration curves in that software?

I haven’t speed tested the t8 yet, your is impressively scary! The XY seems to max out at 120 on these boards but yours is doing better for sure.

Do you find you need to home twice in a row? I figure with deracking there might be a slight error on the first axis to home after the second homes, but I haven’t tested that either.

There’s all kinds of nooks and crannies of awesomeness that I haven’t explored yet in Machinekit. There’s halscope, a built-in oscilloscope (I haven’t really played with that too much.) There’s a pretty cool graphic display where you can show pin status as a huge buttons. I used that to calibrate the endstops (Not sure about velocity graphs.)

Oh… the t8 is running a bit slow in the video in the video. I had used silicon lube when I tool the video. When I used the lithium grease it got speed up a bit at bit more.

I haven’t pushed the x-y to failure since I squared the gantry. At this point it’s fast enough.

One thing that’s a bit different is that the z-axis bearings are modded. There is an upper and lower bearing to take thrust load off the motor. When I ordered T8 lead screw it came with pillow blocks. I figured what the heck, I might as well put them to use.

Btw… I was pushing my MPCNC for two days straight at these settings. It seems the weak point in the system are the holes mounting the machine screws on the feet on the vertical posts. I found a metal EMT pressure fitting that’s threaded as well as and cast iron flange at Menards that I’m going to replace those with. I’m thinking I can beef that base and get a fine height adjust also.


Sorry, I was AFK, and I sort of forgot about it. You probably don’t need it now, but this is what I printed, to help me with layout.

[attachment file=46178]