Buzzer_using Bharat Pi

by bharatpi in Circuits > Arduino

69 Views, 1 Favorites, 0 Comments

Buzzer_using Bharat Pi

WhatsApp Image 2024-04-09 at 22.38.04_ee9081ef.jpg

A buzzer is an electrical device that produces a buzzing or humming sound when an electric current passes through it. It typically consists of a vibrating membrane or diaphragm that creates the sound. Buzzers are commonly used in alarm systems, electronic devices, appliances, and signaling devices to alert users of various events or conditions. They can vary in size, shape, and sound output depending on their intended application.

Supplies

WhatsApp Image 2024-04-09 at 22.41.30_10c42907.jpg

Bharat Pi Boards

https://bharatpi.net/

Jumper wires

Buzzer(HW-508)

Types of Buzzers

There are several types of buzzers, each with its own characteristics and applications. Here are some common types:

  1. Piezoelectric Buzzers: These buzzers generate sound through the piezoelectric effect, where a piezoelectric crystal vibrates when an electric current is applied to it. Piezoelectric buzzers are compact, lightweight, and have low power consumption. They are commonly used in electronic devices, alarms, and timers.
  2. Magnetic Buzzers: Magnetic buzzers use an electromagnet and a diaphragm to produce sound. When an electric current passes through the electromagnet, it attracts the diaphragm, causing it to vibrate and produce sound. Magnetic buzzers are often used in applications where a louder sound output is required, such as in industrial equipment and security systems.
  3. Mechanical Buzzers: Mechanical buzzers, also known as AC buzzers, consist of an electromechanical mechanism that produces sound through the rapid oscillation of a metal armature or reed. These buzzers are commonly used in older appliances, doorbells, and timers.
  4. Transducer Buzzers: Transducer buzzers are versatile devices that can produce sound by converting electrical signals into mechanical vibrations. They can be based on various technologies, including electromagnetic, piezoelectric, and electrodynamic principles. Transducer buzzers are used in a wide range of applications, including consumer electronics, automotive systems, and medical devices.
  5. Indicator Buzzers: Indicator buzzers are compact devices designed to provide audible alerts or indications in electronic equipment and control panels. They are often used in conjunction with other indicator lights or displays to provide both visual and auditory feedback.


Connection

Untitled Diagram.drawio (6).png

To connect a buzzer to a Bharat Pi board, you'll typically use one of the GPIO pins to control the buzzer. Here's a basic outline of how you can wire up a buzzer to Bharat Pi and control it using Arduino code:


Wiring:

  1. Connect one terminal of the buzzer to a GPIO pin on the Bharat pi (for example, GPIO pin 23).
  2. Connect the other terminal of the buzzer to a ground (GND) pin on the Bharat pi.
  3. Optionally, you might need a resistor in series with the buzzer to limit the current if the buzzer's voltage rating is lower than the output voltage of the GPIO pin.


Arduino Code

Screenshot 2024-04-09 225154.png

Write a simple Arduino sketch to control the buzzer. Below is a basic example

int buzzer =23 ; // set the buzzer control digital IO pin 
void setup() {
pinMode(buzzer, OUTPUT); // set pin 23 as output
 }
void loop() {
for (int i = 0; i < 80; i++) {
     digitalWrite(buzzer, HIGH); // make a sound
     delay(1); // send high signal to buzzer
     digitalWrite(buzzer, LOW); // delay 1ms
     delay(1); // send low signal to buzzer
                             }
 delay(50);
 for (int j = 0; j < 100; j++) {
     digitalWrite(buzzer, HIGH);  //make another sound
     delay(2);
     digitalWrite(buzzer, LOW); // delay 2ms
     delay(2);
                               }
 delay(100);
}

 code is a basic Arduino sketch designed to produce two different sounds using a buzzer connected to pin 23 of the Bharat Pi. Here's a breakdown of what each part of the code does:

  1. Setup:
  • Configures pin 23 (buzzer) as an output pin.
  1. Loop:
  • The loop contains two nested loops, each generating a different sound pattern.
  1. First Sound Pattern:
  • The first loop runs 80 times.
  • Inside the loop, it turns the buzzer on (HIGH) for 1 millisecond and then off (LOW) for another millisecond. This creates a quick, short sound.
  • After the loop, there's a delay of 50 milliseconds.
  1. Second Sound Pattern:
  • The second loop runs 100 times.
  • Inside the loop, it turns the buzzer on (HIGH) for 2 milliseconds and then off (LOW) for another 2 milliseconds. This creates a longer sound compared to the first pattern.
  • After the loop, there's a delay of 100 milliseconds.
  1. Repeat:
  • The loop continuously repeats, generating the two sound patterns alternately with their respective delays between them.


Application

Buzzers have a wide range of applications across various industries and everyday scenarios due to their ability to produce audible alerts or signals. Some common applications of buzzers include:

  1. Alarms and Security Systems: Buzzers are frequently used in alarm systems for buildings, homes, and vehicles. They can alert occupants in case of intrusion, fire, smoke, or other emergencies.
  2. Electronic Devices: Many electronic devices incorporate buzzers to provide auditory feedback or alerts. For example, they are used in timers, clocks, microwave ovens, washing machines, and kitchen appliances to signal the completion of a task or indicate an error.
  3. Industrial Equipment: In industrial settings, buzzers are used for signaling various conditions such as equipment malfunction, low fluid levels, or completion of a process. They are essential for maintaining operational safety and efficiency.
  4. Automotive Systems: Vehicles utilize buzzers for a range of purposes, including indicating open doors, seatbelt warnings, low fuel warnings, and parking sensor alerts. Buzzers can also be integrated into car security systems.
  5. Medical Devices: In healthcare settings, buzzers are used in medical equipment and devices to signal alarms for critical conditions, medication reminders, or patient monitoring systems.
  6. Consumer Electronics: Buzzers are commonly found in consumer electronics such as smartphones, tablets, and laptops. They provide notifications for incoming calls, messages, and other events.
  7. Game and Entertainment Systems: In gaming consoles, arcade machines, and amusement park attractions, buzzers are often used to enhance the gaming experience or signal specific events.
  8. Access Control Systems: Buzzers can be integrated into access control systems to provide audible feedback when granting or denying access to a secure area.
  9. Educational and Training Tools: Buzzers are used in educational settings for quizzes, trivia games, and classroom activities. They provide a fun and engaging way to interact with students and reinforce learning.
  10. Navigation and Wayfinding Systems: In public transportation terminals, airports, and other crowded environments, buzzers may be used to guide individuals with visual impairments or signal approaching departures.