Hello Guest it is November 13, 2019, 01:58:49 AM

Author Topic: Turning on the relay causes a 'limit switch triggered' error  (Read 706 times)

0 Members and 1 Guest are viewing this topic.

Turning on the relay causes a 'limit switch triggered' error
« on: March 09, 2019, 02:03:57 AM »
So I have a 12V relay board that I used to use with my Arduino. It actually has two relays on it and I'm using only one channel. The board schematic is like the one shown in the image:



Since I wanted the relay to operate on an active high input, I tied IN1 and GND together. The GND here is also the LPTs GND. On the Vcc terminal where it says Arduino's 5V, I have pin 14 of the LPT connected. Across JDVcc and GND is an independent 12V supply.

Now every time I try to switch on the spindle, the relay clicks ON for a fraction of a second and then turns OFF and I see a 'Limit switch triggered' on the screen. Can anyone help me understand what is happening here?

Offline Tweakie.CNC

*
  • *
  •  7,985 7,985
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: Turning on the relay causes a 'limit switch triggered' error
« Reply #1 on: March 09, 2019, 03:14:01 AM »
Sounds very much like electrical 'noise'.

Try increasing the Debounce Interval (Config. / General Config.) to around 1000 and see if that makes any difference.
Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.

Offline hof

*
  •  9 9
    • View Profile
Re: Turning on the relay causes a 'limit switch triggered' error
« Reply #2 on: March 09, 2019, 03:20:05 AM »
Sounds like you're suffering from EMI from when the spindle is turning on.
A motor that is turning on at full speed (as when controlled using a relay) is causing huge inductive spikes that can interfere with nearby electronic circuits. Even the ones that aren't physically connected to the motor.

Try disconnecting the spindle from the relay to verify this. If the limit switch stops triggering when the spindle is disconnected you know it's noise from the spindle that's causing it.
Try moving the relay and the wiring to the spindle further away from other cabling such as limit switch cables and circuits.

Offline MN300

*
  •  107 107
    • View Profile
Re: Turning on the relay causes a 'limit switch triggered' error
« Reply #3 on: March 09, 2019, 06:16:25 AM »
There is no need to connect the LPT GND to the relay board GND, just to IN1 as you did is fine. The LPT powers the OPTO input and the 12V supply powers the relay side. The extra ground tie just provides a path for noise.
Re: Turning on the relay causes a 'limit switch triggered' error
« Reply #4 on: March 09, 2019, 09:37:29 AM »
Thank you all.

Sounds very much like electrical 'noise'.

Try increasing the Debounce Interval (Config. / General Config.) to around 1000 and see if that makes any difference.

I put in a value of 1000 and with that the relay would trigger properly and the job would start as well. However, I have started getting random failures with a 'Limit switch triggered' message. I then increased it to a value of 6250 (the equivalent of 250ms). With this, it still randomly stops but there is a significant delay now before the job fails - still randomly. The stepper wires are shielded but not the limit switches and the estop.

Before Mach3, I was using Grbl with the same wiring and it never failed randomly like this. Which is why I'm stumped here.

Offline Tweakie.CNC

*
  • *
  •  7,985 7,985
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: Turning on the relay causes a 'limit switch triggered' error
« Reply #5 on: March 09, 2019, 10:01:21 AM »
Quote
I put in a value of 1000 and with that the relay would trigger properly and the job would start as well. However, I have started getting random failures with a 'Limit switch triggered' message. I then increased it to a value of 6250 (the equivalent of 250ms). With this, it still randomly stops but there is a significant delay now before the job fails - still randomly. The stepper wires are shielded but not the limit switches and the estop.

This confirms that it is indeed electrical noise and you now need to check your wiring layout to see where improvements can be made.

I think you have already identified the problem...
All inputs (limit switches, EStop, etc) should be connected with twin shielded cable (with the shield connected to a single point Earth at the controller end only). If you do this then you should be able to reduce the debounce value to a sensible value of about 500.

Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.
Re: Turning on the relay causes a 'limit switch triggered' error
« Reply #6 on: March 09, 2019, 11:08:25 AM »
Is it okay to use Ethernet cables for the limit and estop switches? They are twisted pair and shielded(?).
Re: Turning on the relay causes a 'limit switch triggered' error
« Reply #7 on: March 09, 2019, 01:23:16 PM »
Hi,
yes you could use Ethernet cable.

You should try to indentify the source of the interference and eliminate it if you can.

What you are trying to do is protect sensitive circuits from EMI. If you eliminate the EMI than you have protected
ALL the sensitive circuits in one go.

The most likely source of EMI is the spindle. Disconnect the spindle as Hof has suggested to prove it.
It may be something as simple of a line filter or even as simple as connecting your spindle to a different
230V outlet to your PC/controller will do the job.

Craig
My wife left with my best friend...
     and I miss him!
Re: Turning on the relay causes a 'limit switch triggered' error
« Reply #8 on: March 09, 2019, 01:39:59 PM »
You should try to indentify the source of the interference and eliminate it if you can.

Hi, Thank you. I will try running a job without the spindle turned on. This should tell me if that is the source of EMI.

Offline hof

*
  •  9 9
    • View Profile
Re: Turning on the relay causes a 'limit switch triggered' error
« Reply #9 on: March 09, 2019, 01:44:06 PM »
Just unplug the spindle and run the same code as before. You want to drive the relay to make sure there's no other problems with your circuit.