Protecting again spurrious noise on long runs to Arduino inputs

Thread Starter

ischonfeld

Joined Jun 22, 2019
63
I'm in the process of replacing a hard wired alarm panel from the 80's with a home-built panel using Arduino MKR1000/ESP32 processors. The sensor switch wire runs (windows, doors, etc) are all 2-wire and some runs are 50+ feet. None of the runs are shielded nor twisted pair. Each run is basically one or more reed switches in series, all normally closed. An alarm condition is triggered when any switch is opened.

I'm concerned about possible transients since some runs could be near 120VAC household outlet/switch wiring in the walls. Also concerned about other transients from other unusual sources such as nearby lightning or whatever else might induce noise.

So, what kind of protection might I add at the processor end of each run? The signaling will all be 3.3V (old panel was 12VDC). Under normal circumstances each input would be grounded through an (up to) 100' run (50' out and back). When triggered, the input would have an (up to) 50' open line attached with a pull-up resistor at the processor.

Thinking that 50' of wire is an awful big antenna even with a decent pull-up resistor.

Recommendations?
 

ElectricSpidey

Joined Dec 2, 2017
3,312
When I upgraded my alarm system to micro based, I interfaced all of the existing loops (non-shielded and non-twisted) using Opto-Couplers with a small inductor in series.

Haven't had any problems.
 

Sensacell

Joined Jun 19, 2012
3,768
(1) Use a low value pull up resistance, a value that makes the loop current 20 to 30 mA
(2) Apply low-pass RC filtering, with a time constant ~ 200 msec.
(2) Clamp the signal lines to GND and VCC with fast diodes.
 

Sensacell

Joined Jun 19, 2012
3,768
A low-ESR bypass capacitor across the supply should be included anyway?
This keeps the supply rails nice and "stiff" - at least for transient events.

This topic tends to get a bit into electro-voodoo, mostly because the level of protection is not defined.
Lightning has a way of destroying everything, a reasonable approach is in order, to keep it all from becoming very complex and expensive.
 

Ian0

Joined Aug 7, 2020
13,097
A low-ESR bypass capacitor across the supply should be included anyway?
I thought it was worth mentioning, as I once clamped the input to a resistor-zener supply and it took a while to work out what was happening.
This topic tends to get a bit into electro-voodoo, mostly because the level of protection is not defined.
And the level of the interfering signal is completely random.
 

dendad

Joined Feb 20, 2016
4,635
I second @ElectricSpidey suggestion of using Opto-Couplers. We used them extensively in out industrial control devices. Optos solve a lot of problems and they are quite easy to use.
Here you can see we used a few ;)
1723013683644.png
This board is an RS485 networked 16 I/O controller and each I/O port has the ability of being an input pulled to 0V, or an output FET switching to 0V.
We made many of these and about the only problem we have had with them is after about 20 years, the electros in the power supply dry out. Yes, there are lots of these still in use after that length of time.
 

SamR

Joined Mar 19, 2019
5,470
Everyone seemed to miss the "Elephant in the room", the wire used. In industry, ALL field sensor and actuator wiring uses shielded twisted pair wiring and yes, with optoisolators for electronically classified atmospheres to guarantee intrinsic safety. Our standard was 19 pair #20 AWG solid wire with each pair shielded and the entire cable shielded as well. Obviously 19 pair is overkill but, depending on your distribution method, single to multiple pair wiring is called for. And 2 to 4 pair cable is not that much more per/ft than single pair. Each pair should be individually shielded as well as the entire cable. Ground loops to be avoided which means grounding on one end only to preferably a dedicated ground rod which has been Megged to ensure proper grounding. Typically the distributed controls signal is 4-20mA @ ~10VDC for industrial control systems. For home alarms low DC voltages are used depending on your system requirements.
 

Thread Starter

ischonfeld

Joined Jun 22, 2019
63
So does something like this make sense:

OptoIsolator.jpg
The system is powered by 12V, dropped down to 3.3V for the MCUs. All with a common ground.

I'm not really concerned with switch bounce, since any open switch in a window or door loop is all I need to trigger an alarm condition.

I think with the 1K resistor on the LED side I'm supplying enough current to drive the transistor but still staying well within the limits on the datasheet. On the transistor side, I'm thinking the 1K resistor should also provide enough current to put the transistor in saturation - but I'm not 100% sure on this.

Am I missing anything?
 

Thread Starter

ischonfeld

Joined Jun 22, 2019
63
Everyone seemed to miss the "Elephant in the room", the wire used. In industry, ALL field sensor and actuator wiring uses shielded twisted pair wiring and yes, with optoisolators for electronically classified atmospheres to guarantee intrinsic safety. Our standard was 19 pair #20 AWG solid wire with each pair shielded and the entire cable shielded as well. Obviously 19 pair is overkill but, depending on your distribution method, single to multiple pair wiring is called for. And 2 to 4 pair cable is not that much more per/ft than single pair. Each pair should be individually shielded as well as the entire cable. Ground loops to be avoided which means grounding on one end only to preferably a dedicated ground rod which has been Megged to ensure proper grounding. Typically the distributed controls signal is 4-20mA @ ~10VDC for industrial control systems. For home alarms low DC voltages are used depending on your system requirements.
I can't argue with any of this, except in the 80's apparently residential alarms were wired with 2-wire unshielded, possibly twisted pairs cable (I use the term cable loosely - really just 2 wires twisted together loosely). Even 4-wire smoke detector cables weren't shielded.
 

crutschow

Joined Mar 14, 2008
38,316
I see no good reason for shielded / twisted wire, or the use of opto couplers.
Heavy filtering at the input to the Arduino inputs should be sufficient to ignore any noise or transient voltages.
Also can add a small delay (a second or so) with multiple readings of the signal before it responds, which will also help ignore short transients.
 

Ian0

Joined Aug 7, 2020
13,097
No real choice. The 12V is the main supply. 3.3V is derived from it. I know I won't get full isolation but this seems better than nothing.
Actually it isn't better than nothing. All you have done is make a transistor with low gain and a slightly higher Vbe threshold than a normal transistor.
It's no better than @joeyd999 's circuit (post #7) and lacks reverse polarity protection (and negative spike protection) on the input.
 

Thread Starter

ischonfeld

Joined Jun 22, 2019
63
Actually it isn't better than nothing. All you have done is make a transistor with low gain and a slightly higher Vbe threshold than a normal transistor.
It's no better than @joeyd999 's circuit (post #7) and lacks reverse polarity protection (and negative spike protection) on the input.
In theory (and in fact) I'm with you. But I'm not really sure how to practically isolate the grounds as a practical matter. The 12V starts with 120VAC into a transformer/rectifier/regulator/filter arrangement and battery backup. Is there a way to isolate the 2 halves without duplicating the entire power supply including another backup battery?

Also (and I may be all wet here) with @joeyd999 's circuit (post #7), only 0.5ma is flowing through the window/door loops (although this could be increased). The opto-coupler loop has 12ma flowing. Would the "stiffer" supply to the loop reduce the sensitivity to induced noise on the loop?

If not, then I will use his suggestion.
 

Sensacell

Joined Jun 19, 2012
3,768
Opto
So does something like this make sense:

View attachment 329208
The system is powered by 12V, dropped down to 3.3V for the MCUs. All with a common ground.

I'm not really concerned with switch bounce, since any open switch in a window or door loop is all I need to trigger an alarm condition.

I think with the 1K resistor on the LED side I'm supplying enough current to drive the transistor but still staying well within the limits on the datasheet. On the transistor side, I'm thinking the 1K resistor should also provide enough current to put the transistor in saturation - but I'm not 100% sure on this.

Am I missing anything?
Optocouplers without isolation are just expensive PCB ornaments.
 

dendad

Joined Feb 20, 2016
4,635
Even with a common gnd, the opto will protect the input pretty well. A reverse diode across the opto LED may be a good idea, or better, use an opto with back to back internal LEDs , those optos are designed for AC input, and then the opto input is pretty well protected from reverse transients and connections
 
Top