Ambulance Sound Generator Using Arduino Uno

by Supernova09 in Circuits > Arduino

68 Views, 0 Favorites, 0 Comments

Ambulance Sound Generator Using Arduino Uno

7747e119-b119-4715-aa5d-1c5ef9dcfdcb.png
Ambulance Sound Generator #Coding #Programming #EmbeddedSystems #IoT #Tinkercad

Want to make your Arduino produce a realistic ambulance siren? In this beginner-friendly project, you'll learn how to generate an emergency vehicle sound using a passive piezo buzzer and the Arduino tone() function.

This project is ideal for beginners exploring:

  1. Sound generation with Arduino
  2. Using the tone() function
  3. Frequency control
  4. Basic electronics
  5. Arduino programming

By the end of this tutorial, your Arduino will continuously generate a realistic ambulance siren that smoothly rises and falls in pitch.

Supplies

Quantity Component

1 Arduino Uno

1 Passive Piezo Buzzer

1 Breadboard

2 Jumper Wires

1 USB Cable

Understanding the Project

The Arduino rapidly changes the buzzer frequency.

600 Hz
700 Hz
900 Hz
1200 Hz
1600 Hz
1400 Hz
1100 Hz
800 Hz
600 Hz
Repeat

This changing frequency creates the familiar ambulance siren effect.

Wiring Diagram

Screenshot 2026-06-27 002141.png

Wiring Diagram

Arduino UNO

D8 ---------------------- (+) Passive Buzzer

GND --------------------- (-) Passive Buzzer


Assemble the Hardware

  1. Place the passive buzzer on the breadboard.
  2. Connect the positive (+) terminal to Arduino digital pin D8.
  3. Connect the negative (-) terminal to GND.
  4. Connect the Arduino to your computer using the USB cable.

Your hardware is now ready.

Install Arduino IDE

If you haven't already:

  1. Download and install the Arduino IDE.
  2. Open the Arduino IDE.
  3. Connect your Arduino Uno.


Configure Arduino IDE

Select the correct board:

Tools → Board → Arduino Uno

Select the correct COM port:

Tools → Port → COMx

Replace COMx with your Arduino's port.

Upload the Code

Copy and paste the following sketch into Arduino IDE.


/*
Ambulance Sound Generator
Uses a Passive Piezo Buzzer
*/

const int buzzer = 8;

void setup()
{
pinMode(buzzer, OUTPUT);
}

void loop()
{
// Rising siren
for (int freq = 600; freq <= 1600; freq += 10)
{
tone(buzzer, freq);
delay(8);
}

// Falling siren
for (int freq = 1600; freq >= 600; freq -= 10)
{
tone(buzzer, freq);
delay(8);
}
}

Click Verify (✓) and then Upload (→).

Within a few seconds, the Arduino will begin producing the siren sound.

Understanding the Code

Define the Buzzer Pin


const int buzzer = 8;

The buzzer is connected to digital pin 8.

Setup Function


pinMode(buzzer, OUTPUT);

Configures the buzzer pin as an output.

Rising Frequency


for(int freq=600; freq<=1600; freq+=10)

The tone gradually increases from 600 Hz to 1600 Hz.

Higher frequency means a higher-pitched sound.

Falling Frequency


for(int freq=1600; freq>=600; freq-=10)

The tone smoothly decreases back to 600 Hz.

This completes one siren cycle.

Generate the Tone


tone(buzzer, freq);

The tone() function outputs a square wave at the specified frequency to the passive buzzer.

Hear the Output

Your buzzer should produce:

Low Pitch
Medium Pitch
High Pitch
Medium Pitch
Low Pitch
↺ Repeat

The result closely resembles an ambulance or emergency vehicle siren.

Customize the Siren

Faster Siren

Reduce the delay:


delay(5);

The siren changes pitch more quickly.

Slower Siren

Increase the delay:


delay(15);

The siren changes pitch more slowly.

Higher Pitch

Change the frequency range:


for(int freq=900; freq<=2200; freq+=10)

Produces a sharper, higher-pitched siren.

Lower Pitch

Use:


for(int freq=300; freq<=1000; freq+=10)

Produces a deeper siren sound.

Troubleshooting

No Sound

  1. Ensure you are using a Passive Piezo Buzzer.
  2. Verify the positive terminal is connected to D8.
  3. Check the GND connection.
  4. Confirm the code uploaded successfully.

Constant Beep

You're likely using an Active Buzzer.

Replace it with a passive piezo buzzer.

Upload Error

  1. Select the correct board (Arduino Uno).
  2. Select the correct COM port.
  3. Ensure the USB cable supports data transfer.


Project Enhancements

Once the basic siren is working, try adding:

  1. 🚨 Red and blue flashing LEDs synchronized with the siren
  2. 🔘 Push button to turn the siren ON/OFF
  3. 🎚️ Potentiometer to adjust siren speed
  4. 📺 OLED display showing siren status
  5. 📡 Bluetooth control using an ESP32
  6. 🚑 A miniature emergency vehicle model with lights and sound


Applications

This project can be used in:

  1. STEM and electronics education
  2. Arduino beginner workshops
  3. Science fair demonstrations
  4. Toy vehicle projects
  5. Robotics competitions
  6. DIY alarm systems
  7. Emergency vehicle simulations


Conclusion

You have successfully built an Ambulance Sound Generator using an Arduino Uno and a passive piezo buzzer. This simple project introduces sound generation, frequency control, and the tone() function—essential concepts for creating alarms, notifications, musical devices, and interactive electronics. Once you've mastered this project, you can combine it with LEDs, sensors, or wireless modules to create even more exciting Arduino projects.

Happy Making! 🚑🔊