Nothing Special   »   [go: up one dir, main page]

Ultrasonic Sensor Object Detection System Project Report

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Mekelle university

Mekelle institute of technology


Department of electronics and communication engineering
Embeded systems group assignment
Group member:
Name ID.no
Solomon Teame mit/ur/10124/10
Samual kahsay mit/ur/10117/10
Sltan brhane mit/ur/10122/10
Senay mehari Mit/ur/10118/10
Table of Contents:
1. Title
2. Abstract
3. Introduction
4. Objectives
5. Components Used
6. Methodology
7. Results
8. Applications
9. Conclusion
10. Future Work
1.Title:

Ultrasonic sensor object detection system


2. Abstract
 This project aims to develop a cost-effective object detection system using an
Arduino, ultrasonic sensor, LED, and buzzer. The system is designed to provide visual
and auditory and light feedback when an object is detected within a specified range.

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:

 Detect the presence of objects with in a given threshold


distance
 Provide a light and buzzer feedback when an object is
detected
 Get familiarize with the arduino based projects and its
versatility in practical applications
5. Components Used
5.1. arduino board: An Arduino board is an open-source electronics platform
that is designed for prototyping and creating interactive electronic projects. It consists of a
physical programmable circuit board (the actual "Arduino board") and a development
environment(arduino IDE) used to write and upload code to the board. It consists
microcontroller, I/O pins, USB interface, power supply,etc.

Here are the pin description of the board:

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.2. Ultrasonic sensor(HC-SR04)


An ultrasonic sensor is a device that uses sound waves with frequencies
higher than the human audible range to measure the distance to an object.
These sensors are commonly used for object detection, proximity sensing,
and distance measurement in various applications.
Here is its pin description and how it works:

1. VCC (or VDD):


 Description: This pin is used to provide power to the sensor.
 Voltage: The HC-SR04 operates on a voltage of around 5V. Connect the VCC pin
to the 5V output of your Arduino or another power source.
2. Trig (Trigger):
 Description: The trigger pin is used to initiate the ultrasonic pulse.
 Functionality: When a pulse of at least 10 microseconds is applied to this pin,
the sensor sends out an ultrasonic pulse.
3. Echo:
 Description: The echo pin is used to receive the reflected ultrasonic waves.
 Functionality: After sending out the ultrasonic pulse, the sensor waits for the
echo, and the Echo pin goes HIGH. The duration for which the Echo pin is HIGH is
proportional to the distance to the object.
4. GND (Ground):
 Description: This pin is connected to the ground (0V) of the circuit.
 Voltage: Connect this pin to the ground (GND) of your Arduino or another
ground reference in your circuit.
Here is how it works:

The sensor emits ultrasonic when triggered and starts a timer.


Ultrasonic pulses travel outward until they encounter an object, The
object causes the the wave to be reflected back towards the unit. The
ultrasonic receiver would detect the reflected wave and stop the
timer. The velocity of the ultrasonic wave is 340m/sec. in air. Based on
the number of counts by the timer, the distance can be calculated
between the object and sensor’s transmitter by the formula of D = V x T
which is know as the time/rate/distance measurement formula where
D is the measured distance, and V is the propagation velocity (Rate) in
air (speed of sound) and T represents time. In this application T is
devided by 2 as T is double the time value from sensors’s transmitter
to object back to receiver.

Its electrical specifications are:

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 .

5.5 resistors(220-330ohm),jumper wires and bread board,etc


6. Methodology
First we select the devices: arduino board, the ultrasonic sensor ,LED and the
buzzer and we have designed the circuit that detects an object with in 1 meter by
ultrasonic sensor and gives an alert with a buzzer and LED by our hand and design
it in Tinkercad which is an online platform for 3D design and electronics. The
circuit is:-

Fig: circuit of the ultrasonic sensor object detection system

Then we have written an arduino code using an arduino IDE 2.2.1 for this design.

The code is:-

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

// Read the echo duration and calculate distance


long duration = pulseIn(echoPin, HIGH);//The pulseIn() in Arduino is used to measure the duration of a pulse on a
digital input pin. pulsein(pin,state)
int distance = duration * 0.034 / 2; // Convert the distance to centimeters

// Cheking if the thershold distance


if (distance < thresholdDistance) {
digitalWrite(ledPin, HIGH);
buzzBuzzer();
digitalWrite(ledPin, 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.

Its over all operation is like this:

The ultrasonic sensor is triggered to send out pulses.


The duration of the echo pulse is measured, and the distance to an object is calculated.
If the calculated distance is less than the specified threshold (1 meter in this case), the LED is turned on, and
the buzzer is activated for 3 seconds.
The loop then repeats, continually checking for objects within the specified range.

 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:

The Ultrasonic Sensor Object Detection System successfully detects objects


within the defined range. The LED turns on, and the buzzer buzzs to notify
that an object is detected with in specified range of distance.
8.Application:

The project has applications in various domains, including:

Home security systems ( like door or store on a backyard or any


where which is out of your sight)
Proximity warning systems for vehicles (for example: in a parking or
detect if someone is close to your vehicle may if it is outdoor,etc)
Automated lighting control (this could be uses in a houses like a store
where our things keep, and when some is in close to that house the
system notify by turn on the light and buzz.

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.

10. Future work

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!

You might also like