GRBL limit switch alarm problem

That board looks like a good solution.

The pins in the white headers (the blue circle in your photo) are the signal pins on the shield. All the pins in the black headers along that side are ground connections. You can verify that the black pins are all the same electrically with a continuity tester or multimeter on the Ohms setting.

Don’t forget that, with the latest grbl versions, SpnEN is really the Z endstop connection on the shield.

1 Like

Question

X+ Y+ Z+ that mean max of X, Y, Z, right?

Set homing will work with X and Y limit switches series or Parellel?

Do homing need limit switches connection straight to CNC shield without connection each other in paraellel or series?

Yes, the + means max for that axis.

The series/parallel question only matters if you want both min and max switches on an axis. Remember that the multiple X and Y pins on the shield are already in parallel.

Series for multiple Normally Closed switches on a single axis using the single connection on the isolation board you’ve built.
Parallel for multiple Normally Open switches on a single axis using parallel runs of wires between the switches and the isolation board you’ve built…

Personally, I do one switch per axis and use soft limits to protect the other end.

1 Like

I build GRBL buffer and it is work well with MPCNC and no more random alarm and now it is protect from EMI, Im very happy with it.

I want to know why soft limit is error alarm when I click button to move X Y?

Grbl refuses to start any move that will exceed the soft limit. It doesn’t stop a current move when the machine gets close to the limit, it prevents the machine from starting a move that it predicts will cross the limit.Have you set your travel distances with $130, $131, $132? You need to tell grbl how far it can go before soft limits can be effective.

To figure out the values to enter. I disable soft limits ($20=0), then home the machine and use my control program to move each axis to the point where it was close, but not actually hitting something at the far end, or in the case of Z the bottom. I rounded that down to the nearest .5 mm, added .1 mm and set that as the travel limit for that axis. That way, I can get to the point I expect, but grbl will prevent me from going further.

Once all the max travel distances are set, re-enable soft limits ($20=1), home the machine, and see that you can get everywhere you want to within the machine’s movement envelope.

A post was split to a new topic: Grbl endstop noise

This circuit is great

limit_switch_without_capacitor

but I would like to put 0.1 uF capacitor in it. Where should I put it?

I have several suggested options, but I can’t post them as new users can only embed one picture in post.
Should capacitor go on the left or on the right side of opto? Or Maybe on both sides? Why not on both sides?

This circuit with opto will be next to arduino - on the same pcb. Relative long wires will go to swtich.

I’m not running the opto-isolated circuit, just switches right to the pins on my CNC sheild. On my setup, I had to add capacitors between signal and ground to reject noise on my switch lines. I just pushed them into the connectors at the shield. I probably ought to do something more permanent but I haven’t had any problems so far.

Yes, I saw your option in one of the first posts. But if I’m making my on pcb why not do it as good as it can be.

I put all my options on one picture. ttraband, your option is now option 4. Maybe I have to go with option 3 and 4?
At the beginning I draw option 3. But then I started thinking capacitor should go on the left side of opto. But I didn’t know where. And option 1 and 2 arose. But now I don’t know why those two options seemed like a good idea. It’s obvious I don’t have enough theoretical knowledge. Now I think 3 and 4 combined is the best option and way to go? What do you think?


(deleted former post as picture was not accurate)

Sorry - no way I’m going to weigh in on circuit design as I have no training or aptitude in that arena. I’m just reporting what worked for me in my specific circumstance.

Bart shared some schematics for Cnc related io circuits, including an opto input as well.

Note the boards are designed for the 6pack, but the schematics are generally applicable to Cnc. All of the components are available through hole or smd, which makes them nice for diy.

I personally went without opto, but I did use filtering and a Schmitt trigger. Opto is nicer if you deal with a lot of static or other esd issues. The filtering and Schmitt trigger are a good addition to opto or non… they will stop noise issues most of the time.

I’m afraid I really don’t see the point in utilising an opto isolator to combat a noise issue. If you have sufficient noise signal to trigger a p-n junction on the input of a uP then you have sufficient noise signal to trigger a p-n junction of an opto-isolator. An opto-isolator is good at preventing excessive signals from reaching and destroying an otherwise unprotected uP input pin…and that is all. Add your 0.1uF decoupling caps everywhere you can by all means, fit noise chokes on your sensor wiring, use shielded cables to protect long cable runs from EMI if needed., and route noisy power cables away from data cables.

1 Like

Thanks for replies. I will look at your project Kev. With my limited knowledge I agree with you Mike - garbage in garbage out. But on grbl official github page https://github.com/gnea/grbl/wiki/Wiring-Limit-Switches they have a schema with opto. Therefore I believe it makes sense to have them. Then they also have a separate picture with capacitor and on the bottom of the page they have explanation why it’s good to have them. But there is no schema with opto and capactitor together. I wan’t to make such schema, but don’t know where to put capacitor(s).

I’m in the process of building cnc. Therefore no real experience if noise is (will be) a problem. But I see a lot of posts regarding this issue and I want to do everything to eliminate this at the begging. I will make may own pcb (just because it’s fun) and putting some additional parts now is no problem. Better now then later.
I came across shielded cables but not really investigated. Yet. But I imagine they can be quite expensive. My goal is to separate power cables and signal cables. Maybe twist signal cables. And then I will see further.

Thanks again for replies.

Most MPCNCs running Marlin wired the endstops as NC. We also ignore them unless we are homing (the machine can’t really hurt itself). I can tell you, noise is rarely an issue on endstops. I would be careful overbuilding it until you see a problem.

I agree with Mike that opto isolators have a good use, but it isn’t in reducing noise. In my experience, the benefit is that if you shorted your endstop wire to something like a motor coil, the opto isolator would save your electronics. But 1. These electronics are generally cheap and 2. That kind of short would be pretty rare.

I would suggest just building it straight and if you have trouble with noise, then add a capacitor or a smaller pullup resistor.

As far as limit switches are concerned the best solution by far is just to make them normally closed. That way the signal line is grounded and therefore impervious to emf and electrical noise until the switch is operated by the carriage arriving at its home position when the switch opens. any noise at that point is pretty much irrelevent as the uP has already ‘got the message’. as for EMF and noise generated by (for example) an electrically noisy spindle you are going to have to either remove the ‘noise’ at its source or protect all nearby wiring and electronics from inducing that noise. the first option relies upon you knowing the frequency of the noise so you can design a filter tuned to that specific frequency to ‘notch’ it to ground. This is not a trivial subject! The alternative is to make all the nearby wiring impervious to the noise by shielding it using screened cable and hoping it is sufficient to get the job done. Nowhere in this is there any use for an optical isolator.
If you are designing a PCB and want to incorporate some provision for decoupling capacitors I would suggest you allow for an electrolytic cap around 10uF and a disc ceramic around 0.1uF between the data line and ground but the exact values that perform the best will only be obtained by trial and error unless you have an electronics lab to hand. They also need to be as close to the pins they are meant to be shielding as possible, ideally they should be soldered to the actual IC’s pins and the grounded side should be via a ground plane for minimum resistance to the ground as possible.

Ferrite beads and the like are another ‘black art’ that you need an electronics lab to calculate but you will do no harm just adding one ‘off the shelf’ to your power lines in this application. Pass both positive and negative power supply leads through the bead and tywrap the bead as close to the control board as possible.

The optos used in the diagram @tmz tmz lists are, IMHO, for overvoltage protection only and will do nothing for noise suppression.
Optos are also good to convert the switched ground PWM signal output on your controller board to a proper positive PWM to be fed into your laser module…but that is another story!

You can get 4 core shielded cables for your stepper motor wiring just about everywhere, just connect all your stepper motor wiring shielding braid together to a single ground point at the controller board only to protect the wiring from induced noise.

By far the best ‘fix’ is to stop the noise at source…buy a decent spindle and a decent UPS/mains conditioner!..and then you discover it is your fridge causing the problem… :slight_smile:

/2p

Uff. Thanks @dart1280. That’s excellent writing. I have and will read this post several times.
I have plan to run limit switches in NC mode. I also read that it’s good to run them on higher voltage than arduino is running. That’s also why opto comes in the game. Thanks again.

@jeffeb3 you are right. Maybe I’m really overbuilding it.

Are you planning to add a Schmitt trigger? I can’t say enough about how good those things are at killing false signals. Filters can only be so big, beyond which they can start to add latency to the signal. A Schmitt trigger adds hysteresis to the signal, which makes much smaller/faster filters workable.

Schmitt adds to the bom, but it would actually help with noise vs the opto stuff. Opto here is mainly for esd and shorts.

Hi…I altered my grbl source code to take out the homing lock and furthermore make a homing cycle with just X and Y pivot limit switches. At the point when I run my homing cycle I am having two issues:

In the first place, on the off chance that I hit any of the breaking point switches, it thinks it has homed both pivot. I’m thinking this is a wiring issue yet I don’t know. I have two x hub limit switches wired to the D9 pin in equal and the equivalent for the Y hub however wired to stick D10. My contemplations are that perhaps my utilization of the draw up resistor is getting this going. I have both X and Y pivot connected to the VCC through a resistor. Could the way that they are wired together like that be causing this setting off of all switches when one switch hits? Assuming this is the case do you know the right way I can wire that?

My subsequent issue is that after the homing cycle, my grbl is as yet frozen. In the event that I attempt and make a development, the board sends one heartbeat and afterward goes into the endless holding up circle once more. I don’t know what else I can change in the grbl to stop this freezing.

I’m thinking this is an issue with electrical commotion as when I turn off my cutoff switches my framework turns out great, any ideas on the best way to dispose of this electrical clamor to prevent my breaking point changes from setting off?

The control board has no way to know how many switches are attached, it it only knows whether it is receiving a signal on a pin or not. 90% of the time, in order for grbl to be able to tell the switches apart, they need to be wired to different pins. It is possible to re-use a single pin but it requires careful management of the sequencing of events in the homing cycle.

What are your $$ settings? They control a lot of the homing behavior.

good idea, you see that done a lot in the old tube type tv’s when they don’t want to get to the onboard solder area.