Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

How to Interface Buzzer with LPC2148- (Part 4/9)

By Dishant Shah

A buzzer or beeper is an audio signal generator typedevice, which may be mechanical, electromechanical or piezoelectric depending upon the operating principle of the device. Buzzers are widely used in alarm devices, timers and confirmation of user input such as a mouse click or keystroke.

In embedded systems, buzzer is widely used to notify various events such as interrupt generation, end of any process or as an alarming on emergency situation such as detection of fire, exceeding radiation in nuclear reactor plant etc.

This section aims to explain how to interface buzzer with LPC 2148.

[[wysiwyg_imageupload:11323:]]

 Fig. 1: Interface Buzzer with LPC2148 Prototype

 


In embedded system applications, buzzer is interfaced with micro-controller and alarming signal is generated. On micro-controller pin, controlling signal is generated by means of programming. Buzzers operating at 5V are widely available. But LPC2148 operates at 3.3V. So we need a buck converter which will convert 3.3V into 5V.

 

To designthe driver circuit, we have following options.

1.      Transistor as a switch

2.      Use of audio amplifier in designing the driver

Let us study how we can design circuits for above options.

1.      Transistor as a switch

Introduction to BIPOLAR JUNCTION TRANSITORS- BJT

BJT is designed by sandwiching one layer of P or N type by two layers of opposite type. Depending upon the construction, there as two types available, NPN and PNP.

Three sections of BJTs are known as BASE, EMITTER and COLLECTOR.

BJT operates in three regions.

1.      Cut-off Region

2.      Saturation region

3.      Linear region

 

Characteristic curve of BJT is as shown in figure.

Characteristic Curve of BJT

Fig. 2: Characteristic Curve of BJT

We can configure BJT to operate in any of the above region by proper biasing.

When operated in LINEAR or ACTIVE region, BJT works as an amplifier. To use BJT as a switch, we have to configure it to operate in cut off and saturation region. In cut off region, IDEAL BJT acts as OPEN circuit and in saturation region it acts as short circuit.

Practical BJT offers very high resistance in cut off region and very low resistance in saturation region.

Circuit to bias BJT as a switch is as shown in figure.

Circuit to Bias BJT as Switch

Fig. 3: Circuit to Bias BJT as Switch

Here Relay is used as LOAD. Any load like MOTOR, BUZZER etc. can be operated by relay. D1 is fly back diode which is must while operating coil based device such as relay and motor to prevent back EMF generated during operation.

Following table explains the working of above circuit.

INPUT

BJT OPERATIONAL REGION

BJT ACTS AS

OUTPUT

0 Volt

Cut off

Open circuit

Load is disconnected

3.3 Volt

Saturation

Short Circuit

Load is connected

From the above table, it is clear that when we will put logic 1 on pin of LPC 2148, buzzer will sound and logic 0 on pin stops the buzzing sound from buzzer.

 

Disadvantages:

Above described system offers following disadvantages.

1.      When BJT is not in complete OFF stage, it will create low intensity sound.

2.      Stability of above circuit is not very high. Variation in atmosphere, components value and aging effect on components may affect the working of the system.

Considering above factors, we have another mechanism in which we will use comparator IC for better reliability and stability as explained below.

Schematic for this is as shown below:

Circuit Diagram of BJT with Comparator IC

Fig. 4: Circuit Diagram of BJT with Comparator IC

2.      Use of Audio amplifier to design driver circuit

LM386 is specially designed audio amplifier IC. Pin configuration of LM 386 is as follows.It operates in differential mode and amplifies the difference between two input signals on pin 3 and pin 2. Gain of this amplifier is controlled by pin 8.

Audio Amplifier to Design Driver Circuit

Fig. 5: Audio Amplifier to Design Driver Circuit

Complete connection for our application is as given in following schematic.

Circuit Diagram of Buzzer Interfaced with LPC2148

Fig. 6: Circuit Diagram of Buzzer Interfaced with LPC2148

LM386 has been configured in such a way that when we will provide logic 1on P0.8 pin, buzzer will make sound. Buzzer of 8 ohm input impedance is best suitable for this application.

Once the above connections are done, let us start with programming.

 

Follow the given steps.

1.      Make P0.7 to operate as GPIO pin using PINSEL.

2.      Configure PO.7 as output pin using IO0DIR.

3.      Provide signals on P0.7 to control buzzing sound from buzzer.

We have provided a time varying control signals to demonstrate the generation of various frequency tones from buzzer. At the same time we are flashing LEDs connected at P1.16-P1.23 so that we can see effect of varying frequency. 

 

Project Source Code

###

#include<lpc21xx.h>
void delay(unsigned long cnt)

{
            unsigned long temp,val;

            for(temp=0;temp<cnt;temp++)

            for (val=0;val<10;val++);
}

int main(void)

 {
            unsigned int i;

            IO0DIR = 0Xffffffff;

            IO1DIR=0Xffffffff;

            while(1)

            {
                        for (i=0;i<10000;i=i+100)

                        {
                                    IO0SET = 0X00000080;

                                    IO1SET = 0X00ff0000;

                                    delay(i*10);

                                    IO0CLR = 0X00000080;

                                    IO1CLR = 0X00ff0000;

                                    delay(i*10);

                        }

                        for (i=10000;i>0;i=i-100)

                        {

                                    IO0SET = 0X00000080;

                                    IO1SET = 0X00ff0000;

                                    delay(i*10);

                                    IO0CLR = 0X00000080;

                                    IO1CLR = 0X00ff0000;

                                    delay(i*10);

                        }

            }

}

 

###

 


Project Video


Filed Under: ARM

 

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • PS2 Keyboard To Store Text In SD Card Using Arduino Circuit Setup On Breadboard
    How To Use PS2 Keyboard To Store Text In SD Card Using Arduino- (Part 42/49)
  • Wireless Path Tracking System Using Mouse, XBee And Arduino Circuit Setup On Breadboard
    How To Make A Wireless Path Tracking System Using Mouse, XBee And Arduino- (Part 43/49)
  • How to Make a Wireless Keyboard Using Xbee with Arduino- (Part 44/49)
  • Making Phone Call From GSM Module Using Arduino Circuit Setup On Breadboard
    How to Make Phonecall From GSM Module Using Arduino- (Part 45/49)
  • How to Make a Call using Keyboard, GSM Module and Arduino
    How To Make A Call Using Keyboard, GSM Module And Arduino- (Part 46/49)
  • Receiving SMS Using GSM Module With Arduino Prototype
    How to Receive SMS Using GSM Module with Arduino- (Part 47/49)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • Renesas and Cyberon to deliver integrated voice-user interface solutions
  • STMicroelectronics releases Bluetooth SoC with location tracking
  • Infineon launches AI/ML-based sensor fusion alarm system
  • Renesas delivers intelligent sensor solutions for IoT applications
  • Microchip Technology releases AVR-IoT Cellular Mini Development Board

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Holding an SMPS Former to PCB with fishing line?
  • D Flip Flop frequency divider
  • Limits of duty cycle for ICM7555 IC?
  • 12V 5A needed
  • Characterization values of a MOSFET in PDK

RSS Electro-Tech-Online.com Discussions

  • writing totals in Eprom
  • ICM7555 IC duty cycle limit at high frequency?
  • undefined reference header file in proteus
  • How to test phone socket?
  • intro to PI
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering