Safe switch interface. Long wires and noisy environment

Thread Starter

samudavid

Joined Jan 4, 2018
29
I need to use two push button switches in a project that includes a PIC controller. The switches have to be far away (let's say 15-20m) the microcontroller. Also, the environment is noisy: motors, contactors etc. In the circuit, I have a 5V digital source and a 24V for analog. I would like the 24V to be the cleanest possible. The analog circuits are being fed from it.
I don't have an special problem with bounces, will solve it in software. The button is expected to be pressed infrequently.
I want the solution to be cost-effective (the polite way for cheap). I have plenty power available, that's not an issue. By the way, I use the 24V rail but not sure if has any real advantage over 5V. It seems to me that a small problem on the 5V rail could cause a uC permanent failure or a freeze. Also, with 24V the voltage drop in wires is less significant.

I've seen a few circuits to protect the inputs, zeners, BJTs resistors... but what seems better to me is an optocoupler. As I only have one ground terminal, there won't be isolation, but for certain aspects I think it has advantages.

This is the circuit:

upload_2018-1-15_16-57-38.png


And these are the advantages I see for my application (maybe wrong):

1- As the long wire is always (but when the button is pressed) tied to ground, there won't be appreciable noise due to the EM fields around.
(I assume that won't be EM coupling in the 24v rail also)

2- When the button is pushed is unlikely that an EM interference could drive the LED.

3- In case of a electrostatic discharge, o wire inductance flyback voltage spike, the uC won't be harmed.

4- As the Optocoupler is a kind of slow device, it's a first debouncing system.

5- If wire gets cut, the uC can know

6- The chips are cheap and widely available.

Of course, if somebody connects the switch cable to 380V it will burn out... it's not a fool-proof system.

I would appreciate any comments, I'm not sure if the advantages I see are true or not.

Thanks in advance!
 

Thread Starter

samudavid

Joined Jan 4, 2018
29
What about aging of the photocoupler?

Take a look to this page:

http://electronicsbeliever.com/factors-affecting-current-transfer-ratio/

A reduction in CTR doesn't seem really important as long as there is only a 5mA current need in the uC input. With a nominal CTR of 300% min (817D) , we can face a 50% loss and the system will still working with an Iout of 7.5mA if the I through the LED is 5mA. Anyway it seems more cautious to let the LED off most of the time (NO switch), but in that way, half of the line would be in high impedance all the time. However, half of the line, seeing a reverse biased diode (LED) and a resistor to the power rail, doesn't seem to be very dangerous. Is very unlikely that this will create a false ON due to induced noise.

What do you think? Better to avoid aging and let the LED off or better to have improved noise inmunity?

Thanks in advance!
 

ericgibbs

Joined Jan 29, 2010
10,018
hi sam,
Do you have a particular Opto device available.?

E
EDIT:
Is the 817D the opto type you are planning to use, I am searching for opto ageing data.
Check page #23 for some guide notes on LOP.
 

Attachments

Last edited:

MrChips

Joined Oct 2, 2009
21,079
I would test the minimum current required by the emitter and try to reduce the current below 20mA.
For example, if the minimum current is 1mA, I would set the emitter current to about 5mA.
 

Thread Starter

samudavid

Joined Jan 4, 2018
29
Thank you all for your kind suggestions

hi sam,
Do you have a particular Opto device available.?

E
EDIT:
Is the 817D the opto type you are planning to use, I am searching for opto ageing data.
Check page #23 for some guide notes on LOP.
No, I can use whichever I want if it's not so expensive and widely available (for example in Digikey or Amidata), In fact I'm going to check the devices in the application note you upload (thanks). By the way, I couldn't download it from your link, so I let this link in case somebody finds the same problem.

http://icecube.wisc.edu/~kitamura/NK/Datasheets/misc/5988-4082EN designers guid.pdf


I would test the minimum current required by the emitter and try to reduce the current below 20mA.
For example, if the minimum current is 1mA, I would set the emitter current to about 5mA.
As I understand in the datasheet of the 817 (is a popular one so I take this by default), the output current (Ic) is proportional to the LED current (If). They call this parameter CTR in %. Also, CTR changes with temperature, aging and If. Thus, looking at the graph in the datasheet (fig 11 pag 6), a good point to set If is 5mA. Besides, Ic has to be big enough to pull the pin down, but with a 10K resistor and 5V, 1mA seems more than enough. Therefore, if CTR is more than 20% (5mA If / 1mA Ic) the circuit will work. Or maybe I'm wrong, so feel free to say whatever you think about it.

https://www.vishay.com/docs/83522/k817p.pdf

Thank you in advance
 

Janis59

Joined Aug 21, 2017
1,178
The ultimate solution is HFBR series and opto-wire instead of metal wire. I had used this in the 50 meter line between picosecond 100 kW lasers power supplies (50 kV or more, kiloamperes or megaamperes at picoseconds , and it never gave a problems. HFBR 1523, 2523 etc.
 

Alec_t

Joined Sep 17, 2013
11,274
As you are concerned about noise getting on to the 24V rail or causing false triggering, perhaps put a low-pass filter for the long wire pair at the opto end?
 

Thread Starter

samudavid

Joined Jan 4, 2018
29
Thanks again for your collaboration,

The ultimate solution is HFBR series and opto-wire instead of metal wire. I had used this in the 50 meter line between picosecond 100 kW lasers power supplies (50 kV or more, kiloamperes or megaamperes at picoseconds , and it never gave a problems. HFBR 1523, 2523 etc.
Yes, that's definitely the best solution, but it seems a little like killing flies with a cannon. The application is not critical and the environment is not as noisy as the one you described. It's only a switch a few meters away and a let's say 3 motors (100hp, 5hp, 1hp) in ten meters from the switch. Anyway, I've been looking at the opto transceivers you posted and are really interesting. I would use them if not were for the price (20€ + 10€ wire aprox) and the complex installation.

The Alec_t solution to the 24V floating rail seems perfect. It should have occurred to me... With a single capacitor (10 nF) between the two wires there is a low impedance path to ground for noise and a reverse biased LED and a resistor to 24V. It should work OK.
 
Top