Introduction: Make Doorbell Using Piezoelectric Buzzer

Picture of Make Doorbell Using Piezoelectric Buzzer

Welcome Back Makers!

In this Instructable, we will see how to use piezoelectric buzzer and a push button.

When the push button is pressed, the buzzer will give alarm indicating to open the door.

So, let's get started!!

Step 1: Components Needed

Picture of Components Needed

All That You Need

Hardware Required

  • NodeMCU
  • Push Button
  • 10K ohm resistor
  • Bread Board
  • Micro USB cable
  • Connecting Wires

Software Required

  • Arduino IDE (with ESP8266 Library installed)

Note: You can connect the Buzzer directly to the Microcontroller if you wanted to, or you can connect a 100 ohm resistor in series with the buzzer.

Step 2: Description

Picture of Description

Piezo buzzer is an electronic device commonly used to produce sound.

What is Piezo?

Piezo is the phenomena of generating electricity when mechanical vibration is applied to certain materials. Such materials are called piezoelectric materials.

Therefore, when buzzer is subjected to an electric field they vibrate with certain frequency thereby producing sound. Frequency of vibration depends upon the material used inside the material.

Step 3: Wiring Conections

Picture of Wiring Conections

The Connections are pretty simple.

Push Button connections :
The first pin goes from one leg of the pushbutton through a pull-up resistor (here 10K Ohms) to the 5v supply.

The second pin goes from the corresponding leg of the pushbutton to Ground (GND) pin.

The third pin connects to a Digital I/O pin (here pin D0) which reads the button's state.

Buzzer connections :

Buzzer Anode (RED) is connected to Digital I/O pin (here pin D1) and Cathode (BLACK) to ground (GND) pin.

Get ready to Code.

Step 4: Code Is Here

const int buzzer = 5;

const int button = 16;

int temp = 0;
void setup() {

  Serial.begin(9600);
  pinMode(buzzer, OUTPUT);
  pinMode(button, INPUT);

}
void ring() {                  // You can tinker with this loop to make your own tone.

  digitalWrite(buzzer, HIGH);
  delay(500);
  digitalWrite(buzzer, LOW);
  delay(500);
  digitalWrite(buzzer, HIGH);
  delay(500);
  digitalWrite(buzzer, LOW);
  delay(500);
  digitalWrite(buzzer, HIGH);
  delay(500);
  digitalWrite(buzzer, LOW);
  delay(500);
  digitalWrite(buzzer, HIGH);
  delay(500);
  digitalWrite(buzzer, LOW);
  delay(500);
  digitalWrite(buzzer, HIGH);
  delay(500);
  digitalWrite(buzzer, LOW);
  delay(500);
  digitalWrite(buzzer, HIGH);

}
oid loop() {

  temp = digitalRead(button);
     
     if (temp == HIGH) {
        ring();                                     // function call RING to make the tone.
        Serial.println(" Please Open the Door ");
        delay(1000);
       }
     else {
        digitalWrite(buzzer, LOW);
        Serial.println(" Ring the Bell ");
        delay(1000);
       }
}

Download the "Buzzer_NodeMCU.ino" file and open it up in the Arduino IDE.

Then Create a new sketch and paste the code below in the Arduino IDE and hit Upload. You can tinker with it if you like based on the application, or just use it as it is.

Step 5: Output

Picture of Output

That's all Makers.

You have successfully completed another instructable, It takes pretty less time to create this instructable, and its fun too.

Comments

About This Instructable

713views

21favorites

License:

Bio: Work until you no longer have to introduce yourself.
More by TheCircuit:Carrot Almond MilkshakeDIY - Flower VasePotato Stuffing - Who's Hungry
Add instructable to: