How to Make a Siren Using Arduino

My project is a button controlled siren with different LED transitions. You can change the siren sound with each press.

Feb 17, 2018

79431 views

21 respects

Components and supplies

1

Pushbutton switch 12mm

10

LED (generic)

1

Resistor 100 ohm

1

Breadboard (generic)

1

Jumper wires (generic)

10

Resistor 221 ohm

1

Buzzer

1

9V battery (generic)

1

Resistor 10k ohm

1

Arduino UNO

Project description

Code

Siren Code Arduino

Here is the code!

Latest commit to the master branch on 11-02-2018

Siren Code Arduino

Here is the code!

Latest commit to the master branch on 11-02-2018

Downloadable files

Circuit & Connections

STEP A: (Connecting LED) As we are basically building a siren, red and blue flashes look cool. So take 5 red and 5 blue LEDs. Now, connect the negative terminal of these LEDs with a 220 ohm resistor (current limiting) to the negative rail of the breadboard as shown in the circuit diagram. Positive ends of red LEDs are connected to pin 3 to pin 7, while the positive ends of blue LEDs are connected to pin 8 to pin 12 of Arduino's digital pin. STEP B: (Connecting Piezo Buzzer) Now, it's time to connect our buzzer and the pushButton to the breadboard. Connect the Piezo buzzer with a 100 ohm resistor to the negative rail and positive end of buzzer connected to pin 13. STEP C: (Connecting pushButton) Connect one out of four pins of pushButton with pin 2 and connect down it to GND rail using a pull down resistor of 10k ohm. Connect 5V with another button pin as shown in the circuit diagram.

Circuit & Connections

Circuit & Connections

STEP A: (Connecting LED) As we are basically building a siren, red and blue flashes look cool. So take 5 red and 5 blue LEDs. Now, connect the negative terminal of these LEDs with a 220 ohm resistor (current limiting) to the negative rail of the breadboard as shown in the circuit diagram. Positive ends of red LEDs are connected to pin 3 to pin 7, while the positive ends of blue LEDs are connected to pin 8 to pin 12 of Arduino's digital pin. STEP B: (Connecting Piezo Buzzer) Now, it's time to connect our buzzer and the pushButton to the breadboard. Connect the Piezo buzzer with a 100 ohm resistor to the negative rail and positive end of buzzer connected to pin 13. STEP C: (Connecting pushButton) Connect one out of four pins of pushButton with pin 2 and connect down it to GND rail using a pull down resistor of 10k ohm. Connect 5V with another button pin as shown in the circuit diagram.

Circuit & Connections

Hardware Required

Hardware Required

Comments

Only logged in users can leave comments

taz108am

4 months ago

Well, spent most of my morning building the breadboard and connecting to my Uno. Then another longer than needed time to get the coding into the ide. Only to be told 'Failed uploading: no upload port provided'. Any ideas? This is my third attempt at doing something through this forum, with no response from the other 2 about any problems I am facing.

capfacts

7 months ago

I fixed an error on the tinkercad model, the piezo buzzer should be direct to ground, there is no need for a resistor.

Anonymous user

2 years ago

Oh, almost forgot. It only works again after you reset the Uno.

coding_killer

2 years ago

Transition from 1st Siren to another one can be controlled by the push-button but it should be pressed at an appropriate moment(when tone is low). The reset button after the 7th Siren(last one) is compulsory. You can't go to any of the tones after the last siren starts sounding although by changing the code. The issue is solved only by using the Interrupts.

Anonymous user

2 years ago

I built your siren and it works on power up. However, the switch has no effect when pressed. The patterns run through one cycle and then it ends, only to come on again by itself after some time. Any ideas?

Anonymous user

2 years ago

have u found a solution for this problem yet?

coding_killer

2 years ago

Bro...I am facing the same problem in my project too...I have figured it out that, By pressing the button at a specific moment will changes the tone/transition.(Your button will work if you press the button at the time when the tone is low.) To alleviate from this problem... you can check for the state changing from low to high rather than simply checking for the pin(button pin) is high on an interval. That means we have to use the "INTERRUPTS" so that it may react to the button events instantaneously regardless of what is happening inside your void loop(). I haven't applied it yet but I will notify you when upload the new code! You might understand Interrupts from following link: https://youtu.be/CRJUdf5TTQQ

olivier123siren

4 years ago

how do u make the push button work?

RossAnderson

7 years ago

Oh, almost forgot. It only works again after you reset the Uno.

coding_killer

2 years ago

Transition from 1st Siren to another one can be controlled by the push-button but it should be pressed at an appropriate moment(when tone is low). The reset button after the 7th Siren(last one) is compulsory. You can't go to any of the tones after the last siren starts sounding although by changing the code. The issue is solved only by using the Interrupts.

RossAnderson

7 years ago

I built your siren and it works on power up. However, the switch has no effect when pressed. The patterns run through one cycle and then it ends, only to come on again by itself after some time. Any ideas?

coding_killer

2 years ago

Bro...I am facing the same problem in my project too...I have figured it out that, By pressing the button at a specific moment will changes the tone/transition.(Your button will work if you press the button at the time when the tone is low.) To alleviate from this problem... you can check for the state changing from low to high rather than simply checking for the pin(button pin) is high on an interval. That means we have to use the "INTERRUPTS" so that it may react to the button events instantaneously regardless of what is happening inside your void loop(). I haven't applied it yet but I will notify you when upload the new code! You might understand Interrupts from following link: https://youtu.be/CRJUdf5TTQQ

olivier123siren

2 years ago

have u found a solution for this problem yet?