584,858 active members*
4,947 visitors online*
Register for free
Login
IndustryArena Forum > CNC Electronics > CNC Machine Related Electronics > Limit switch noise: Optocoupler, 12v, 24v?
Results 1 to 17 of 17
  1. #1
    Join Date
    Feb 2016
    Posts
    285

    Limit switch noise: Optocoupler, 12v, 24v?

    Hi,

    I'm running my CNC using GRBL on an Arduino Uno.

    Sometimes I'm having problem with false alarm from my limit switchs. Usually when powering on/off router and / or dust collector.

    I changed my limit switches cables for shielded ones, rerouted limit cables away from the stepper and spindle cables. I also built a circuit with a capacitor to filter the signal.

    It helped to mitigate the problem a lot but still, I sometime get false alarm.

    Now that I'm building a new CNC, I'd like to get rid of this problem once and for all. Since I'm having drag chain that would be VERY convenient to have the limit switchs cables in the chain along with the spindle and stepper cables.

    What would be the best solution to prevent false alarm? 5V,12V, 24V limit with opto coupler?

    Thanks

  2. #2
    Join Date
    Jun 2005
    Posts
    1723

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    Biggs427,
    Do yourself a huge favor. Switch the limits to 24V logic. How? You basically add a 24V relay. How? The 24V power is run through the NC and COM contacts of each limit switch, then to the relay. Now in the un-faulted situation meaning none of the limit switches are tripped the 24V is active, meaning it is turned on. Now the contract of the relay will connect to your breakout board. The common will go to either Ground or VCC (5V) depending on the logic you want in your breakout board. The NC contact will go to the LIMIT switch input on your breakout card. The relay should be kept close to the breakout card. Why does this work? The noise impacting your system is raising the low level just slightly so the BOB thinks it is momentarily seeing a high. When you have 24V logic or even 12V logic the logical one is so much higher the noise will not ever be seen as an activation.. This is how commercial machines are wired, and they is why their controls always use 24VDC. Keep in mind if you don't have 24V handy you can also use 12V, just change the relay to 12V, both are well above the 3.3-3.5v that can be interpreted as a high.

    Russ

  3. #3
    Join Date
    Mar 2004
    Posts
    413

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    I have only had time to read into the world of GRBL, but I recall them having debounce settings for the limit switches. Have you attempted to adjust debounce ? It can be the simple answer to handle such noise.

    Sometimes it is not noise in the environment if you are using NC switches. Another trick depending on application is to use NO switches as they generally do not make and break their contacts during vibration and contact dirt.

    Understand that there are REASONS most machines should have NC switching, but plenty of machine styles and sizes could be plenty safe running NO switches.
    Chris L

  4. #4
    Join Date
    Dec 2005
    Posts
    390

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    If higher voltages are not practical, good results are possible with shielding and signal regeneration. An opto-coupler can help with signal regeneration (and level conversation). Adding hysteresis with a Schmitt-trigger will help solve noise related bounce problems. There are opto-couplers with built-in Schmitt-triggers. If you are experimenting with Arduino, you may be interested in this hardware. Best of success to you.

  5. #5
    Join Date
    Feb 2016
    Posts
    285

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    Will a relay be fast enough for limit and homing switch? In GRBL there're the same.

    Would this 24v to 5v optoocupler module do the job?

    Thanks

  6. #6
    Join Date
    Dec 2005
    Posts
    390

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    The module looks nice and should work for signal regeneration to a different voltage. Because I can't read the chip IDs and the price, I doubt Schmitt-triggers are present. In that case, you should use some software debounce.

  7. #7
    Join Date
    Jun 2005
    Posts
    1723

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    That unit will work fine, the optical transistor is so much faster than you mechanical machine it would be instant in comparison. I used EE-SX670 optical sensors for my home sensors and they work perfect, I run them at 24V.
    Russ

  8. #8
    Join Date
    Feb 2016
    Posts
    285

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    Thanks!

    Would this be the way to hook it up to my GRBL controller? Pin D9 being the input for the X limit/home switch.


  9. #9
    Join Date
    Jun 2005
    Posts
    1723

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    That circuit would work, you are using the OPTO to control the limit input. Keep in mind most of the time limit switches are normally closed for safety concerns over a broken wire. You can do that with this circuit it would be one all the time and the state could change when the Limit switch opens.

    Russ

  10. #10
    Join Date
    Jan 2005
    Posts
    1943

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    Quote Originally Posted by Biggs427 View Post
    Will a relay be fast enough for limit and homing switch? In GRBL there're the same.

    Would this 24v to 5v optoocupler module do the job?

    Thanks
    I have proximity switches triggering mechanical relays on my machines for the limit switches and they work just fine. On my GRBL driven machine the prox switch operating at 12V fires and triggers the mechanical relay mounted right next to the Arduino. The homing works fine as does the limit, and the repeatability while homing is about 0.0002" (two ten-thousandths).

  11. #11
    Join Date
    Feb 2016
    Posts
    285

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    I have more backlash than that in my X and Y ballscrew! 0.0005

    I ordered the optocoupler to test it but I think I'm going to test with relays I already have!

    Thanks all for your help!

  12. #12
    Join Date
    Jan 2005
    Posts
    1943

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    Quote Originally Posted by Biggs427 View Post
    I have more backlash than that in my X and Y ballscrew! 0.0005

    I ordered the optocoupler to test it but I think I'm going to test with relays I already have!

    Thanks all for your help!
    Well I guess I should caveat my previous post. With the mechanical relay it repeats during homing within about 0.0002", but when homing it is only really moving one direction when looking at the switch, so the backlash is all taken up when the switch activates. I do have backlash on that machine and it is about 0.004", but that doesn't affect the homing repeatability.

    I have essentially the same setup on my other machine that I run GRBL or LinuxCNC on and it works fine on either LinuxCNC or GRBL.

    Also, I have the limit switches set up to activate at 0.1" from where an axis would mechanically hit the end of travel. When testing, the response time was plenty fast enough to prevent a full speed jog from hitting the mechanical stop. My machine rapids at 200 IPM. I actually measured how far it would travel from switch activation to a stop from that speed, but can't remember what it was, but was far less than 0.1"

  13. #13
    Join Date
    Jan 2005
    Posts
    1943

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    One last thing I thought of. On the relay, I use the normally closed contacts, and don't have any filtering like capacitors or such and it seems to work fine. I previously used the normally open contacts and had false triggers at times. I haven't had any false triggers since switching to NC. I'm sure the controller is seeing switch bouncing, but it hasn't affected me the way I have it set up now.

  14. #14
    Join Date
    Dec 2019
    Posts
    1

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    Hi CNCMZN172, I realize this is an old post and hopefully you're still about and can point me in the right direction.

    An all too common issue with the Arduino boards it seems is the limit switches being triggered from VFD/Spindle. My issue is from the spindle. So, I've purchased the attached 12V 4 Channel Relay with opto-isolation, which I hope will help my issues based on this thread.

    Attached effort at my test based on your previous reply in this post.

    Question: Have I totally messed up your interpretation or am I along the right track? My electrical knowledge is limited, learning along the way.

    Any help appreciated and thanks to you or anybody that can advise.

    Cheers, Jason

  15. #15
    Join Date
    Jun 2005
    Posts
    1723

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    Jason,
    You have this drawn up incorrectly. The limit switch needs to get on the input side of the relay board and the output of the relay will go into the Arduino. That is now you get the isolation. The switch provides the signal to the relay board and the contacts of the relay tell the Arduino the switch has fired. Post the schematic of the relay board and the schematic of the Arduino and I will explain how to wire up the two.

    Russ

  16. #16
    Join Date
    Oct 2016
    Posts
    9

    Re: Limit switch noise: Optocoupler, 12v, 24v?

    Quite a common problem...
    If you use an optocoupler, always measure the current at its input and provide at least 5mA.

Similar Threads

  1. optocoupler as a switch to on/off VFD & ac servo drives?
    By Lozzy in forum CNC Machine Related Electronics
    Replies: 3
    Last Post: 05-23-2016, 11:24 AM
  2. Electric noise - home/limit switch
    By feragto in forum DIY CNC Router Table Machines
    Replies: 33
    Last Post: 11-21-2010, 06:33 PM
  3. Need help with noise on limit switch cables. Elco or AC cap?
    By riva in forum CNC Machine Related Electronics
    Replies: 4
    Last Post: 11-14-2008, 12:04 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •