Simple buzzer interface to microcontroller

Simple buzzer interface to AT89C2051 microcontroller:


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


  • AT89C2051 microcontroller
  • Push button switch
  • Buzzer
  • Capacitors: 33pF,33pF,10uF
  • Resistor 8.2KΩ

Circuit diagram:

A circuit diagram for interfacing buzzer to microcontroller is shown in 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 logic high by the pull up resistor.

simple buzzer interface circuit diagram

simple buzzer interface circuit diagram

simple buzzer interface

simple buzzer interface

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.


You may also like:

LED Dice using microcontroller


Four way traffic light controller Mini-project

Plant watering watcher circuit ( mini-project )

Knight rider light ( LED ) with Pic16F84A

fastest finger first indicator project