Author Topic: Opto-isolators for CNC limit switch noise  (Read 16083 times)

0 Members and 1 Guest are viewing this topic.

Offline scott216Topic starter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: us
Opto-isolators for CNC limit switch noise
« on: May 13, 2014, 04:39:16 pm »
I've got a ShapeOko CNC router that uses and Arduino UNO with a gshield stepper controller board plugged into it.  I noticed my limit switch inputs have quite a bit of noise on them (see my Shapeoko forum post if you're interested in oscilloscope screenshots).   I'm using shielded wire on the limit switches.

My plan is to build an Arduino shield that would sandwhich between the Uno and gshield.  It would have optocouplers to isolate the limit switches.  I'm thinking of using HCPL2631 logic level isolator.  I chose the HCPL2631 because it's used by a RepRap Opto-Isolator board.  This design seemed like a good starting point for me.

I have a few questions:
Is using a logic level optocoupler the right choice or should I use a transistor optocoupler like a LTV-826?

Currently I have ground going out to the limit switch and when the switch closes, it pulls the input pin to ground.  Since the HCPL2631 optocoupler  inverts the signal, I was planning on having +5v go to the limit switch instead of ground.  Any reason not to do this?

Couldn't noise on the line cause the optocoupler to turn on?  Should I also use an R-C low-pass filter in the circuit? If so, are there any special considerations I need to take into account if I'm using a low-pass filter together with an optocoupler?
 

Offline Fank1

  • Regular Contributor
  • *
  • Posts: 159
Re: Opto-isolators for CNC limit switch noise
« Reply #1 on: May 13, 2014, 09:57:27 pm »
You have a classic ringing problem and need a snubber circuit on your stepper motor leads.
Google NXP application note AN11160.
It's for mosfet's but the information still applies.
.
 

Offline scott216Topic starter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: us
Re: Opto-isolators for CNC limit switch noise
« Reply #2 on: May 13, 2014, 10:24:26 pm »
You have a classic ringing problem and need a snubber circuit on your stepper motor leads.
Google NXP application note AN11160.
It's for mosfet's but the information still applies.

I love the classics.  Thanks!  I'l check out the app note.
 

Offline scott216Topic starter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: us
Re: Opto-isolators for CNC limit switch noise
« Reply #3 on: May 15, 2014, 05:11:12 pm »
I ordered some 10 ohm resistors and 470nF caps from Digikey.  We'll see what that does.  I am still interested in an answer to my question about logic vs transistor optocoupler.  Even if I get rid of the ringing with a snubber, I'd like to use the optocouplers. 
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Opto-isolators for CNC limit switch noise
« Reply #4 on: May 15, 2014, 05:19:19 pm »
Quote
Is using a logic level optocoupler the right choice or should I use a transistor optocoupler like a LTV-826?

Doesn't really matter here. Logic couplers are considerably faster than a typical optocoupler. But both are more than fast enough here.

Quote
Any reason not to do this?

If you could put that on a piece of paper, i tmay help people understand what you are trying to do.

Quote
Couldn't noise on the line cause the optocoupler to turn on? 

The ringing seems to be periodic and could be due to poor coupling. I would put an inductor / diode + capacitor on the low-power digital stuff to isolate it from the motors.
================================
https://dannyelectronics.wordpress.com/
 

Offline scott216Topic starter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: us
Re: Opto-isolators for CNC limit switch noise
« Reply #5 on: May 15, 2014, 05:41:24 pm »
Attached is a schematic of what I'm considering.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Opto-isolators for CNC limit switch noise
« Reply #6 on: May 15, 2014, 05:45:06 pm »
It will work - read the datasheet to see if you need a pull-up. If you are concerned about the polarity, you can change the code, or the wiring so the led is active low or active high, depending on what it was before: your driver circuit would be sinking / sourcing current, respectively.
================================
https://dannyelectronics.wordpress.com/
 

Offline scott216Topic starter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: us
Re: Opto-isolators for CNC limit switch noise
« Reply #7 on: May 15, 2014, 06:29:33 pm »
It will work - read the datasheet to see if you need a pull-up. If you are concerned about the polarity, you can change the code, or the wiring so the led is active low or active high, depending on what it was before: your driver circuit would be sinking / sourcing current, respectively.

Normally you'd have ground going out to the limit switch with a pull-up resistor on the inputs.  But since the opto-coupler inverts the signal, I have +5v going to the limit switch.

Could noise in the line cause the opto-coupler to energize?  Should I add a low-pass filter to the circuit?
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Opto-isolators for CNC limit switch noise
« Reply #8 on: May 15, 2014, 06:59:44 pm »
Quote
Could noise in the line cause the opto-coupler to energize? 

Could, but not likely.

Quote
Should I add a low-pass filter to the circuit?

I would put a probe on the led line before attempting a cure. The issue could be switch bounces or supply coupling, or interference....

No point in implementing a cure before the problem is identified.
================================
https://dannyelectronics.wordpress.com/
 

Offline scott216Topic starter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: us
Re: Opto-isolators for CNC limit switch noise
« Reply #9 on: May 18, 2014, 03:06:26 am »
It will work - read the datasheet to see if you need a pull-up. If you are concerned about the polarity, you can change the code, or the wiring so the led is active low or active high, depending on what it was before: your driver circuit would be sinking / sourcing current, respectively.
I've only got one power source (from the Arduino Uno), is that going to defeat the purpose of the opto-couplers?
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Opto-isolators for CNC limit switch noise
« Reply #10 on: May 18, 2014, 04:05:20 am »
Quote
Couldn't noise on the line cause the optocoupler to turn on?  Should I also use an R-C low-pass filter in the circuit? If so, are there any special considerations I need to take into account if I'm using a low-pass filter together with an optocoupler?

 An opto's input (an LED) is a pretty low impedance device, it takes several milliamps to turn on the lead and 'noise voltage' typically does not have enough energy/power to trigger the opto's led to on from off or off to on. i don't think you will need to do any special filtering if your using optos for the switch inputs.

 As far as powering the switch contacts from the arduino 5V pin, that does eliminate/defeats the galvanic isolation that the opto provides, which is normally why they are selected for use.
« Last Edit: May 18, 2014, 04:12:53 am by retrolefty »
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4319
  • Country: us
  • KJ7YLK
Re: Opto-isolators for CNC limit switch noise
« Reply #11 on: May 18, 2014, 04:31:47 am »
I've only got one power source (from the Arduino Uno), is that going to defeat the purpose of the opto-couplers?
Yes, that defeats the whole purpose.  We use opto-couplers (and other similar devices) because the power is DIFFERENT on either side, or there is some other reason to ISOLATE the source from the destination. The initial premise that a noise problem can be fixed with opto-isolators is faulty.
 

Offline scott216Topic starter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: us
Re: Opto-isolators for CNC limit switch noise
« Reply #12 on: May 18, 2014, 04:35:52 am »
I've only got one power source (from the Arduino Uno), is that going to defeat the purpose of the opto-couplers?
Yes, that defeats the whole purpose.  We use opto-couplers (and other similar devices) because the power is DIFFERENT on either side, or there is some other reason to ISOLATE the source from the destination. The initial premise that a noise problem can be fixed with opto-isolators is faulty.
I thought that might be the case.  I'll see what a low-pass RC filter and some ferrite beads do.
 

Offline LukeW

  • Frequent Contributor
  • **
  • Posts: 686
Re: Opto-isolators for CNC limit switch noise
« Reply #13 on: May 18, 2014, 11:12:30 am »
How do you know optocouplers are going to make your noise go away? What is the usual purpose of optocouplers? Where does your noise in these signals come from?

Optocouplers are usually used to provide galvanic isolation, not to remove noise, which usually involves some sort of snubber or filter.

An optocoupler is intended to transmit the signal supplied to it with as much fidelity as possible, subject to realistic speed/bandwidth limitations, not to act as a filter.

These are useful things to think about. Is an optocoupler actually the right choice for what you want to achieve?
 

Offline scott216Topic starter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: us
Re: Opto-isolators for CNC limit switch noise
« Reply #14 on: May 18, 2014, 02:31:51 pm »
How do you know optocouplers are going to make your noise go away?

Articles like these lead me to believe opto-couplers help reduce noise:
http://www.eetimes.com/document.asp?doc_id=1272337
http://www.vishay.com/docs/83702/appnot83.pdf
http://www.electronics-tutorials.ws/blog/optocoupler.html

I'm not saying opto-couplers are the right choice for my current problem, that's why I ask questions in this forum and others, so I can learn from people who know more about this than me.  I haven't dived into noise issue before; I'm trying to figure it out. 

I do have parts for a snubber on order, so I'll see what that does when they arrive.  I tried an RC filter (see attached schematic), but that didn't seem to make a difference.  Someone on the Arduino forum said this circuit would actually make it worse, but he didn't explain why.  So I'm not sure what's wrong with the circuit.  Maybe I need to be switching +5V at the limit switch instead of ground?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf