PDA

View Full Version : About homing and switches...



JW1977
13-08-2019, 01:17 PM
Hi!

Not much real experience of running a CNC machine here I’ve just been reading and building the thing for some time now.
So, got some questions about homing.

A. How and when do i set that zeropoint for all axes (home)?

B. There’s an expression “homing on index”. What’s index and how does that work?
I guess “index” gives the signal to the motion controller to home all axes but what is it?

C. I will be running CSMIO IP-M with hybrid servo drivers.
It seems I can use this homing on index function with these drivers, correct?

D. Does a closed loop system need homing switches?
Cant see why but still, i might have missed something.

E. Thinking about hall sensors for limit switches.
Can anybody point something out?

Thanks, JW

AndyUK
13-08-2019, 01:48 PM
*ahem* Wheres your build thread? *stamps foot* We want build threads!

I'll try to answer some things...

A) I'd do it every time I start the machine up. You can either run a homing routine from the software which will use your homing switches, or you can just tell the software "Hey, you're at zero now".

B) My understanding is (and I'm sure someone will correct me if i'm way out) that homing on index just means setting the zero point based on the index (ie reported potentiometer position) of the servo, rather than using an external switch. To understand this, you have to know how the close loop servos work - they have a feedback potentiometer which moves only when the motor actually turns, so if something stops the motor rotating it won't change. This position report is called the index. I realise thats two circular ways of saying the same thing, but hey.

C) ?? I know its on IP-S ?? Surely it will say in the IP-M manual.

D) I don't think it does need them, but they could still be helpful. e.g. when you disconnect your drive motors from the ballscrew, the motor and pot might rotate but the CNC wouldn't move, this would change your index for the home position.

E) I believe hall sensors will require a magnet to be mounted as the sensing object. Take a look at induction switches too.

Kitwn
13-08-2019, 02:01 PM
JW,
Not sure on the 'index' thing but even closed loop servos do not indicate absolute position so you do need homing switches. Whereas stepper motors merely assume each step pulse sent to the driver represents a real movement at the motor, the feedback sensors on servo motors produce pulses confirming that a certain amount of movement really has taken place. For both types of motor your controller must have a known starting position from which to count pulses and calculate current position.
It is possible to have multi-section sensor discs which can tell the absolute rotational position of the motor/disc but that still doesn't tell you where you are along the axis. The only way to do that is to fit a linear optical track (the best ones are apparently made of glass) alongside the rails and sense absolute position from that. A combination of linear track and rotating disc can provide absolute position with high accuracy but not within my pocket-money budget!

Kit
PS Andy beat me to an answer while I was typing. The type of servo motors I'm thinking of have an optical disc attached to provide a train of pulses as the shaft rotates rather than a potentiometer. Counting pulses tells the controller how far the shaft has turned.

JW1977
14-08-2019, 10:18 AM
Yes, the buildthread... I will get to that. :-)

A. When i think about it i begin to wonder if home and zero is the same thing?
I dont really know how to ask without making things complicated but what i would need to understand is the basics.
For example, you make a part in Fusion 360 and you have origo or 0. Will that also be the 0 for the machine or how does it know?
Further more is home for the machine just going to the end of all axes or is home that zero point?

B. It makes sense, Zero would be my indexpoint. It knows where it is and it can return beacuse it counts the steps all the time.

C. The function is there but they are talking servos, not hybrid steppers but it makes sense that it would work.

D. Will do, thanks!

By the way, had a look at your thread and i like your design. Its about the same type as mine.
Really like the "Epoxy project". I have been thinking about that myself in another project.

JW1977
14-08-2019, 10:28 AM
*Kitwn*
I actually thought the accuracy where that good. Ive got a Prusa Mk3 3D printer and if im not mistaken it works that way without switches.
I have to look into this some more but i guess it cant hurt using the switches anyway.
Your machine looks nice on the profile picture there! :thumsup:

Robin Hewitt
14-08-2019, 11:37 AM
Bouncing off home switches is for setups where the material position is known and invariable.

For everything else you set the material then position the tool so it agrees with the G code.

JW1977
14-08-2019, 12:12 PM
Are you meaning that bouncing of home switches is for open loop systems?

Would be happy for a brief explanantion of how you set the tool so it agrees with the G-code, real basic...

cropwell
14-08-2019, 12:47 PM
Are you meaning that bouncing of home switches is for open loop systems?

Would be happy for a brief explanantion of how you set the tool so it agrees with the G-code, real basic...

First of all the Prusa Homes by detecting motor stall current, so it has a reference point for a start.

You need a reference point, otherwise your machine does not know where it is. So Home switches provide that. and set machine 0,0,0. If you have a fixture (jig) for the workpiece, you can then use work offsets to relativise your Gcode to the work. This gives you repeatability.

BUT you don't have to do it that way, especially for one-off machining. You can set x and Y zeroes manually above the workpiece and then touch-off against the material top (manually or with a touch plate and macro!). So your Gcode then operates as is relative to the 0,0,0 you have set on the machine.

Whether your system is open or closed loop is irrelevant, as you still need your start reference.

JW1977
14-08-2019, 12:51 PM
First of all the Prusa Homes by detecting motor stall current, so it has a reference point for a start.

You need a reference point, otherwise your machine does not know where it is. So Home switches provide that. and set machine 0,0,0. If you have a fixture (jig) for the workpiece, you can then use work offsets to relativise your Gcode to the work. This gives you repeatability.

BUT you don't have to do it that way, especially for one-off machining. You can set x and Y zeroes manually above the workpiece and then touch-off against the material top (manually or with a touch plate and macro!). So your Gcode then operates as is relative to the 0,0,0 you have set on the machine.

Whether your system is open or closed loop is irrelevant, as you still need your start reference.

I see, and i begin to get it... Thanks! :thumsup:

Kitwn
16-08-2019, 01:41 PM
*Kitwn*
Your machine looks nice on the profile picture there! :thumsup:
The trick is not to look to closely, the shiny blue paint hides a multitude of sins. The Z axis is still the 18mm plywood mock-up. I really will get round to buying some 160mm wide aluminium bar to build the proper version soon, honest.
Kit

paulus.v
22-08-2019, 09:55 PM
Hi JW,

Let me try to clarify what the homing on index function on a servo motor is.

The incremental encoder on a servo motor generates pulses when the motor moves. The motor driver is capable of counting the pulses and store them on power off but if, for example, you move the motor with the power off or by a power failure where the axis moves from inertia, that axis position is lost. So the absolute position of a cnc machine cannot be determined reliable from the servo incremental encoders data and homing sensors are needed.

Most incremental encoders have an additional "index" signal that provides a reference position of the rotor. It is output at each motor revolution. This signal can be used to increase the accuracy of the homing to an almost perfect and repeatable position. The homing on index routine moves the axis until the home sensor is triggered then rotates the motor to the index position. In this case the sensors accuracy need only to be grater than the axis movement of half a motor revolution. And the sensor be mounted so that when triggers the motor shaft is at about 180 degrees from the index position. Depending on the actual setup, the amount of axis movement per motor revolution, switches could have enough accuracy for homing on index.

Why is homing important?

First of all because if you have homing and set each axis maximum movement, the machine knows its limits! And will never hit a limit switch. If you load a g-code that exceeds the machine working area you get a warning. Otherwise you will only find out that you made a mistake when the axis hits the limit and ruins your work because...

Secondly, if something bad happens and you have to cut power to the machine you loose the workpiece position. If you have accurate homing, the workpiece zero position is referenced to the machine zero (home). If those numbers are stored you can easily resume the work after a power failure or if you want to pause and continue the next morning... just home the machine and go to the stored workpiece coordinates. And continue cutting where you left off.

Paul.

JAZZCNC
24-08-2019, 11:07 PM
Paulus.v Explanation of Homing on an index is spot on, however, I think you'll find that most Closed-loop Hybrid servo encoders don't provide an index Pulse so can't use that feature.

Regards Homing and Zeroing etc then you need to get into the habit of thinking in terms of Machine coordinates and Work coordinates. Home switches define the Absolute ZERO machine coordinate position. This positon NEVER changes and is used to reference WORK coordinate ZERO.
So when you send the machine to HOME your sending it Machine ZERO. From this position, you can also define machine limits.

WORK zero can be anywhere inside the work envelope of the machine. You'll often see reference to WORK offsets, these are just areas inside of the machine work area which can have separate WORK zero positions.
This means you can assign each area to a Fixture G-code ie: G54 G55 G56 etc and use these codes in your cutting G-code file so it moves to the next fixture and starts cutting from new Zero point.
This is useful for instance when have several different parts or materials setups on the bed. For instance could have G54 reference to point on the Bed while G55 references to corner of a Vice and so on.
Each would have there own Zero WORK coordinate and all are referenced from the MACHINE Zero.(HOME). From MACHINE ZERO any location inside any Fixture Offset can be located accurately.

routercnc
24-08-2019, 11:56 PM
Picking up on question E) in post one - you could use a Hall effect sensor but they need a magnet 🧲 on the moving part and are likely to attract steel chips and filings and become unreliable. Proximity sensors detect steel or aluminium so are a better option. Your other options include cheap small micro switches or chunky industrial ones.
Ideally have the detected object on the axis run past parallel to the face not up to it so a fault means the axis crashes into the hard end stop not the sensor.
Oh and welcome back Jazz 🍻!

JW1977
02-09-2019, 12:18 PM
Thanks!

Proximity sensors seem like the option i will choose.
Is there anything special i need to now about using them?
As i understand i will use 6 of them and one of each axis will double as home switch right?

Robin Hewitt
02-09-2019, 03:46 PM
If you are cutting steel do not use one requiring a magnet.

The detector detects a passing object so it cannot be crushed if it fails.

routercnc
02-09-2019, 09:31 PM
In terms of proximity sensors :
I would go for the 4mm distance sensing type

Prox sensors are more sensitive on steel targets compared to aluminium

They run on something like 12V -30V, typically 24V. When triggered they output this same level so they can’t go straight into a 5V BoB ( is my experience) without doing something to the signal. If your BoB can take this higher voltage then no problem.

cropwell
02-09-2019, 10:32 PM
Have a look at this thread

http://www.mycncuk.com/threads/10262-Wiring-24v-NPN-Proximity-Switch-to-5v-BOB-Why-does-nt-it-work


You can regard the LJ12A3-4-Z/BX as a normally open relay, where the output is switched to GND when activated. The fact that you supply 12-36V to the electronics of the induction sensor is a red herring. The unswitched output virtually floats and usually pull-up resistors in the BOB strap it to 5v. Meter your BOB input and you should find 5v. If you don't, then you have either buggered the BOB with mis-wiring or the BOB needs a 5v external pull-up resistor. I'll just clarify that last phrase - a resistor to pull the BOB input to 5v, I use a 10K if necessary.

paulus.v
03-09-2019, 06:49 AM
Thanks!

Proximity sensors seem like the option i will choose.
Is there anything special i need to now about using them?


You have mentioned that you will be using the CSMIO IP-M controller. This controller is using the industry standard 24V inputs and you can use either PNP or NPN sensors, the 10-30V type.



As i understand i will use 6 of them and one of each axis will double as home switch right?

If you put the sensor on the moving part and have two metal triggers on each end of the axis you will actually need only 3 sensors, one for each axis. And yes, the sensors can be used as both home and limits.
For security reasons it is advisable to also have limit switches that will cut power to the machine before reaching the end of axis travel.

JW1977
03-09-2019, 09:39 AM
You have mentioned that you will be using the CSMIO IP-M controller. This controller is using the industry standard 24V inputs and you can use either PNP or NPN sensors, the 10-30V type.



If you put the sensor on the moving part and have two metal triggers on each end of the axis you will actually need only 3 sensors, one for each axis. And yes, the sensors can be used as both home and limits.
For security reasons it is advisable to also have limit switches that will cut power to the machine before reaching the end of axis travel.
Yes, i got the IP-M controller. :thumsup:
Are you saying that i can use one sensor /axis that doubles as limit switch and homing switch or do i need one homing sensor + one limit switch /axis?
Btw im using a driver by the name 2HSS86H.

JW1977
03-09-2019, 09:42 AM
Paulus.v Explanation of Homing on an index is spot on, however, I think you'll find that most Closed-loop Hybrid servo encoders don't provide an index Pulse so can't use that feature.

Regards Homing and Zeroing etc then you need to get into the habit of thinking in terms of Machine coordinates and Work coordinates. Home switches define the Absolute ZERO machine coordinate position. This positon NEVER changes and is used to reference WORK coordinate ZERO.
So when you send the machine to HOME your sending it Machine ZERO. From this position, you can also define machine limits.


WORK zero can be anywhere inside the work envelope of the machine. You'll often see reference to WORK offsets, these are just areas inside of the machine work area which can have separate WORK zero positions.
This means you can assign each area to a Fixture G-code ie: G54 G55 G56 etc and use these codes in your cutting G-code file so it moves to the next fixture and starts cutting from new Zero point.
This is useful for instance when have several different parts or materials setups on the bed. For instance could have G54 reference to point on the Bed while G55 references to corner of a Vice and so on.
Each would have there own Zero WORK coordinate and all are referenced from the MACHINE Zero.(HOME). From MACHINE ZERO any location inside any Fixture Offset can be located accurately.
Good explanation, thanks! :thumsup:

Neale
03-09-2019, 11:34 AM
Yes, i got the IP-M controller. :thumsup:
Are you saying that i can use one sensor /axis that doubles as limit switch and homing switch or do i need one homing sensor + one limit switch /axis?
Btw im using a driver by the name 2HSS86H.

You can use one sensor on the moving part and two targets, one at each end. In normal operation, this acts as the limit switch but during homing, Mach3 and the IP-M know that it is being used for homing and it does not act as a limit switch. As soon as the homing operation is complete, the switch becomes a limit switch again.

I use Mach3 and IP-M. I use a proximity switch at each end (so two swtiches on X, two on Y, and one on Z as it is difficult to use a limit switch for the bottom of Z travel). It is easy to wire the switches on one axis in series so that upper and lower limit switches are connected to one IP-M input. This means that you can home X and Y at the same time. My machine is configured to home Z first (to get the spindle to the highest point to clear anything on the machine), then X and Y together. This saves a little bit of time on a bigger machine and works well.

If you just use one sensor per axis with a target at each end, then you can still wire each sensor to a separate IP-M input channel, obviously, and get the advantage of homing two axes at the same time.

I had one small problem with my Z axis homing. As I said, my machine first homes Z, then the other two axes. However, these proximity switches sometimes have their on and off trigger points very close together. What this meant was that when my Z axis was homed, the switch was so close to the target that a tiny amount of vibration could cause the switch to trigger accidentally and this often happened while X and Y were moving. The answer is to configure Mach3 so that the home position is very slightly offset from the actual switching position - I use about 1mm. This avoids accidental triggering.

JW1977
03-09-2019, 12:16 PM
Ok i see, thanks... It would be interesting to see how you put the switch on Z, do you have any pics that you would like to share?
To use one sensor and two targets... Arent the sensor pointing towards one of them, how can you make it work in two directions?
Would you recommend using one or two per axis? Obviously you choose two, but why?

routercnc
03-09-2019, 08:18 PM
To use one sensor and two targets... Arent the sensor pointing towards one of them, how can you make it work in two directions?

Imagine the sensor is mounted to the gantry and pointing down. It moves sideways over the target, not directly towards it. At some point when it is directly overhead it will trigger and stop the axis. If there is a fault it will just glide on past without damage until the gantry hits the hard stop further along.
When it is moving the other way, again it is looking down and will eventually glide over the target at the other end which will trigger the axis to stop. So one sensor, two targets.

It has been shown to be just as effective using a parallel approach as a direct approach. As long the target gets within 4mm (or whatever the rating is) it will trigger no matter how it got there.

routercnc
03-09-2019, 09:35 PM
As you are using CSMIO, as Paulus mentioned, this will take the prox sensor 24V directly. It has taken me a while to find my original drawing but for anyone with a cheap 5V BoB this is what I had to do to get it work. Without the diodes it was very unreliable at triggering. With the diodes it is 100%. Maybe these should be fast acting types, but mine were regular types and the homing is very repeatable. Sorry for the side track on the OP.

26395

JW1977
04-09-2019, 09:01 AM
Imagine the sensor is mounted to the gantry and pointing down. It moves sideways over the target, not directly towards it. At some point when it is directly overhead it will trigger and stop the axis. If there is a fault it will just glide on past without damage until the gantry hits the hard stop further along.
When it is moving the other way, again it is looking down and will eventually glide over the target at the other end which will trigger the axis to stop. So one sensor, two targets.

It has been shown to be just as effective using a parallel approach as a direct approach. As long the target gets within 4mm (or whatever the rating is) it will trigger no matter how it got there.

Offcourse, thats how its done, thanks! :biggrin:
Well then i have a pretty good idea how to do this for X and for Y.
Im not really sure about Z yet. How do you put the "down" limit for the Z axis?

routercnc
04-09-2019, 12:41 PM
Offcourse, thats how its done, thanks! :biggrin:
Well then i have a pretty good idea how to do this for X and for Y.
Im not really sure about Z yet. How do you put the "down" limit for the Z axis?

Lots of people don’t have one since the height of the workpiece and stick out of the tool are variable so there is no obvious place to put it unless you set it up in a variable position to suit each job

AndyUK
04-09-2019, 01:27 PM
Lots of people don’t have one since the height of the workpiece and stick out of the tool are variable so there is no obvious place to put it unless you set it up in a variable position to suit each job

I'm planning on putting mine so that the ballnut doesn't impact the BK/BF mount, and so that the carriages don't fall off the linear rails.

john swift
04-09-2019, 03:22 PM
As usual
the devil is going to be in the detail
when looking for the solution to problems connecting limit switches to breakout boards
for instance the LJ12A3_4_Z_BX proximity switch does not have the simple open collector NPN transistor output you may expect going by some adverts and data sheets
It has a hidden 10K pull up resistor connecting the output to the positive supply !26401


with ref to the diagram in post 24
26400
adding the diodes works with the usual TTL inputs found on most BOB's
that requires the switch to either ground the input or go open circuit

some Chinese BOB's have opto isolated inputs with a PC817 input LED and current limiting resistor connected to +10V

the Geckodrive G540 has its opto isolator connected to +12V and has a 2K2 current limiting resistor
26398

so you don't always see 5V across the BOB's open circuit input and ground terminals !

BOB's like CNC4PC's C31 need a positive 24V input
so if you are using proximity switches you need one with a PNP output
to pull the BOB's input up to the positive supply

many Chinese BOB inputs connect to either a 74HC14 or 72HC245 logic
IC input
(see the upper left hand corner and centre of this diagram for the Chinese BOB input
Lower left hand corner for the C31 )

26403

( I prefer N/C switches because a broken wire will be trip the axis limit
with N/O switches a broken wire will not be detected )


John

Clive S
04-09-2019, 04:41 PM
Well written John 👍

cropwell
04-09-2019, 05:39 PM
As per reply #17 to this thread:

John, this topic was discussed (with the internal circuit you reprint) in 2016, till I got sick of it. The LJ12A3etc is designed for industrial 24v control sensing, but it works equally well switching amateur 5v (without diodes) if your BoB pulls the pin to logic 1 at 5v. The supply voltage to the device electronics has to be min 10v max 36, it will work below 10v, but not reliably, presumably because the oscillator duzzn't buzz. It has an internal 10k, but even so, the thing operates for practical purposes, just as if it is a NO relay on the blue and black wires. I happily use them with a 12v supply with the black wire connected directly to the BoB input.

Peace and Love

Rob-T

JW1977
05-09-2019, 08:07 AM
So, anybody got a good source for proximity sensors?
As i have understood, im in the market for the inductive kind. 4 mm sensing distance would do it and NPN/PNP should not matter with the Csmio IP-M. Emergency switch, some resistors and a main switch is also on the shopping list right now...

john swift
05-09-2019, 04:36 PM
it depends on the budget your working to

if its a hobby machine then try amazon or ebay etc
buy 1 to check the quality then order the others you need

for a business machine you use to make a living
look at industrial suppliers like RS Components , Farnell or Rapidonline
for original proximity sensors not the cheep clones found else ware online

you will pay more but they will be to the published specification
example
https://uk.farnell.com/multicomp/mcpip-t18l-001/sensor-m18-pnp-shielded-no/dp/2218044?st=n/c%20proximity%20sensor

John

PS
after looking at your location

https://se.farnell.com/

https://se.farnell.com/multicomp/mcpip-t18l-001/sensor-m18-pnp-shielded-no/dp/2218044?ost=MCPIP-T18L-001+-++Inductive+Proximity+Sensor%2C+Long+Housing%2C+M1 8%2C+4+mm%2C+PNP%2C+10+V+to+30+V%2C+Pre-wired&krypto=M3bxbfX6ffGuOVA13WJwU0HkFdW7Eaz5RMqh76Nj7Lz 7NE4%2FYtlIIXsX1tcqjO50RlcA9PW4Q%2BF9MtekoULJ5Q%3D %3D&ddkey=https%3Ase-SE%2FElement14_Sweden%2Fsearch

JAZZCNC
05-09-2019, 05:17 PM
Don't waste money buying the expensive switches Just buy the cheap Chinese switches off ebay.

I've fitted 100's and probably had about 3 in total that was faulty out of the bag. I've had about 5 fail in use over a 10yr+ period all on different machines.
The accuracy is more than good enough for any Router or DIY Milling machine.

The IP/M doesn't care which you use but I always fit NPN switches.

JAZZCNC
05-09-2019, 05:19 PM
So, anybody got a good source for proximity sensors?
As i have understood, im in the market for the inductive kind. 4 mm sensing distance would do it and NPN/PNP should not matter with the Csmio IP-M. Emergency switch, some resistors and a main switch is also on the shopping list right now...

Why the resistors.? You don't need any for the IP/M

routercnc
05-09-2019, 07:54 PM
Maybe you got confused with all the chatter of 10k internal resistors, pull-up resistors and so on. You paid good money for a quality controller and therefore the prox sensors just plug straight in !

I think I used resistors on the 12V front panel LEDs to run off 24V but that depends on how, or if , you want indicator lights for status and so on. For example they can also be mains powered indicator lights.

JW1977
06-09-2019, 07:32 AM
Sorry guys, fuses, not resistors! Theres a lot on my mind right now... :beaten:
However, havent got to it yet, collecting the final parts right now but, i read about one resistor in the driver manual.

Remark:
VCC is compatible with 5V or 24V;
R(3~5K) must be connected to control signal terminal.

If im not mistaken i think i read about it in in the Csmio manual also but they recommend a 2K resistor there!?

Neale
09-09-2019, 09:39 AM
Couple of odd comments:

IP/M is very happy with direct connection of prox switches running on 24V. Works well.

IP/M drives the usual stepper drivers directly without needing any resistors. Use differential connection if your drivers support this - better noise resistance.

Unlike Jazz, I've not been too lucky with prox switches from eBay. I bought a box of ten. One was the wrong type (unbelievable! Two-wire, quite obviously not the same as the rest of the 3-wire switches), one was faulty straight from the box, and one failed very shortly after fitting. However, the rest have been working fine for a couple of years now, and the whole box probably cost less than one "professional" quality switch. That's the difference between home building and commercial - commercial machine could not stand that level of quality, but it suits my pocket!

cropwell
09-09-2019, 12:45 PM
I too bought a box of 10 from China.

The machine I have from MD had end-on axial sensing and I crushed a sensor whilst jogging (the machine, not me!), In my naivety I ordered a replacement from MD and it cost £17.50 (ouch, ouch,ouch). When I crushed that one, I ordered 10 from China and converted the sensing to bypass.Some have orange sensor ends and a grey cable and some have blue ends and a black cable. I have 9 of them left. They are all NO and 4mm.

Cheers,

Rob-T

Clive S
09-09-2019, 03:34 PM
I also have had about 30 from AliExpress with no duds with pnp and npn types.

hanermo2
09-09-2019, 09:16 PM
My chicom mechanical switches are quite reliable, omron copies.

They are not too accurate, and the mechanical assys are terrible, in terms of machinist parts.
0.01-02 mm +/- in repeatability/accuracy is terrible.
For my cnc lathe, industrial quality.

But for routers, they are much more than good enough.

(My lathe is for sub-micron or 1 micron repeatability.)

Cheap 5$ optical limit switches provide about 2 microns accuracy, fairly easily.