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

Discussion in 'General Electronics Chat' started by Layan_AK, Jan 14, 2018.

  1. Layan_AK

    Thread Starter Member

    Mar 28, 2017
    66
    0
    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 :)
     
  2. ericgibbs

    Moderator

    Jan 29, 2010
    4,616
    896
    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
     
  3. Layan_AK

    Thread Starter Member

    Mar 28, 2017
    66
    0
    no other wiring close to cable ..

    it will be outdoor.

    what is the difference between twisted and screened ?

    regards :)
     
  4. ericgibbs

    Moderator

    Jan 29, 2010
    4,616
    896
    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
     
  5. Layan_AK

    Thread Starter Member

    Mar 28, 2017
    66
    0
    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 ?

    ^_^
     
  6. ericgibbs

    Moderator

    Jan 29, 2010
    4,616
    896
    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
     
  7. Layan_AK

    Thread Starter Member

    Mar 28, 2017
    66
    0
    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
     
  8. Dodgydave

    AAC Fanatic!

    Jun 22, 2012
    7,156
    1,173
    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.
     
  9. Layan_AK

    Thread Starter Member

    Mar 28, 2017
    66
    0
    thank you :)

    you mean like this ?
    kjkjo.png
     
  10. ericgibbs

    Moderator

    Jan 29, 2010
    4,616
    896
    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
     
    Layan_AK likes this.
  11. Sensacell

    Moderator

    Jun 19, 2012
    1,791
    514
    An opto isolator used in a non-isolated circuit is a bit of overkill.
    If you do use one, make it a slow, cheap one.
     
    Layan_AK likes this.
  12. Dodgydave

    AAC Fanatic!

    Jun 22, 2012
    7,156
    1,173
    Layan_AK likes this.
  13. Layan_AK

    Thread Starter Member

    Mar 28, 2017
    66
    0
    thanks a lot all :)

    can i use hall effect switch instead of reed switch with 15m distance ?

    regards :)
     
  14. ericgibbs

    Moderator

    Jan 29, 2010
    4,616
    896
    hi AK,
    Which type of Hall switch do you have in mind.?
    Part number or datasheet.
    E
     
  15. Layan_AK

    Thread Starter Member

    Mar 28, 2017
    66
    0
    UGN3013

    I want to build tipping bucket rain gauge ^^
     
  16. ericgibbs

    Moderator

    Jan 29, 2010
    4,616
    896
    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.
     
    Last edited: Jan 14, 2018
  17. GopherT

    AAC Fanatic!

    Nov 23, 2012
    8,029
    6,780
    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: Jan 14, 2018
  18. philba

    Active Member

    Aug 17, 2017
    961
    300
    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.
     
  19. MrChips

    Moderator

    Oct 2, 2009
    16,118
    4,932
  20. crutschow

    Expert

    Mar 14, 2008
    18,776
    5,239
    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.
     
    GopherT likes this.
Loading...