If you disable hard limits homing still works and sets your machine 0. Then if you have soft limits set it will limit the travel after homing. I find this to work best.
Hi.
I've encounter the same problems and in my case using opto-coupler worked 50/50.
Even with optocoupler I have some noise issue caused from one of vacuum cleaners that I was using.(take me one day to find it out). I made also ground-lines from every metal/aluminium part and additional grounding inside of vaccum end to disscharge electrostatic field of vacum pipe. In the end I found out that vacuum engine itself have phase short to ground.
Look carfouly if everthing around Your machine have proper grounding.
The best solution is exeactly like Peater says, using endstops for homing, so You can always set the same zero point (in case of error or brake during cut) and Use softlimits to stop machine according to axis lenghts.
Ps. When You connect two endstops on one axis(to one input) You must connec them in series - use NC contacts, or parallel - use NO contact. You must also set $5 like Peter says accordinf to Your choise.
This article will help You understand it better:
https://github.com/gnea/grbl/wiki/Wiring-Limit-Switches
You have two schematics showing "ok" and "best" option. If all Your equipment is ok and dont have any electrical-matter related problems - "OK" option will work 100%
Greetings!
Khinyo, Peter and Krispi1234 - many thanks for taking the time to respond - I really appreciate your input!
Khinyo - under normal circumstances I would totally agree with your suggestion of solving the root cause, but after spending 3 full days on this issue and not making any progress I am grasping at any straws!
Peter - hopefully your suggestion will work, but I need to have operational switches to get to that stage and at the moment that is not the case.
Krispi1234 - I have now tried an opto-coupler without any success - I have found that if I plug in a short piece of wire into one of the endstop connectors that that the arduino sees this as a end stop trip. If I then clear the issue simply touching the shielding of the wire triggers a hard limit trip.
If I turn off the power to the stepper drivers this issue no longer happens so I guess that the power supply or stepper drivers is causing the issue, but I am not sure how I now cure it.
Stupid question, but should the Arduino be connected to earth?
Any more views gratefully appreciated _ am losing the will!
Ok so now we are starting to get to some more advanced modifications, are you running the swtiches NO or NC? If you are using NC, and if you have 2 limits stiches on an axis for squaring they need to be wired in series then you can add 10k pull up resistor to hold the signal high, If you are using NO then the 2 switches for squaring need to be wired in parallel and would use a 10k pull down resistor. This will help mitigate the noise that is giving false limit switch triggers.
Here's how I had the Optocouplers wired before I just redid my system
Peter have 100% right with pull-up and pull-down resistors, but I think that You should get system working eaven without them when You use opto-coupler.
Can You please show Us photo of:
*Optocupler, *Endstop that You using, * connections between optocoupler and CNC shield, *Power supply (type and connection terminals)
If You dont want to share a photo, another question: Is Your power supply have ground connection terminal, and do You connected it to ground?
Next question: Do You have proper ground loop in electric instalation in place where You have CNC? In my work I often see sockets with not connected ground pins(worth to check).
Thing that You says about touching cable shield with bare finger and trigering false stop is 100% some ground/short-circuit issue, there is also possibility that Yours Power-Supplay is fault.
We need more data to help You out.!
Hi Peter and Krispi1234 - many thanks for your responses.
Peter - thank you for your suggestions and for the wiring diagram. I will go to my local electronics shop on Monday when it opens and purchase some resistors. the Opto-isolator I purchased has a different layout to yours and I must admit I am a bit puzzled as to how to connect it - I have added a picture below.
Krispi1234 - I have checked the ground in my garage with a circuit tester and it passed the test, I have also checked the continuity of earth between the earth pin in the plug and the power supply and chassis and all where OK.
I have added some picture of my control system below - I have not included any pictures of the limit switches as the problem occurs even without connecting them - just by adding a wire to the limit switch input pins.
Its hard to see in the photos, but it looks like you may have your mains voltage a/c wires bundled with your signal wires. If that is the case that's one place to start. Keep your mains a/c supply a min of 10cm from signal wires this will help reduce false signals. Have you checked the status of the limit switches
Here's a small tutorial
https://discuss.inventables.com/t/guide-using-grbl-to-debug-your-homing-switches/16588
I have purposely kept the mains and power cables away from the signal cables wherever possible - power runs down the side of the case and most of the signal runs down the conduit in the middle of the case.
I am beginning to think that either or both the shield/Arduino may be faulty - the z pins now seem to be totally unresponsive to switch actuation but still through up a trigger if I touch the cable with mains on to the power supply.
Also if I measure the voltages across the pins for the limit switches the Y axis shows about 5v, the X axis about 2.5v and the Z about 1.5v.
While I await and views on this I will have a look at the link that Peter sent = thank you.
Send $10=16 what does it report back