DEV Community

Cover image for Design and Implementation of a Light and Tone Alternating Alert System Using Arduino
Francis Beloved
Francis Beloved

Posted on

Design and Implementation of a Light and Tone Alternating Alert System Using Arduino

This project implements an alternating light and sound alert system using Arduino Uno, LEDs, and a passive buzzer. It mimics the basic behavior of a siren or traffic alert by switching between green and red lights with different buzzer tones.

Components Used
Arduino Uno
Passive Buzzer
Red LED
Blue LED
Resistors
Breadboard
Jumper Wires

Red LED is connected to digital pin 8 through a 220Ω resistor.
Green LED is connected to digital pin 9 through a 220Ω resistor.
Buzzer is connected to digital pin 11, with the other terminal connected to GND.
All components are mounted on a breadboard and powered via USB.

The Arduino sketch uses three digital pins: two for the LEDs and one for the buzzer. The system alternates between turning on the green LED with a high-frequency tone (850 Hz) and the red LED with a lower-frequency tone (650 Hz). Each state lasts for 500 milliseconds.

Source Code
const int red = 8;
const int green = 9;
const int buzzer = 11;

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

void loop() {
digitalWrite(green, 1);
tone(buzzer, 850);
delay(500);

digitalWrite(green, 0);
digitalWrite(red, 1);
tone(buzzer, 650);
delay(500);

digitalWrite(red, 0);
}

Result

The system performs as expected: the green LED lights up along with an 850 Hz tone, followed by the red LED lighting up with a 650 Hz tone. This alternating behavior creates a simple but effective alert signal. The use of the tone() function allows for easy frequency modulation, while the use of digitalWrite() and delay() functions ensures timed control of outputs.

Conclusion

This project successfully implements an alternating LED and buzzer alert system using Arduino. By combining light and sound in a timed loop, the system demonstrates the practical use of microcontroller outputs to create signaling devices.

Top comments (0)