Arduino Based Air Defence System
Arduino Based Air Defence System
Defence System
Welcome to this guide on creating a simple air defence system using an
Arduino and an ultrasonic sensor. In this project, we will explore how to
detect objects in the air, simulate an alarm, and demonstrate the basic
principles of air defence technology.
by Ajay KC
Components and Connections
1 Arduino Uno 2 Ultrasonic Sensor
The heart of our system, providing the processing Measures the distance to objects using sound waves,
power and control. triggering the alarm when an object enters the
detection range.
3 Buzzer 4 LED
Sounds an audible alarm when an object is detected. Provides a visual alert, indicating an object has been
detected.
Ultrasonic Sensor Setup
1 Power Supply
Connect the VCC pin to the 5V pin on the Arduino and the
GND pin to the ground.
2 Trigger
Connect the Trig pin to a digital pin on the Arduino, such as
pin 9.
3 Echo
Connect the Echo pin to another digital pin on the Arduino,
such as pin 10.
Buzzer and LED Setup
Buzzer LED
Connect the positive terminal of the buzzer to a digital Connect the positive terminal of the LED to a digital pin,
pin, such as pin 12, and the negative terminal to ground. such as pin 13, and the negative terminal to a resistor.
Connect the other end of the resistor to ground.
Arduino Code
const int trigPin = 9;
const int echoPin = 10;
const int buzzerPin = 12;
const int ledPin = 13;
const long duration = 1000; // Adjust for desired delay
int distance;
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzerPin, OUTPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
Serial.print("Distance: ");
Serial.println(distance);
Object Placement
2 Place an object within the sensor's range, simulating an
incoming object.
Observation
3 Observe the LED and buzzer, ensuring they activate when the
object is within the detection range.
Troubleshooting and
Improvements
Issue Possible Cause Solution
Additional Alarms
Implement more advanced warning systems, such as SMS alerts or email
notifications.
Automation
Integrate the system with other devices to automate tasks like closing
windows or activating other safety measures.