GRBL freezes when I turn on Hard Switches

Hi!
I have a problem with my GRBL driven Arduino Uno and the three TB6600 drivers, I use.
I attached the connection with to this post.

So, when I used it only with the drivers, no limit switches, and no finished enable pin, it worked like charm, altough with v0.9j grbl, it froze pretty often, but that almost ceased when I updated to grbl v1.1f.
When I tried to complete the enable pin with connecting all the enable (-ENA//-EN//) sockets to the Arduino's (D)8 pin, it didn't even boot up completely, it just froze.
So I reverted back to not having an enable pin connected, like it is on the picture.

The problem
Today I installed limit switches across the whole CNC router, the switches worked, for sure, I tested them with a multiemeter after the whole process on the end that goes to the Arduino board. (I tried all combinations of connecting them serial or parallel and reversing or leaving alone the limit pins (in the GRBL settings, around $15)).

My question is, what do you think might be my problem?
Why does grbl boot frozen if I enable hard limits? Can it be in connection with it freezing when I was tríing with the enable cables?

A saw different connections with the TB6600. Should I try to change all the connections, so that the 2-7 pins of the board would go to the driver's (something+) sockets and the (something-) sockets would be all connected to the GND pin on the board?
Or do you recommend something else?

These are the 2 ways I saw them connected(you should be looking only at the +5V and the GND wirings):

Many thanks in advance :slight_smile:

I suspect you would get more useful advice on some CNC Forum where people are familiar with GRBL - or maybe on the RepRap Forum.

This Arduino Forum is mainly for helping people write their own programs.

...R

Well, I managed to get some results and I think that is more likely to be an Arduino problem, and less a CNC problem.

My result is... interference...
I disconnected everything what I connected yesterday to the limit switches and I only had the connector outputs on the outer side of the box of the electronics.

So I made experiments with touching things to the output connectors, and even an insulated screwdriver triggered the alarm, which was only touched to the Limit Z, X or Y output. If I was touching the ground output, however, nothing happened.
And more proof of interference is when I held my soldering iron (pistol like, bent copper wire, heavy metal stuff in it) and switched it on, the alarm was immediately triggered.

What should I do to avoid interference? Move the power supply further from the arduino or place a metal shield between them?

What is the purple box that the HY-DIV268N-5A is connected to?

edgemoron:
What is the purple box that the HY-DIV268N-5A is connected to?

I gues it's an arduino mini. That picture is for only to represent the coennction types, but that is irrelevant now, because that is solved.

I have the problem with interference.

norbert1998:
My result is... interference...

Maybe you are missing external pull-up or pull-down resistors on the limit switches. If you were writing your own code I would suggest using the Atmega's internal pull-up resistors with pinMode(pinNumber, INPUT_PULLUP);

Without suitable resistors the input to a digital pin that is connected to nothing else will be unpredictable.

...R

Stick 100nF to ground on all your switch inputs, that'll knock out loads of interference. Not subtle.

The output pins are pulled up by the grbl code. I think it's just not enough, I need more juice to not get alarms.
I should try what you wrote. I'll be back with the results when I'll have time to spend time with it.

Next time you swoop by Earth, how about slowing down long enough to post a wiring diagram showing those limit switch connections.