I have a reed switch (actually several reed switches) that came pre-installed in my home as alarm sensors. When the 2 parts are together, the circuit is closed, when the 2 parts are apart, the circuit is open. The sensors are in various parts of the home, so the leads can be varying size. They run through my attic, and they may be routed near appliances, ducting, and potentially 110V wiring. The cable itself seems to be CAT5 wire where 1 pair is used for each sensor. In some areas the sensors are actually in series to create a "zone" that would trigger if any sensor was opened.
I have these switches wired to my raspberry pi through the GPIO pins. One side is wired to a GND pin, the other side is wired to a GPIO pin. I do not have any external resistors or power sources in this circuit.
I initialize all of the GPIO pins with the code:
GPIO.setup(sensor,GPIO.IN, pull_up_down=GPIO.PUD_UP)
Then I monitor the state of the pins with the code:
current_state = GPIO.input(sensor)
The circuit works perfectly for several months, but then 1 of 2 things will happen:
The pin will begin to trigger false alarms, often several false alarms in succession followed by hours or days with no false alarms.
The pin will become stuck either high or low.
I am familiar with basic electrical engineering principles, and I cannot understand why this simple circuit seems to be destroying my raspberry pi pins. I have used (and damaged) several Raspberry Pi's and the result is always one of the 2 above.
I specifically wired them in this manner so that the circuit was connected to the ground pin and not the 3.3V pin on the Pi. My thought was that this would prevent any unintentional current draw. I've read about using external resistors, but I don't believe it is necessary in this circuit.
Any ideas what might be going wrong? I am much less worried about the false alarms and more worried about fixing the permanent damage I seem to be causing to the GPIO pins.