Ultrasonic Sensor Object Detection System Project Report
Ultrasonic Sensor Object Detection System Project Report
Ultrasonic Sensor Object Detection System Project Report
3.introduction
We could demand object detection systems for various needs. These systems
find applications in diverse fields ,ranging from security systems to programmed
installations. So, ultrasonic sensor based object detection systems could address
the needs in the ultrasonic technology, things that are change or actuate
according to the object sensed by ultrasonic sensor in collaborate with arduino
microcontroller. This project will try to sense an object and notify with a buzzer
and LED .
4. Objectives
The primary objectives of the project are as follows:
1. Digital Pins:
Description: Digital pins are used for binary signals, meaning they can be either
HIGH (5V) or LOW (0V).
Functionality: They are commonly used for digital input or output operations.
For example, reading a button state (input) or controlling an LED (output).
Numbering: Digital pins are labeled with 'D' followed by a number (e.g., D2, D7).
2. Analog Pins:
Description: Analog pins are used to read analog signals, providing a range of
values between 0 and 1023.
Functionality: Analog pins are commonly used to read values from analog
sensors such as temperature sensors or potentiometers.
Numbering: Analog pins are labeled with 'A' followed by a number (e.g., A0, A3).
3. PWM (Pulse Width Modulation) Pins:
Description: Certain digital pins support PWM, allowing for the simulation of
analog output by varying the duty cycle of a pulse.
Functionality: PWM pins are often used for controlling the brightness of LEDs,
the speed of motors, or the position of servo motors.
4. Power Pins:
Description: Power pins provide electrical power to the Arduino board and
connected components.
Functionality: Includes pins for 5V (positive power), GND (ground), and VIN
(voltage in).
Numbering: Indicated as 5V, GND, and VIN.
5. Communication Pins:
Description: These pins are used for communication with other devices.
Functionality: Includes TX (transmit) and RX (receive) pins for serial
communication. Other pins may be used for I2C or SPI communication,
depending on the Arduino model.
Numbering: TX, RX, SDA, SCL, MOSI, MISO, SCK, etc.
6. Reset Pin:
Description: The reset pin is used to restart the microcontroller.
Functionality: Pulling this pin LOW resets the Arduino.
Numbering: Often labeled as 'RESET.'
5.3 LED: a diode which emits light when current flows through it.we use it to light on and
notify that an object is detected.
5.4 BUZZER: A buzzer is a simple audio signaling device that produces a buzzing or
beeping sound. It is commonly used in electronic circuits, alarms, timers, and various
applications where an audible alert or notification is needed .
Then we have written an arduino code using an arduino IDE 2.2.1 for this design.
const int trigPin = 2; // Pin for the TRIG pin of the ultrasonic sensor
const int echoPin = 3; // Pin for the ECHO pin of the ultrasonic sensor
const int ledPin = 8; // Pin for the LED
const int buzzerPin = 4; // Pin for the buzzer
const int thresholdDistance = 100; // set the thershold distance to 1 meter,where the sensor starts to detect an object
const int buzzerDuration = 3000; // set the buzzer duration to 3 seconds
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
}
void loop() {
// Trigger the ultrasonic sensor
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
delay(100);
}
void buzzBuzzer() {
// this function makes the buzzer to buzz longer
unsigned long endTime = millis() + buzzerDuration;//non block delay
while (millis() < endTime) {
digitalWrite(buzzerPin, HIGH);
delay(50);
digitalWrite(buzzerPin, LOW);
delay(50);
}
}
Then we made a prototype for the circuit above (wiring).and upload it to the arduino
microcontroller.
The system utilizes the Arduino board to control the ultrasonic sensor, LED, and buzzer. The ultrasonic sensor emits
pulses, and the Arduino calculates the distance based on the time taken for the pulses to return. If an object is within
the specified range, the LED lights up, and the buzzer produces a distinctive sound.
7.Results:
9.conclusion:
The project shows that arduino is a very flexible board which can be used in many real
world applications. The ultrasonic sensor used in this system detect an object perfectly
and the System achieved its objectives by providing a simple and functional solution for
object detection.
This project could be enhanced by include more sensors for different purpose and
motors, and of course object recognition algorithms, and including wireless
communication for remote monitoring.
The END!