Trying to setup my door bell using raspberry PI B+, the input from the door bell stays at 0 DC and turns to 2.9v when the switch is pressed, I'm using the following python code to detect this activity

GPIO.set(13, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
    while True:
        if (GPIO.input(13)==GPIO.HIGH:
            print time.strftime("%H:%M:%S")
except KeyboardInterrupt:

the problem i'm getting is that even no one press the doorbell switch, randomly, around once per 10~20seconds, my Pi detects a GPIO.HIGH, thus, my doorbell project failed :-(

Any ideas?

PS: I used my multimeter to make sure my input is correct from doorbell, it read 0~0.01 in a steady 5 mins, while my Pi still gives me random GPIO.HIGH reads every 10~20 seconds in the same period.

1 Answer 1


Interference? Perhaps the long wires are bringing up noise beyond the ability of the internal pull-down resistor to suppress. Try something like a 5-10k external resistor pull-down on the GPIO.

  • Indeed. Break the problem down to debug it: disconnect the cable from the Pi, see if it still happens.
    – Mark Smith
    Oct 8, 2016 at 20:19
  • if i disconnect the cable, it stays at low, Pi triggers the GPIO.HIGH only if I connect that two wires from the doorbell, but the multimeter always reads 0 from the doorbell wire
    – Joe Lu
    Oct 9, 2016 at 1:35
  • I will add a 5k resistor to see what happen tomorrow, tks for the quick reply Joan
    – Joe Lu
    Oct 9, 2016 at 1:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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