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.
- AT89C2051 microcontroller
- Push button switch
- Capacitors: 33pF,33pF,10uF
- Resistor 8.2KO
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.
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.
Click here to download .C and .HEX file
You may also like
- LED Dice using microcontroller
- DTMF Decoder
- Four-way traffic light controller Mini-project
- Plant watering watcher circuit ( mini-project )
- Knight rider light ( LED ) with Pic16F84A
- fastest finger first indicator project
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!