I am trying to connect my raspberry pi to my hardwired doorbell in order to send a text message when the doorbell button is pushed. I have successfully sent the text message using a button connected to the breadboard but I am unable to do so when connecting the breadboard with resistors and raspberry pi to the cables wired to the doorbell itself. I believe this is due to the circuit and not the software.

My thinking was that since the doorbell has its own button, I should be able to replace the button on the breadboard with the doorbell button itself. The difference however, is that the doorbell button emits its own voltage.

I am currently using this example (minus the LED): circuit

How should I be wiring my doorbell to the rpi, which emits a voltage of approximately 3V when the doorbell button is pushed after the current has passed through the resistors?

If interested, here is my code:

var Gpio = require('onoff').Gpio,
button = new Gpio(4, 'in');

button.watch(function (err, value) {
  if (err) {
    throw err;

//Twilio credentials required to send text message omitted

process.on('SIGINT', function () {

I am using onoff and writing this in JavaScript.

  • Can you determine if the doorbell uses AC or DC?
    – linhartr22
    Oct 10, 2017 at 18:33
  • the doorbell uses AC
    – Matt
    Oct 10, 2017 at 20:15
  • Is this still an open question?
    – Ingo
    May 14, 2020 at 11:48

2 Answers 2


If it were me, I'd be looking to connect the door bell power to a relay then replace your pushbutton using the relay contacts. Much safer and isolates your rpi from any nastiness on the doorbell power. You'll need to know the doorbell's voltage and if it is AC or DC to get the correct relay.


They make devices called bidirectional opto couplers. They are about the same as the others but they put two back to back LEDs in it so it will conduct in either AC quadrant. There is a nice circuit posted at: "https://electronics.stackexchange.com/questions/597226/optimal-lda210-optocoupler-circuit-for-mains-detection" by Carlos Garcia. There is also some good discussion with it. He is connecting to the mains but for the doorbell you would just lower the resistor value for the LEDs.

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.