Saturday, November 23, 2024

Police and Ambulance Siren Generation Using Arduino or Analog Circuit

ashwiniIn this article, you will learn to easily make an Ambulance or Police siren system using Development or Analog Circuit method.

Using Arduino While the siren on a police vehicle emits a frequency of 300Hz, the ambulance siren emits a frequency of 650 to 750 Hz.

So here, create a circuit and its relevant code such that it generates a sinusoidal wave of 300Hz.

- Advertisement -

Bill of materials

Coding

First, include the library called pitches.h into the code for generating the required sound frequency.

- Advertisement -

Then, define the pin numbers for the buzzer and the button (with which you can change the siren between an ambulance and a police vehicle).

Now, create a setup function to set the pin mode as output for buzzer and input for the button.

Next, create a loop function for button press and increase its value on every press. Using the if condition, switch the siren between police and ambulance.

For ambulance sirens, create a code for emitting an audio signal of frequency between 650Hz to 750 Hz and with a delay of 300.

For a faster siren sound, set a higher frequency range between 900 Hz and 1000 Hz.

As earlier mentioned, police vehicle sirens emit a frequency of 300Hz sinusoidal wave. Therefore, create a code for generating the same with a delay of a few seconds.

Connection

Connect the components as shown in the below diagram.

Ambulance & Police Siren Generation Using Arduino or Analog Circuit

Testing

Connect the Arduino to a power source of either 5V using a USB port or 9V using a barrel jack. Then press the button on the siren generation device to switch between the police and ambulance siren modes.

Download Code


Ashwini Sinha
Ashwini Sinha
A tech journalist at EFY, with hands-on expertise in electronics DIY. He has an extraordinary passion for AI, IoT, and electronics. Holder of two design records and two times winner of US-China Makers Award.

3 COMMENTS

  1. Hello. I am building a Pinewood Derby “Police” car. I found your code for the siren that really looks like it will work. I typed in the code just like yours except your code has #include “pitches”.h . I used #include . However my error is

    Police_siren_new:6:11: error: expected unqualified-id before ‘switch’
    const int switch=A1;
    ^~~~~~

    I have searched online for hours trying to find the solution but no luck. So now I’m sending you a request for help. Here is my whole code.

    #include

    const int buzz = 9;
    const int switch=A1;
    int sirenno = 0;

    void setup() {

    pinMode(13,1);
    pinMode(A1, INPUT);
    }

    void loop() {
    if(sirenno==1){//Ambulance
    tone(buzz,650,750);
    delay (300);
    tone(buzz,900,1000);
    delay (300);
    tone(buzz,650,750);
    delay (300);
    tone(buzz,900,1000);
    }
    if(sirenno==2){//police
    tone(buzz,300,345);
    delay (700);
    tone(buzz,300,345);
    delay (700);
    tone(buzz,300,345);
    delay (700);
    tone(buzz,300,345);
    }
    if(sirenno==3){//other Aert
    tone(buzz,300,345);
    }
    if(sirenno >=4){
    sirenno=0;
    }
    }

    Thanks in advance for your help. Perry

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics

×