Introduction:
We can use Arduino to make many interactive works of which the most commonly seen is acoustic-optic display. All the previous experiment has something to do with LED. However, the circuit in this experiment can produce sound. Normally, the experiment is done with a buzzer or a speaker while buzzer is simpler and easier to use. The buzzer we introduced here is a passive buzzer. It cannot be actuated by itself, but by external pulse frequencies. Different frequencies produce different sounds. We can use Arduino to code the melody of a song, which is actually quite fun and simple.
Specification:
- Working voltage: 3.3-5v
- Interface type: digital
- Size: 30*20mm
- Weight: 4g
Connection Diagram:
Sample Code:
int buzzer=8;//set digital IO pin of the buzzer void setup() { pinMode(buzzer,OUTPUT);// set digital IO pin pattern, OUTPUT to be output } void loop() { unsigned char i,j;//define variable while(1) { for(i=0;i<80;i++)// output a frequency sound { digitalWrite(buzzer,HIGH);// sound delay(1);//delay1ms digitalWrite(buzzer,LOW);//not sound delay(1);//ms delay } for(i=0;i<100;i++)// output a frequency sound { digitalWrite(buzzer,HIGH);// sound digitalWrite(buzzer,LOW);//not sound delay(2);//2ms delay } } }
After downloading the program, buzzer experiment will been finished.
Project List
- Arduino Mega 2560 Project 1: Piranha LED Module
- Arduino Mega 2560 Project 2:Digital white LED module
- Arduino Mega 2560 Project 3: Passive Buzzer module
- Arduino Mega 2560 Project 4: Hall Magnetic Sensor
- Arduino Mega 2560 Project 5: LM35 Linear Temperature Sensor
- Arduino Mega 2560 Project 6: DS18B20 Temperature Sensor
- Arduino Mega 2560 Project 7: Digital Tilt Sensor
- Arduino Mega 2560 Project 8: Photocell sensor
- Arduino Mega 2560 Project 9: Digital Push Button
- Arduino Mega 2560 Project 10: Capacitive Touch Sensor
- Arduino Mega 2560 Project 11: DHT11 Temperature and Humidity Sensor
- Arduino Mega 2560 Project 12: Analog Sound Sensor
- Arduino Mega 2560 Project 13: Flame Sensor
- Arduino Mega 2560 Project 14: DS3231 Clock Module
- Arduino Mega 2560 Project 15: Analog Gas Sensor
- Arduino Mega 2560 Project 16: Analog Alcohol Sensor
- Arduino Mega 2560 Project 17: Water Sensor
- Arduino Mega 2560 Project 18: Soil Humidity Sensor
- Arduino Mega 2560 Project 19: Infrared Obstacle Avoidance Sensor
- Arduino Mega 2560 Project 20: PIR Motion Sensor
- Arduino Mega 2560 Project 21: Joystick Module
- Arduino Mega 2560 Project 22: Photo interrupter module
- Arduino Mega 2560 Project 23: 5V Relay Module
- Arduino Mega Project 24: ADXL345 Three Axis Acceleration Module
- Arduino Mega 2560 Project 25: Rotary Encoder module
- Arduino Mega 2560 Project 26: Analog Rotation Sensor
- Arduino Mega 2560 Project 27: HC-SR04 Ultrasonic Sensor
- Arduino Mega 2560 Project 28: Pulse Rate Monitor
- Arduino Mega 2560 Project 29: Reed Switch Module
- Arduino Mega 2560 Project 30: TEMT6000 ambient light sensor