How to Interface Buzzer with Microcontroller Electronics Project

Function


This project shows how to interface a buzzer to the microcontroller. When a push button has pressed a buzzer will on and off 30 times and then stops.

Components



  • AT89C2051 microcontroller

  • Push button switch

  • Buzzer

  • Capacitors: 33pF,33pF,10uF

  • Resistor 8.2KO


Circuit diagram


A circuit diagram for interfacing buzzer to the microcontroller is shown in the figure below. Bit 7 of port 1 is directly connected to a small buzzer. This type of connection is possible only when the current required for the buzzer is less than 20mA. The port output is in current source mode so that the buzzer will turn on when the output is at logic LOW. Bit 0 of port 3 is connected to the push button switch which is held at a logic high by the pull-up resistor.




[caption id="" align="aligncenter" width="490"]simple buzzer interface circuit diagram simple buzzer interface circuit diagram[/caption]







[caption id="" align="aligncenter" width="490"]simple buzzer interface simple buzzer interface[/caption]



Program description


The buzzer is initially OFF. When the push button is pressed, the buzzer is turned ON and OFF 30 times, with a one second delay between each output.

Download


Click here to download .C and .HEX file

You may also like



If you like this article, please share it with your friends and like or facebook page for future updates. Subscribe to our newsletter to get notifications about our updates via email. If you have any queries, feel free to ask in the comments section below. Have a nice day!