5% OFF Over $19, Code: Elephant5; 10% OFF Over $59, Code: Elephant10



Arduino UNO R3/MEGA 2560 R3 Project 7: Active Buzzer

Posted by Fiona Su on

Introduction

Active buzzer is widely used as a sound making element on computer, printer, alarm, electronic toy, telephone, timer, etc. It has an inner vibration source. Simply connect it with 5V power supply, it can buzz continuously.

thumb
Hardware List

  • Buzzer*1
  • Control board*1
  • Breadboard*1
  • Breadboard jumper wire*2

Video Tutorial

Connection

Connection for REV4:

thumb

Connection for 2560 R3:

thumb

When connecting the circuit, pay attention to the positive and the negative poles of the buzzer.
In the photo, you can see there are red and black lines. When the circuit is finished, you can begin the programming.

Sample Code:

Program is simple. You can control the buzzer by outputting high/low level.

int buzzer=8;// initialize digital IO pin that controls the buzzer
void setup() 
{ 
  pinMode(buzzer,OUTPUT);// set pin mode as “output”
} 
void loop() 
{
digitalWrite(buzzer, HIGH); // produce sound
}

Result:

After downloading the program, the buzzer experiment is completed. You can see the buzzer is ringing.

All Tutorial

Buy 

0 comments

Leave a comment

Please note, comments must be approved before they are published