Originally shared by Sebastian Szafran I have finally rewired all limit switches with shielded

Originally shared by Sebastian Szafran

I have finally rewired all limit switches with shielded cable and NC configuration and connected to the gShield/ArduinoDue running TinyG2 on Chilipeppr. When I test a motion by manually typing g-code (G91) motors randomly go on Hold in the middle of a movement. Resume from hold (~) completes programmed movement, but for long distances few clicks on ~ are needed.
Another issue is homing, which doesn’t work as expected. Homing any axis move the machine axis back and forth few millimeters and consider axis as homed, but this is in no relation to homing switches. Actually setting machine to a middle table location will home it there.
I tried 0.78, 0.87 and 0.89 firmware, none of them working ok.

Disconnecting switches from the gShield board helps getting rid of Hold issue, but I need limit switches at least for homing.

Does anyone use the gShield and ArduinoDue as TinyG2 and have it properly configured? It seems to me extremely unstable platform.

Hi Sebastian, is there any chance you are introducing interferences with the switches, even though using shielded cabling? Have you tried some small tantal condensators on the gshield end of the cabling? Just my 2 cents what I would try regarding the hold issue…

Have you read this wiki page about digital inputs and how they relate to homing?
https://github.com/synthetos/g2/wiki/Digital-IO-(GPIO)

There are quite a few topics on this on the ShapeOko forum, and you will see my preaching to people, many times, that the lack of some sort of active, current based filtering on the gshield is a huge oversight.

What you are likely dealing with is interference on the lines giving you enough voltage to trip the arduino. The problem is that those stepper motors create high amounts of EMI and cause high voltages on those wires (some have put oscilloscope images on the forum showing 3 volts peak to peak!). So, until you filter that with something that requires current, you will have this issue. Using a harder pull up or down resistor, or using capacitors to take out the AC component, all of that might help, but you will always be afraid of the long job stalling with a limit error. The EMI can transfer voltage, but the current it can push is almost zero. So, you need something like an optoisolator to filter the signal, as that requires enough power to turn on a LED. It also lets you run all your switch side of things off of your 24 power and keep the arduino power side completely separate and clean. In my opinion, any gshield limit switch setup without a current driven noise isolation, is doomed to fail and frustrate a long job.

Frank - thanks for the note. I agree on all your points.

The reason that there is no input conditioning on the Gshield is that there are no inputs on the Gshield. It’s purely a motor driver. We leave the connection of all other inputs to the particular configuration using the Gshield. Doing otherwise would increase the board size and price. Once you go down that path the question is “how much is enough?”. Is a simple RC circuit OK? What about static discharge protection? Opto isolation? What kind of connectors are needed for what applications? On the TinyG boards we do these things, but the gshield is a different story.

I realize this may look like a dodge, but the option is raise the board footprint and price for all applications in order to satisfy some applications. We chose to keep the price low.

As for gshield uses, typically we recommend (1) using NC switches, (2) putting an RC circuit in with a 2.7K to 10K resistor pulled to 3.3v and 0.1 uFarad to ground.

Thanks for all your hard work on these forums (fora?)

i see your point, but to me, the point of a GShield is to add on the hardware needed for an Arduino to interface with the harware components of a CNC machine. In that respect, it is missing what I now feel (after some experience) to be a core component. I think it is fine if you don’t believe a CNC machine needs limit switches or a homing capability. But if you do think those are needed, you are off building circuit boards and filtering circuits and other nonsense that most users are trying to pay to get rid of in the first place. So, I agree that it might, very slightly increase footprint. And I agree that it might, very slightly increase cost. But in the end, I think those are definitely worth it. Optoisolators I’ve found are enough, and give you the added benefit of running all these switches and wires off of a power supply completely separated from the arduino. Since you can buy them in an IC package, you can go ahead and add traces to isolate the feed/hold, resume, etc. buttons as well.

This is just feedback from the point of view of a user who bought a gshield to build a machine, but in the end, after fighting with constant noise issues, was having to work with someone to design our own board, get them printed, populate them, and then install them.

Thanks for the followup. Appreciate hearing your thoughts.

I see your case for a more complete package. At that point I have to ask if putting the entire thing - processor and all - on one board isn’t the best approach. That’s basically what we have done for the TinyG, but being that there are a number of alternatives in the market for grbl we did not do that (like the Azteeg boards). Do you think it’s worth doing that for a Gshield?

I added a stronger pull-up resistors (0.47k) plus an RC filter (1k resistor + 100nF tantal capacitor) for each limit pin on the Arduino Due. No single false positive so far.
I was considering the optoisolators before (thx @Frank_Graffagnino for your suggestion) but hoped to find least effort solution. Anyway as I will have to think about a small PCB in order to get rid of breadboards, adding opto should not be a problem.

From a CNC hobby-user perspective it would be much easier to pay extra for the ‘more sophisticated’ board than fighting with issues on your own. The above with an exception that getting experience is simply invaluable, priceless and time consuming :slight_smile:

I take your points. Please also see the following page. I’m still editing it. There have been some changes in the homing for g2, so I’m trying to get the documentation up to date.
https://github.com/synthetos/g2/wiki/Homing-g2

to answer your question, i do think it is worth doing it on future boards… i just think the boards should be designed from the point of view of “what is the user going to have to do to hook up all of their hardware to this processor, and how can we make that easier?” Motors, of course, but there are limit switches, probes, buttons, e-stops, and various other things they have to think about.