Advertisement
Arduino Siren Alarm

Arduino Siren Sound Alarm

Now it is very easy to build your own siren sound alarm, small enough to be carried in a garment pocket. This powerful audio-visual alert device is realized using the renowned Arduino platform. The 9V battery powered circuit produces a loud, wailing sound as a warning signal. As well, one red-colored LED (shines like a beacon) provides the visual alert. After construction and testing, you can re-build the whole circuit in a small veroboard, with the help of one pre-programmed Arduino chip (Atmega328P-PU)! For more details about this, go to Arduino PWM Led article.

Arduino Siren Alarm

Code of this little project is also very simple so that you can tinker the sketch without too much difficulty. If you are ready to construct this project on a veroboard, it is easy to operate from any 12V automobile battery. Further, you can add extra power to the LED Flasher and the PiezoSpeaker using suitable mosfet drivers, operated on the 12VDC input supply as shown in the basic indicative diagram inserted below.

piezo driver

Arduino Siren Sound Sketch Code

/*
PORTABLE SIREN
Arduino-Producing a wailing sound as a loud warning signal
LED Flsher for Visual Alert
source: http://www.electroschematics.com/9548/arduino-siren-sound-alarm/
*/

#define LEDFLASHER 3
#define ALARMSOUNDER 5 
#define ALARMSWITCH 8
int i = 0; 
int val = LOW; 
int pre_val = LOW; 
int state = 0; 
void setup()
{
    pinMode(LEDFLASHER, OUTPUT); 
    pinMode(ALARMSOUNDER, OUTPUT); 
    pinMode(ALARMSWITCH, INPUT); 
}
void loop()
{
    state = digitalRead(ALARMSWITCH);
    if (state == 1)
    {
        for(i = 0; i < 255; i = i + 2)
        {
            analogWrite(LEDFLASHER, i);
            analogWrite(ALARMSOUNDER, i);
            delay(10);
        }
        for(i = 255; i > 1; i = i - 2)
        {
            analogWrite(LEDFLASHER, i);
            analogWrite(ALARMSOUNDER, i);
            delay(5);
        }
        for(i = 1; i <= 10; i++)
        {
            analogWrite(LEDFLASHER, 255);
            analogWrite(ALARMSOUNDER, 200);
            delay(100);
            analogWrite(LEDFLASHER, 0);
            analogWrite(ALARMSOUNDER, 25);
            delay(100);
        }
    }
    else
    {
        analogWrite(ALARMSOUNDER, 0);
        analogWrite(LEDFLASHER, 0);
    }
    pre_val = val; 
}

3 Comments

Join the conversation!

Error! Please fill all fields.
  • stan_nickelhotmail-com

    I tried it, and it works quite well. Problem is that I am seriously hearing challenged and I have a very hard time hearing piezo noises. What would it take to do a speaker-based system. A “loud” speaker!

  • haressh

    please tell me the components needed for this project..please help am doing this for mmy project.

  • ariffazami

    Hi, im ariff. i am interested to do this project. Can you help me by listing all the components that i may need in order to do this project. thankyou.

Looking for the latest from TI?