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

Title of the project :

Interface an ultrasonic sensor

Batch no: 2

Lab Name: Internet of Things


Name of the Supervisor
Dr. ANUP DEY
Assistant Professor

PRESENTED BY:
CH.Sri karan 2103A51196
D.Tharun 2103A51262
R.Manideep 2103A51242
M.Surendar 2103A51061
P.Sai Deepak 2103A51284

1|Page
List of components:
 Arduino uno R3
 Ultrasonic Distance sensor HC-SR04
 Bread board
 Resistor
 Potentiometer
 LCD Display 16*2
 Connecting wires

Detailed Descriptions of all components:


Arduino uno R3
The Arduino Uno is a microcontroller board based on the
ATmega328 (datasheet). It has 14 digital input/output pins
(of which 6 can be used as PWM outputs), 6 analog inputs, a
16 MHz ceramic resonator, a USB connection, a power jack,
an ICSP header, and a reset button. It contains everything
needed to support the microcontroller; simply connect it to a
computer with a USB cable or power it with a AC-to-DC
adapter or battery to get started. The Uno differs from all
preceding boards in that it does not use the FTDI USB-to-
serial driver chip. Instead, it features the Atmega16U2
(Atmega8U2 up to version R2) programmed as a USB-to-
serial converter. Revision 2 of the Uno board has a resistor
pulling the 8U2 HWB line to ground, making it easier to put
into DFU mode. Revision 3 of the board has the following
new features:

2|Page
1.0 pinout: added SDA and SCL pins that are near to the
AREF pin and two other new pins placed near to the RESET
pin, the IOREF that allow the shields to adapt to the voltage
provided from the board. In future, shields will be compatible
both with the board that use the AVR, which operate with 5V
and with the Arduino Due that operate with 3.3V. The second
one is a not connected pin, that is reserved for future
purposes. Stronger RESET circuit. Atmega 16U2 replace the
8U2. "Uno" means one in Italian and is named to mark the
upcoming release of Arduino 1.0. The Uno and version 1.0
will be the reference versions of Arduino, moving forward.
The Uno is the latest in a series of USB Arduino boards, and
the reference model for the Arduino platform; for a
comparison with previous versions, see the index of Arduino
boards.
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide
PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB of which 0.5 KB
used by bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)

3|Page
Applications:
• Xoscillo, an open-source oscilloscope
• Arduinome, a MIDI controller device that mimics the
Monome
• OBDuino, a trip computer that uses the on-board
diagnostics interface found in most modern cars.
• Gameduino, an Arduino shield to create retro 2D video
games
• ArduinoPhone, a do-it-yourself cellphone
• Water quality testing platform
• Automatic titration system based on Arduino and stepper
motor
• Low cost data glove for virtual reality applications
• Impedance sensor system to detect bovine milk adulteration
• Homemade CNC using Arduino and DC motors with close
loop control by Homofaciens
• DC motor control using Arduino and H-Bridge

4|Page
Ultra Sonic Sensor
An ultrasonic sensor is an instrument that measures the
distance to an object using ultrasonic sound waves.
An ultrasonic sensor uses a transducer to send and receive
ultrasonic pulses that relay back information about an object’s
proximity.
High-frequency sound waves reflect from boundaries to
produce distinct echo patterns.
Ultrasonic sensors work by sending out a sound wave at a
frequency above the range of human hearing. The transducer
of the sensor acts as a microphone to receive and send the
ultrasonic sound. Our ultrasonic sensors, like many others,
use a single transducer to send a pulse and to receive the echo.
The sensor determines the distance to a target by measuring
time lapses between the sending and receiving of the
ultrasonic pulse. The working principle of this module is
simple. It sends an ultrasonic pulse out at 40kHz which
travels through the air and if there is an obstacle or object, it
will bounce back to the sensor. By calculating the travel time
and the speed of sound, the distance can be calculated.
Ultrasonic sensors are a great solution for the detection of
clear objects. For liquid level measurement, applications that
use infrared sensors, for instance, struggle with this particular
use case because of target translucence.
For presence detection, ultrasonic sensors detect objects
regardless of the colour, surface, or material (unless the
material is very soft like wool, as it would absorb sound.) To

5|Page
detect transparent and other items where optical technologies
may fail, ultrasonic sensors are a reliable choice.
Ultrasonics are so widely used, they can be reliably
implemented in grain bin sensing applications, water level
sensing, drone applications and sensing cars at your local
restaurant or bank.
Ultrasonic rangefinders are commonly used as devices to
detect a collision.
Ultrasonic Sensors are best used in the non-contact detection
of:
• Presence
• Level
• Position
• Distance
Non-contact sensors are also referred to as proximity sensors.
Ultrasonics are Independent of:
• Light
• Smoke
• Dust
• Colour
• Material (except for soft surfaces, i.e. wool, because the
surface absorbs the ultrasonic sound wave and doesn’t reflect
sound.)

6|Page
Features:
• Supply voltage: 5V (DC).
• Supply current: 15mA.
• Modulation frequency: 40Hz.
• Output: 0 – 5V (Output high when obstacle detected in
range).
• Beam Angle: Max 15 degrees.
• Distance: 2cm – 400cm.
• Accuracy: 0.3cm.

Bread board
A breadboard, solderless breadboard, or protoboard is a
construction base used to build semipermanent prototypes of
electronic circuits. Unlike a stripboard, breadboards do not
require soldering or destruction of tracks and are hence reusable.
7|Page
For this reason, breadboards are also popular with students and
in technological education.
A variety of electronic systems may be prototyped by using
breadboards, from small analog and digital circuits to complete
central processing units (CPUs).
Compared to more permanent circuit connection methods,
modern breadboards have high parasitic capacitance, relatively
high resistance, and less reliable connections, which are subject
to jostle and physical degradation. Signaling is limited to about
10 MHz, and not everything works properly even well below
that frequency.

Features:
 2 Distribution Strips, 200 tie-points.
 630 tie-points in IC/ circuit areas.
 ABS plastic with color legend.

8|Page
 Dimension: 6.5*4.4*0.3 inch.
 Hole/Pitch Style: Square wire holes (2.54mm)
 ABS heat Distortion Temperature: 84° C (183° F)
 Rating: 300/3 to 5Amps.
 Insulation Resistance : 500MΩ / DC500V.

Resistor
A resistor is a passive two-terminal electrical component that
implements electrical resistance as a
circuit element. In electronic circuits, resistors are used to
reduce current flow, adjust signal levels, to
divide voltages, bias Passive elements, and terminate
transmission lines, among other uses.

9|Page
Potentiometer
For interfacing with an ultrasonic sensor, a common choice for a
potentiometer is a rotary potentiometer. These potentiometers
come in various types and sizes, but a standard one used in
hobbyist electronics and prototyping is a 10k ohm rotary
potentiometer.

The 10k ohm potentiometer is popular because it provides a


good range of resistance for adjusting sensitivity or other
parameters without drawing excessive current from the
microcontroller or power supply. Additionally, it's readily
available and compatible with most microcontroller boards like
Arduino.
However, depending on your specific application requirements
and the range of adjustment needed, you may choose a different
resistance value for the potentiometer. Always check the
datasheets of your components and consider factors such as
power consumption, voltage range, and resolution when
selecting components for your circuit.

10 | P a g e
LCD Display 16*2
Using an LCD display (16x2) to interface with an ultrasonic
sensor serves several purposes:
1. Visualization: It provides a visual representation of the data
captured by the ultrasonic sensor. In this case, it displays
distance measurements in a user-friendly format (e.g., in
centimeters).
2. User Interface: LCD displays offer a simple and intuitive
way to interact with a device. Users can easily read the
displayed information without needing to interpret raw sensor
data.
3. Real-Time Feedback: Users can see distance measurements
in real-time as objects move closer or farther away from the
ultrasonic sensor. This immediate feedback can be valuable in
various applications, such as robotics, security systems, or
distance measurement devices.
4. Data Logging: If your project involves logging or recording
distance measurements over time, an LCD display can serve as a
temporary or supplementary output method before data is stored
or transmitted elsewhere.
5. Debugging and Testing: During development and testing
phases, the LCD display can be used to monitor sensor readings
and system behavior, aiding in debugging and troubleshooting.
Overall, integrating an LCD display with an ultrasonic sensor
enhances the usability and functionality of your project by

11 | P a g e
providing a clear and informative interface for users to interact
with and understand the sensor's output.

Working principle
The interfacing of an Passive buzzer with a microcontroller
board and an ultrasonic sensor involves integrating these
components to create a system capable of emitting audible alerts
based on distance measurements obtained from the ultrasonic
sensor. In this setup, the Passive buzzer is connected to one of
the GPIO pins of the microcontroller board, requiring a 5V
power supply and a ground connection. Meanwhile, the
ultrasonic sensor consists of a transmitter and a receiver, both
connected to the microcontroller. When triggered by the
microcontroller, the ultrasonic sensor emits ultrasonic pulses,
which bounce off objects and return to the receiver. By
measuring the time it takes for these pulses to travel, the
microcontroller calculates the distance to the object. Based on
this distance data, the microcontroller determines whether to
trigger the Passive buzzer to emit an audible alert. This entire
process, including triggering the sensor, receiving echoes,
calculating distances, and controlling the buzzer, is continuously
executed within a loop in the microcontroller's program,
12 | P a g e
allowing for realtime monitoring and feedback. This integrated
system finds applications in proximity detection, obstacle
avoidance, safety alarms, and interPassive interfaces, offering a
versatile solution for various practical scenarios.

Results and Discussions:


The result and discussion of interfacing an Passive buzzer with a
microcontroller board and an ultrasonic sensor encompass both
the functional outcome of the system and potential implications
for various applications.

13 | P a g e
Result:
The interfacing of the Passive buzzer with the microcontroller
board and the ultrasonic sensor has successfully yielded a
functional system capable of emitting audible alerts based on
distance measurements obtained from the ultrasonic sensor.
Through the integration of hardware connections and software
control, the system accurately detects objects within its detection
range and triggers the Passive buzzer to emit alerts accordingly.
The system demonstrates robustness in continuous monitoring
and feedback, enabling real-time response to changes in
proximity.
Discussion: The interfacing of these components offers several
notable advantages and implications:
Proximity Sensing: The system provides reliable proxim[ity
sensing capabilities, enabling applications such as obstacle
detection, object tracking, and proximity warning systems. This
functionality is crucial for enhancing safety in environments
where collision avoidance or spatial awareness is paramount.
Auditory Feedback: By incorporating an Passive buzzer, the
system delivers auditory feedback to users, enhancing situational
awareness and alerting individuals to detected objects or
obstacles. Auditory cues are particularly beneficial in scenarios
where visual feedback may be limited or distracting, such as in
low-light conditions or for visually impaired users.
Real-Time Control: The microcontroller's ability to
continuously monitor distance measurements and control the
Passive buzzer in real-time facilitates dynamic response to
changing environmental conditions. This responsiveness is

14 | P a g e
advantageous for applications requiring adaptive behaviour such
as autonomous navigation systems or interPassive interfaces.
Versatile Applications: The interfacing of these components
opens up a wide range of potential applications across various
domains, including robotics, home automation, IoT, security
systems, and educational projects. From smart appliances to
industrial automation, the system's flexibility enables
customization to suit diverse use cases.
Integration with IoT: The system can be integrated into IoT
networks, enabling remote monitoring and control based on
distance data. By transmitting distance measurements to cloud
platforms or centralservers, the system contributes to data-driven
decision-making and enables remote management of connected
devices.
Educational Value: The interfacing project serves as an
educational tool for learning about sensor integration,
microcontroller programming, and real-world applications of
electronics and embedded systems. It provides hands-on
experience and fosters experimentation and innovation among
students, hobbyists, and aspiring engineers.

Limitations
While the interfacing of an Passive buzzer with a
microcontroller board and an ultrasonic sensor offers many
benefits, it also has certain limitations that should be considered:
Limited Range and Accuracy: Ultrasonic sensors have a
limited detection range, and their accuracy decreases at longer

15 | P a g e
distances or in environments with obstacles or acoustic
interference. This limitation restricts the effective range of the
system and may lead to inaccuracies in distance measurements.
Detection Blind Spots: Ultrasonic sensors may have blind spots
or dead zones where objects are not detected due to the sensor's
beam pattern or reflective surfaces. These blind spots can result
in missed detections or false negatives, compromising the
reliability of the system.
Interference and Crosstalk: Ultrasonic sensors can be
susceptible to interference from ambient noise, echoes, or other
ultrasonic sources. Crosstalk between multiple sensors in close
proximity may also occur, leading to erroneous distance
measurements or triggering of the Passive buzzer.
Complexity of Implementation: Interfacing an Passive buzzer
with a microcontroller board and an ultrasonic sensor requires
technical expertise in hardware connections, sensor calibration,
and software programming. The complexity of implementation
may pose challenges for beginners or those unfamiliar with
embedded systems development.
Environmental Limitations: The performance of ultrasonic
sensors may be affected by environmental factors such as
temperature, humidity, and airflow. Extreme environmental
conditions or harsh operating environments may degrade sensor
performance and reliability.
Single-Point Detection: Ultrasonic sensors typically provide
distance measurements for a single point or direction. This
limitation restricts their suitability for applications requiring
omnidirectional or multipoint detection capabilities.

16 | P a g e
Despite these limitations, the interfacing of an Passive buzzer
with a microcontroller board and an ultrasonic sensor remains a
valuable approach for proximity sensing, obstacle detection, and
auditory feedback in various applications. Mitigating these
limitations often involves careful system design, sensor
calibration, and integration with complementary technologies
for enhanced performance .

Future work and Conclusions


FUTURE SCOPE
The future scope of interfacing an Passive buzzer with a
microcontroller board and an ultrasonic sensor is promising,
with several avenues for further exploration and development:
Enhanced Accuracy and Range: Future advancements may
focus on improving the accuracy and range of ultrasonic sensors
through technological innovations such as advanced signal
processing algorithms, higher frequency transducers, and
improved acoustic designs. This would expand the applicability
of Passive buzzer systems in scenarios requiring precise distance
measurements over longer distances.
Integration with AI and Machine Learning: Incorporating
artificial intelligence (AI) and machine learning (ML)
techniques can enhance the intelligence and autonomy of
Passive buzzer systems. ML algorithms can be trained to
recognize patterns in ultrasonic sensor data, enabling the system
to adapt dynamically to changing environments, optimize
performance, and learn from experience.

17 | P a g e
Multi-Sensor Fusion: Integrating ultrasonic sensors with
complementary sensor technologies such as infrared sensors,
LiDAR, or radar can enable multi-modal sensing and fusion,
enhancing the system's robustness and reliability in diverse
operating conditions. Multi-sensor fusion techniques can
provide more comprehensive environmental awareness and
improve obstacle detection capabilities.

CONCLUSION
In conclusion, the interfacing of an Passive buzzer with a
microcontroller board and an ultrasonic sensor presents a
versatile platform for creating interPassive systems with
auditory feedback based on distance measurements. This
integration enables a wide range of applications spanning safety,
automation, human-machine interaction, and IoT
implementations. While the system offers numerous benefits,
including proximity sensing, real-time control, and adaptability
to various environments, it also has limitations such as limited
range and accuracy, susceptibility to interference, and
complexity of implementation. Despite these limitations, the
interfacing project serves as a valuable educational tool for
learning about sensor integration, microcontroller programming,
and practical applications of embedded systems. Moving
forward, continued research and development efforts can
address these limitations and further enhance the performance,
reliability, and versatility of Passive buzzer systems integrated
with microcontroller boards and ultrasonic sensors. Overall, the
interfacing of these components opens up exciting opportunities

18 | P a g e
for innovation and creativity in engineering, robotics, IoT, and
beyond.

Code:
/*
The readings are not accurate as we may want it to be
This is by Joey Kanyi
*/
#include <LiquidCrystal.h>
LiquidCrystal lcd(1, 2, 4, 5, 6, 7); //Interface pins of the LCD
const int trigPin=9;
const int echoPin=10;
long distance,duration;

void setup() {
lcd.begin(16,2);
lcd.setCursor(0,0); //set the cursor to column 0 and line 0

19 | P a g e
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
}

void loop() {
digitalWrite(trigPin,HIGH);
delayMicroseconds(20);
digitalWrite(trigPin,LOW);
delayMicroseconds(20);
duration = pulseIn(echoPin, HIGH); //To receive the reflected
signal.
distance= duration*0.034/2;
lcd.setCursor(0,1); //set the cursor to column 0 and line 1
lcd.print(distance);
lcd.print("cm");
delay(100);
}

20 | P a g e

You might also like