How to make a Siren using Arduino
My project is a buttton controlled Siren with different LED transitions. You can change the Siren sound( eg. police or ambulance siren etc.) for each press. I have added 2 different led patterens for each siren using 10 LEDs. I have added a total of 4 Siren tones. You can checkout the Arduino code and the Explanation here: https://youtu.be/Q22AfdbFTq8
As you all see how is my project looks like in the video.
Now, Let us discuss step by step what you need and how you can design this project with ease.
As we basically building a siren so, red and blue flash looks cool. So take 5 red and 5 Blue LEDs. Now, connect the negative terminal of these led's with a 220ohm 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 pin12 of Arduino's digital pin.
STEP 2: (Connecting Piezo Buzzer)
Now, its time to connect our buzzer and the pushButton with the Breadboard. Connect the Piezo buzzer with a 330ohm resistor to the negative rail and positive end of buzzer connected to pin 13.
STEP 3: (Connecting pushButton)
Connect one out of four pins of pushButton with pin 2 of 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.
STEP 4: ( WRITING CODE)
1. Since we are using button press to switch between the tones so we have to remove the problem button debouncing, which I removed by software implemention using a boolean Debounce function.
2. The conditional if else is used after it for Switching between different functions.Here
one() and oneA() are for 1st tone with two different led transtion, similar for other functions too. And the tones for each function is synced with led transition using delay() appropriately. Let us take three() as an example to understand it.
## LED SYNCING WITH SIREN TONE ##