5

I did some searching and found a few topics related to this, but most seemed pretty old and I didn't get a clear answer. My hardware/circuits knowledge is pretty basic, so please bare with me.

I have a Pi 2 B. I would like to receive input from a magnetic reed switch attached to my garage door as well as send output signals to a relay to open my garage door. The problem is, I do not want to move my Pi out to the garage for this. I would like to keep it here in my office and route a wire through the wall/attic. My guess is this would be about 50ft of wiring.

If any, what are the challenges/problems with trying to do this? If so, what are the solutions? How long of a wire can I run from a GPIO pin without causing problems for receiving input and sending output? Thanks!

  • This isn't a Pi specific problem. Any microcontroller or computer could be substituted for the Pi. Perhaps an electrical site would be a better forum? – joan May 16 '15 at 13:47
  • see the video youtube.com/watch?v=i4T09K7U7cs – Mapperz May 16 '15 at 14:14
7

It all depends on the size of wire and the length. There are numerous online calculators that can give you the Ohmic resistance of a given wire length and thickness (AWG-gauge in the US). For a 50ft 24 AWG wire that resistance is about 1.2 Ohm. Using Ohm's law you can find out the voltage drop this would give in series with the reed switch (assuming you know its characteristics) - so you can make sure the resulting voltage at the GPIO pin is still within the threshold for a high signal.

I doubt that 50 ft is going to be a problem though. Plus, you can always try it out, just make sure you unwind the wire to avoid inductive effects. 50ft of wire shouldn't be too expensive to procure.

1

You should have no problems provided you minimise potential interference and wire gauge should not be an issue.

Connect to the Pi GND as common NOT the +3.3v rail.  
Take measures to reduce interference. E.g. use twisted pair (or shielded cable) 
Use low impedance circuitry e.g. a low value pullup e.g. 1kΩ.

see https://raspberrypi.stackexchange.com/a/24899/8697

-1

Although this is not Raspberry Pi specific question here is the answer. You need to use line driver IC. Something like that.

  • No, you don't. A reed switch has absurdly low bandwidth needs. – Chris Stratton May 16 '15 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.