Author Topic: Switch at the end of a long cable: Noise, protection  (Read 1976 times)

0 Members and 1 Guest are viewing this topic.

Offline JuKuTopic starter

  • Frequent Contributor
  • **
  • Posts: 566
  • Country: fi
    • LitePlacer - The Low Cost DIY Pick and Place Machine
Switch at the end of a long cable: Noise, protection
« on: July 26, 2013, 11:38:42 am »
I have switches at the far end of a relatively long (3m) cable in a very noisy environment. There are motors and such; I measure up to  + / - 3V peak noise at the other end of the cable, when the switch is closed(!). I need to reliably trigger an interrupt when the switch activates. I have no control on the microprocessor software or hardware. I have a connector that goes directly to the uC pins, and there are pull-ups on the uC board. I can have whatever I want between the switch and the connector. Direct connection triggers all the time, but so far, hasn't killed the micro (but it sure looks nasty on the scope).

What would you do?
« Last Edit: July 26, 2013, 11:40:15 am by JuKu »
http://www.liteplacer.com - The Low Cost DIY Pick and Place Machine
 

Offline lgbeno

  • Frequent Contributor
  • **
  • Posts: 349
  • Country: 00
Switch at the end of a long cable: Noise, protection
« Reply #1 on: July 26, 2013, 12:17:51 pm »
You could consider using a current source and then measure the current though the loop to determine switch closure.


Sent from my iPhone using Tapatalk 2
 

Offline ElectroIrradiator

  • Frequent Contributor
  • **
  • Posts: 614
  • Country: dk
  • More analog than digital.
Re: Switch at the end of a long cable: Noise, protection
« Reply #2 on: July 26, 2013, 12:44:02 pm »
Yep, switch a current loop, maybe even use an opto-coupler between the cable and the MCU to get 'perfect' isolation from the noise voltages. Look into MIDI cables and setups for schematics and more ideas.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16363
  • Country: za
Re: Switch at the end of a long cable: Noise, protection
« Reply #3 on: July 26, 2013, 09:02:21 pm »
A relay will work there, just use a 12V relay with a set of gold flashed contacts at the MCU end and a catch diode or zener diode across the relay coil is both cheap and rugged. If you have a 12V rail a 12V relay is simple and going to have the mechanical life. Will have some contact bounce which will be minimal with a reed relay unit and will have a few milliseconds delay on switch on and off, but if you are doing motors then this is not a problem.
 

Online Andreas

  • Super Contributor
  • ***
  • Posts: 3303
  • Country: de
Re: Switch at the end of a long cable: Noise, protection
« Reply #4 on: July 26, 2013, 09:06:10 pm »
I need to reliably trigger an interrupt when the switch activates.

What would you do?

Wrong concept: never do a interrupt on external signals. If there are too many external events your system may hang.
Instead I would debounce the signal within subsequent calls of a 1ms timed routine.
also some filtering (at least a R/C filter) with about 1ms time constant is a good idea.

with best regards

Andreas
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6966
  • Country: nl
Re: Switch at the end of a long cable: Noise, protection
« Reply #5 on: July 26, 2013, 11:47:42 pm »
I can have whatever I want between the switch and the connector.
STP?
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2130
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: Switch at the end of a long cable: Noise, protection
« Reply #6 on: July 27, 2013, 11:04:21 am »
STP = shielded twisted pair
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf