[go: up one dir, main page]

0% found this document useful (0 votes)
380 views8 pages

Arduino Based Air Defence System

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
380 views8 pages

Arduino Based Air Defence System

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Arduino-Based Air

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);

if (distance <= 20) {


digitalWrite(buzzerPin, HIGH);
digitalWrite(ledPin, HIGH);
delay(100);
} else {
digitalWrite(buzzerPin, LOW);
digitalWrite(ledPin, LOW);
}
}
Testing and Calibration
Power Up
1 Connect the Arduino to a power source and upload the code.

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

No Response Incorrect Double-check all


connections connections and
ensure proper
polarity.

Inaccurate Distance Sensor obstruction Ensure the sensor is


Readings not blocked or facing
a reflective surface.

Delayed Alarm Code error Review the code for


any errors or
misconfigurations.
Expanding the Project
Multiple Sensors
Use multiple sensors to cover a larger area or create a more robust
detection system.

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.

You might also like