Arduino SA
  • Learn @ Arduino SA
  • Arduino Introduction
  • Support
    • Setup your Computer
    • Adding Libraries
    • Setting up a ESP32
  • Arduino Robot Car
    • Arduino Bluetooth Car
      • What you will need
      • Circuit Diagram
      • Assembly the Car
      • Upload the Code
      • Bluetooth setup and Test
    • 4WD Obstacle Avoidance
      • Introduction
      • Component List
      • Assembly
      • Component Description
      • Circuit Diagram
      • Computer Setup
      • Line Tracking Mode
      • Obstacle Avoidance Mode
  • Arduino Kits
    • Smart Plant Watering Kit
      • What you will need
      • Wiring Diagram
      • The Code
      • Pics
    • Basic Starter Kit
      • Component View
      • Installing the IDE
      • Add Libraries
      • Blink
      • Button Control LED Delay Switch
      • Active Buzzer
      • Passive Buzzer
      • Servo
      • IR Remote and Receiver
      • Stepper Motor
      • Eight LED with 74HC595
      • LCD
      • Digital tube with Traffic Light Experiment
      • Four digit tube display
      • LM35D Temperature Sensor
      • LDR 5516 experiment
      • Flame Sensor
      • 8 * 8 LED Module
      • Controlling Stepper Motor With Remote
    • Super Starter Kit
      • Tutorials
    • Best Beginner Kit for Arduino
      • Tutorials
    • Uno R3 RFID Kit
    • WIFI ESP32 IOT Kit
    • Arduino School STEM Kit
    • Arduino Ultimate Starter Kit
  • Blocking Coding Lessons
    • Beginner Lessons
      • Setting up mBlock
      • Blinking an LED
      • LED Switching
      • LED Chasing
      • Traffic Signal
      • Buzzer
      • Buzzer + Push Button
      • LED + Push Button
  • Sensor Kits
    • 37-in-1 Sensor Kit
      • Joystick
      • Relay
      • Big Sound
      • Small Sound
      • Tracking
      • Avoid
      • Flame
      • Linear Hall Sensor
      • Touch
      • Digital Temperature
      • Buzzer
      • Passive Buzzer
      • RGB LED
      • SMD RGB
      • Two-Color 5mm
      • Two Color 3mm
      • Reed Switch
      • Mini Reed
      • Heartbeat
      • 7 color flash
      • Laser emitter
      • PCB mounted push Button
      • Shock switch
      • Rotary encoder
      • Light Cup
      • Tilt Switch
      • Rolling ball tilt switch
      • Photoresistor
      • Temp and Humidity
      • Analog Hall
      • Hall Magnetic
      • Temp
      • Analog Temp
      • IR Emission
      • IR Receiver
      • Tap Module
      • Light blocking
Powered by GitBook
On this page
  • Component Required:
  • Connection Diagram:
  • Wiring schematic:
  • Physical wiring diagram:
  • Code:

Was this helpful?

  1. Arduino Kits
  2. Basic Starter Kit

Passive Buzzer

In this lesson, you will learn how to use a passive buzzer.

PreviousActive BuzzerNextServo

Last updated 3 years ago

Was this helpful?

The purpose of the experiment is to generate eight different sounds, each sound lasting 0.5 seconds: from Alto Do (523Hz), Re (587Hz), Mi (659Hz), Fa (698Hz), So (784Hz), La (880Hz), Si (988Hz) to Treble Do (1047Hz).

Component Required:

1x UNO R3

1 x Passive buzzer

1x F-M wires (Female to Male DuPont wires)

Passive Buzzer:

The working principle of passive buzzer is using PWM generating audio to make the air to vibrate. Appropriately changed as long as the vibration frequency, it can generate different sounds. For example, sending a pulse of 523Hz, it can generate Alto Do, pulse of 587Hz, it can generate midrange Re, pulse of 659Hz, it can produce midrange Mi. By the buzzer, you can play a song.

We should be careful not to use the UNO R3 board analog Write () function to generate a pulse to the buzzer, because the pulse output of analog Write () is fixed (500Hz).

Connection Diagram:

Wiring schematic:

Physical wiring diagram:

Code:

void setup()
{
}
void loop()
{
  for (int i = 200; i <= 800; i++) //Increase the frequency from 200HZ to 800HZ in a loop
  {
    pinMode(8, OUTPUT);
    tone(8, i); //Output frequency on port 8 delay(5);    //This frequency is maintained for 5 milliseconds
  }
  delay(4000);  //Hold for 4 seconds at the highest frequency
  for (int i = 800; i >= 200; i--)
  {
    pinMode(8, OUTPUT); tone(8, i);
    delay(10);
  }
}

You can also download the code below

391B
Passive_Buzzer.ino