Introduction: Anti-doorbell

The Arduino project creates a way to prevent a doorbell from activating continually when the doorbell is pressed. The code is really simple to follow.

Supplies

One installed doorbell system (represented by a four pushbutton or single wire)

One Arduino

One 5V relay module

One 3 pin cable

Step 1: Relay Attachment

Setup Arduino with the relay on the pin defined, for this example it is pin 13, this pin also lights the built in led, good for testing relay signal.

Step 2: Test Circut

Program the Arduino with following code and attach test pushbutton or wire connected to pin 2 to simulate doorbell. When delay times are to your likening prosed.


// copy and paste the following into a new Arduino IDE Sketch

// constants won't change. They're used here to set pin numbers:

const int buttonPin = 2;   // the number of the pushbutton pin

const int ledPin = 13;   // the number of the LED pin


// variables will change:

int buttonState = 0;     // variable for reading the pushbutton status


void setup() {

 // initialize the LED pin as an output:

 pinMode(ledPin, OUTPUT);

 // initialize the pushbutton pin as an input:

 pinMode(buttonPin, INPUT_PULLUP);

 digitalWrite(ledPin, LOW);

}


void loop() {

 // read the state of the pushbutton value:

 buttonState = digitalRead(buttonPin);


 // check if the pushbutton is pressed. If it is, the buttonState is HIGH:

 if (buttonState == LOW) {

  // turn LED on:

  digitalWrite(ledPin, HIGH);

  delay(2000);

  digitalWrite(ledPin, LOW);

  delay(1000);

  digitalWrite(ledPin, HIGH);

  delay(2000);

  digitalWrite(ledPin, LOW);

  delay(60000); // 60000 = One Minute

 }

}

Step 3: Cable Prep

If you have crimp connectors prep your cable by cutting one wire or tin the tips with solder, preferably the positive or hot side.

Microcontroller Contest

Participated in the
Microcontroller Contest