cnc Centering

john coloccia

AzB Silver Member
Silver Member
yep, your one of those lucky guys who's background gives you a true understanding of this technical stuff.

I wish i was just ok with the fact that i know how to hook up the switches and make it repeatable beyond my actual needs but i'm not. For some stupid reason i desire to understand why.

So in laymans terms.....Hysterisis in this case makes the switch more potent per se? Effectively allowing it to consistently and more quickly sense the object and also transmit the signal? After all, where mach is concerned its only looking for a signal and latency can be the only variable?

As far as your jogging routine.....i guess i totally agree but man does that sound like a pain in the ass. So to sum it up, your going slow (jogging / slow rapid) into the switch to defeat any high speed deceleration or inertia thats present when switch is triggered? Since the axis can't actually come to a complete stop when signaled? But theoretically if your routine was to home the machine at 100 ipm, and all things mechanical were pretty solid (without slop) then wouldnt it consistently overshoot? I guess the only bad thing that could happen would be to have a stepper miss steps if it were coming to a complete stop similar to hitting a limit switch?

Ah...I should have defined hysteresis. As it applies to proximity sensors, it basically means that the thing responds differently when you're moving towards it than when moving away from it. So for example, when the axis moves towards our hypothetical sensor, it will trigger when we're 20mm away (just picking random numbers here). If the sensor had NO hysteresis, if you moved away just a tiny little bit, the sensor would shut right off. Because it has hysteresis, when the sensor is activated and you start moving away, you actually need to move away to perhaps 25mm until it actually shuts off. There's a built-in step off if you do the homing as I suggest. It's somewhat similar to backlash in a mechanical system, though that's more appropriately called "deadband" and there's a subtle difference. For our purposes, though, it's not a terrible analogy.

Since flags may or may not have any hysteresis (or significant hysteresis anyhow) you need to find a consistent position, step off and then set that as your 0 or (0,0) may or may not work.

With the proximity sensor, the hysteresis usually automatically guarantees that (0,0) is usable because there's usually a significant amount of hysteresis. In our example, we're homed at 25mm, but the sensor won't trip ON for another 5mm. Anecdotally, it may also be just a little more accurate going off than going on, but I'm not 100% sure of that of the top of my head.

re: consistent overshoot
It may or may not. I suspect it won't be very consistent because the axis are going to have different friction day to day depending on lubrication, dirt etc and maybe even significantly different weights depending what happens to be mounted. You'd never want to depend on something coasting to a stop, anyhow.

But you're also trying to eliminate any latency from the system. It takes time to trip a sensor, the controller to notice and actually do something, especially if you're dealing with something like Mach3. With my method, you can go as slow as you need to find the exact home position, even one step at a time, but the entire home routine is still fast and painless.

re: pullup/pulldown resistors
Don't let those scare you off. The only reason they're there is that in some electrical circuits, when the thing isn't outputing anything the output is not being driven and everything's just floating at some random value. Even worse, it's now susceptible to EMI noise from things like electronics, motors, etc....basically all the stuff in the machine!

You need to put it in a known state, so you tie it to something like GND, or +12 or something like that...essentially, you're tying it to the OFF value. You do that through a resistor that's small enough to actually pull it where it needs to be and drain off any noise, but large enough that when it turns on the output doesn't see a significant load or draw excess current. It's usually something from 1k to 10k depending on the system. There's a rule of thumb to calculate the appropriate value based on what the input is but usually there will usually be a recommendation somewhere...or you can just ask someone.

The terminology is confusing too if you don't know it, but it's actually pretty simple. If you're tying the line to a lower voltage (usually right to ground), then it's called a pulldown...i.e. you're yanking it down to ground potential. If you're tying it to a higher voltage, usually whatever the logic voltage is (+5, +12...something like that), then it's a pullup, because you're yanking it up to a higher level.

If the output you're looking at drives current when you turn it on, then you need a pullDOWN resistor. So you yank it down to ground, and when it turns on it will drive it up to whatever....+5, +12....however it's set and often dependent on what you're feeding in.

If the output you're looking at "sinks" current (i.e. when it turns it on it's expecting to see some nominal voltage on the line that it can then suck down), you use a pullUP resistor to bring the line up to the appropriate level....again, usually something like +5V.

Sensors sometimes have a weak (i.e. high resistance) pullup/pulldown resistors built it...sometimes not. Honestly, it's better if not because it's more flexible. I think I had to add some to my breakout board somewhere, but I don't remember anymore. It's been years. Definitely shouldn't scare you off, though.

Hope that helps a little.
 
Last edited:
Top