Can I connect reed switch with microcontroller using 15 meter cable ?

Thread Starter

Layan_AK

Joined Mar 28, 2017
78
Hi all,

I want to connect reed switch with Microcontroller .
The distance between the switch and Mcu about 15 m .

Can I connect the switch with only pullup resistor to Mcu ?

Regards :)
 

ericgibbs

Joined Jan 29, 2010
8,848
hi AK,
Will the 15 mtr cables path be exposed to high external electrical noise/fields.?
ie: laid alongside other existing wiring .?
Will it be a twisted pair or screened cable.?
Indoors or Outdoors.

E
 

Thread Starter

Layan_AK

Joined Mar 28, 2017
78
hi AK,
Will the 15 mtr cables path be exposed to high external electrical noise/fields.?
ie: laid alongside other existing wiring .?
Will it be a twisted pair or screened cable.?
Indoors or Outdoors.

E
no other wiring close to cable ..

it will be outdoor.

what is the difference between twisted and screened ?

regards :)
 

ericgibbs

Joined Jan 29, 2010
8,848
hi,
A twisted cable is two conductors which are twisted at approx 5 turns per inch, along their full length.
This helps to reduce the electrical noise picked up by the cable from external electrical sources.

Screened cable can be a single conductor with an overall braided copper screen along it full length.
or twin conductors with braided screening.

You should consider if the wiring is out doors, the possibility of a lightning strike close by.

E
 

Thread Starter

Layan_AK

Joined Mar 28, 2017
78
hi,
A twisted cable is two conductors which are twisted at approx 5 turns per inch, along their full length.
This helps to reduce the electrical noise picked up by the cable from external electrical sources.

Screened cable can be a single conductor with an overall braided copper screen along it full length.
or twin conductors with braided screening.

You should consider if the wiring is out doors, the possibility of a lightning strike close by.

E
what is the best twisted or screened ?
how can prevent any noise or lighting strike to affect the mcu system ?
using twisted or screened enough ? Or there is a specific connection to do that ?

^_^
 

ericgibbs

Joined Jan 29, 2010
8,848
hi,
I would use twisted pairs, look at this diagram.
It will give some protection against over voltages and electrical noise.

It is almost impossible to protect against a direct strike, the keep the wiring out of trees etc.
E
 

Attachments

Thread Starter

Layan_AK

Joined Mar 28, 2017
78
hi,
I would use twisted pairs, look at this diagram.
It will give some protection against over voltages and electrical noise.

It is almost impossible to protect against a direct strike, the keep the wiring out of trees etc.
E
thanks alot eric :)

could you explain the purpose of this part of the circuit ?
also i need to read the switch as an interrupt ,should i use hardware debounce ?
regards :)

gggiiiooo.png
 

Dodgydave

Joined Jun 22, 2012
8,465
If you're worried about spikes and electrical interference, i would use an opto-couper to switch the pic pin, and let the reed switch feed the opto-couper using a two core screened cable.
 

ericgibbs

Joined Jan 29, 2010
8,848
hi AK,
This LTSpice simulation of the circuit I posted will help you visualise what those components are doing, ref image
The circuit will also de-bounce the uSw contact signal, to increase the de-bounce period increase C1 value, say to 47n

The sim shows 2 idealised interference pulses 0f +/-10v amplitude.

E
 

Attachments

ericgibbs

Joined Jan 29, 2010
8,848
hi AK,
The datasheet shows it as an open collector output, capable of operating from a 5V supply., switching close to 0V
I should try it.
E

EDIT:

I guess you know that the connecting cable will require 3 conductors?
Twin screened, one wire for +5V and another wire for the Output.
Screened overall as 0V Ground return.
Also add 1uF cap across the Hall device power rails at the remote Hall end of the cable.
 

Attachments

Last edited:

GopherT

Joined Nov 23, 2012
8,012
If your biggest concern is lightning, simply use a
- 5.6V zener to prevent over voltage from electrical interference,
- a "poly fuse" for over current (lightning)
- 22 gauge or smaller wire for connection to the sensor

22 gauge wire will fuse (melt) at less than 50 Amps which is well below the maximum current handing (100A) of the polyfuse.

F64DFD51-24D2-4AC9-A9F3-04EC5357EFC8.jpeg
 
Last edited:

philba

Joined Aug 17, 2017
960
Screened = shielded?

Frankly, lightning is going to take more protection than diodes, fuses or optos. Best bet for lightning is to provide a super low impedance path to earth (aka, lightning rod). Using the thin wires for the sensor is a good idea because, as pointed out above, they will fuse. But before they do, there's a good chance of damage from secondary effects so use some of the other things mentioned.

Here's Mouser's write up on the lightning topic. For the tl:dr folks, it says have a single, central, big fat direct connection to earth as a path for the lightening. Do not have multiple connections to earth.
 

crutschow

Joined Mar 14, 2008
23,486
A standard opto isolator by itself will likely not provide much protection against a direct lightning strike whose voltage could easily bridge the gap between the input and output pins.

You might add a lightning arrester circuit, such as used for TV or Ham coax cable, which use a gas tube spark gap to shunt away the high voltage pulse to ground.
The arrestor needs to be connected to a low impedance path to a ground rod, of course.
 
Top