You are on page 1of 9

MECHATRONICS ME156P SECTION E03 EXPERIMENT NO.

8
Experiment TITLE: Sonar Distance Sensor
Salvado, John Henry M. Date Performed: Dec. 18, 2019
2013102950 Date Submitted: Jan. 8, 2020
Professor: Engr. Edward Ang Course and Year: MFGE/3
Group # 4

Discussion:
This experiment titled Sonar Sensor has us student familiarize ourselves with the
Sonar. The experiment aimed to teach the students how to program and use the Sonar
Sensor, specifically, we were tasked to Calibrate the Sonar Sensor. ultrasonic sensors
measure distance by using ultrasonic waves. The sensor head emits an ultrasonic wave
and receives the wave reflected from the target. Ultrasonic Sensors measure the
distance to the target by measuring the time between the emission and reception.
The Experiment has us Calibrating the sonar sensor for different distances up to
3 meters in total. This is easy to achieve just have to make sure that you have a long
enough area with no obstructions so that the sensor may give the proper readings.
Learning Objectives:

This experiment’s objectives are;


 To familiarize ourselves with the Sonar Sensor
 To find out how the Sonar sensor works with its programming codes.
 To successfully calibrate the Sonar sensor up to a distance of 3 meters
 To observe the changes in the values of the Sonar sensor readings using
the serial monitor.
 To know the applications of the Sonar sensor in the industry.
Course Objectives and Anticipated Student Outcomes:
“a” to “k ” and “ L ”outcomes. The ABET outcomes taught and assessed in this course
are:

“A” Ability to apply knowledge of mathematics, science, and engineering


- The ability to apply knowledge of science and engineering was practiced in
this experiment as we could tinker with the Arduino and its code.
“B” Ability to design and conduct experiments as well as analyze and interpret data
- We were able to analyze the data we gathered using the serial monitor and
rulers and marking on the table.
“C” Ability to design a system to meet desired needs.
- We were able to adjust the code to meet the desired needs of the experiment.
“D” Ability to function on multidisciplinary teams
- We were able to spread out the workload among the group members evenly
so that each member has a role in the experiment.
“E” Ability to identify, formulate, and solve engineering problems.
- We were able to identify certain errors in our code and our set up. We were
able to confirm that some of our wiring wasn’t connected properly and we
were able to fix the issues in both the hardware and software side of the
experiment.
“F” Understanding of professional and ethical responsibility
- We were able to work independently as a group and finished the experiment
responsibly
“G” Ability to communicate effectively
- We were able to communicate together as a group and finished the work
efficiently.
“H” Broad education necessary to understand the impact of engineering solutions in a
global/societal context
- The scope of this experiment was very limited and didn’t tackle any global
issues.
“I” Recognition of the needs for and ability to engage in lifelong learning
- Aside from working as a group this piqued my interest in the programming
side of the Arduino experiments.
“J” Knowledge of contemporary issues.
- In the current Philippine situation, we lack innovators on that could compete
on a global scale, this experiment could be an eye opener for many students
“K” Ability to use the techniques, skills, and modern engineering tools for engineering
practice
- We exercised our skills in working with the modern engineering tool the
Arduino.
“L” Knowledge and understanding of engineering and management principles as a
member and leader in a team, to manage projects and in multidisciplinary environments
- As a member of the group we were able to acknowledge the different roles
we had to play in the experiment.
Group Assignments/Task done by EACH member:
GROUP NUMBER 4
EXPERIMENT #8
Experiment Title: Sonar Sensor Due Date: 1/8/2020
Group Member
Name: Brief % Completed
No. Group Member Description of by Members Your Score
Signature: the Work
assigned to
Members

Salvado, John Assembled the


1 Henry setup 100% 100

Roca , Reimbert
Randalla Programmed
2 100% 100
the arduino

Mendoza , Carlo E. Programmed


3 and 100% 100
troubleshooted

Fernando , Bon
Keno R. Brought the
4 100% 100
laptop

San Juan , Marco P.


Troubleshoot
5 100% 100
the experiment

*100% means the member completed his/her assigned work.


By signing this assignment cover sheet, I agree that the percentages stated in the %
completed column reflect the contribution made by me and the other members of the group.
List of materials Needed for the Experiment:

1. USB Data Cable (Yellow)


2. Arduino Uno
3. Bread Board
4. Sonar Sensor

Schematic Diagram:

Legend:
1. USB Data Cable (Yellow)
2. Arduino Uno
3. Bread Board
4. Sonar Sensor
List of ACTUAL SAFETY procedures implemented in this experiment:
Steps:
1. Identify all the different parts needed for the set up
2. Assemble the Sonar Sensor setup, referencing from the manual provided.
3. Make sure the wires are connected properly between the Arduino Uno and sonar
sensor
4. Connect the Arduino Uno to the Laptop using the Provided Data Cable.

5. Open the Arduino Program


6. Referencing from the Arduino Site, Copy the Provided Code.
7. Make necessary adjustment to the code if errors are found.
8. Upload the Code onto the Arduino Uno.
9. Set up the Sonar sensor Area, Clear the table of all obstructions and create
different distance marking up to 3 meters.
10. Using any Solid object to block the Sonar sensor signal measure the distance
from the sonar sensor.
11. Read the gathered data from the Serial Monitor for all the distances Measured.
12. Disassemble the Setup and keep all the components.
Arduino Code:
int trig = 9; // This declares trig to be an integer connected at digital pin 9.
int echo = 8; //This declares echo to be an integer connected at digital pin 8.
int duration; // This declares duration to be an integer.
float distance; // This declares the distance to be a float value, a number that has a
decimal point.
float meter; // This declares the meter to be a float value, a number that has a decimal
point.
void setup() {
Serial.begin(9600);
pinMode(trig, OUTPUT);
digitalWrite(trig, LOW);
delayMicroseconds(2);
pinMode(echo, INPUT);
delay(6000);
Serial.println("Distance:");
}
void loop() {
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
duration = pulseIn(echo, HIGH); // Reads a pulse (either HIGH or LOW) on a pin. The
pulseIn() waits for the echo pin to go HIGH, starts timing, then waits for the pin to go
LOW and stops timing. Then stores the value to duration.
if(duration>=38000){
Serial.print("Out range");
}
else {
distance = duration/58;
Serial.print(distance);
Serial.print("cm");
meter=distance/100;
Serial.print("\t");
Serial.print(meter);
Serial.println("m");
}
delay(1000);
}
output readings by 500ms
}
Data Sheet/ Gathered:
Actual Reading
Measurement
10cm 10cm
20cm 20cm
30cm 29cm
40cm 39cm
50cm 49cm
60cm 58cm
70cm 69cm
80cm 78cm
90cm 88cm
100cm 98cm
3m 299cm

ANALYISIS:
The data we gathered in this experiment was acquired by the Serial Monitor and
Pre-measured markings on the table. The experiment was a great success as we
properly measured the distances required within a margin of error, usually only a few
millimeters away. One cause of this could be the way we were holding the sonar sensor
as it may not be perfectly perpendicular from the flat surface, which could give small
variances in the way the sensor receives the waves back. We were also not entirely
sure where the sensor readings begin. We started our measurements from the very end
of its housing.

Recommendation:
I recommend that students determine where the sonar sensor begins its 0
reading, so that you may have even more accurate readings in the serial monitor. As
also stated above make sure the sonar sensor is properly perpendicular from the flat
surface you are reading on. So that the waves travel properly to the target and back to
the sensor.
Conclusion:
In conclusion to this experiment we were able to achieve the objectives set for
us. We were able to familiarize ourselves with the Sonar Sensor and figure out how it
works. Ultrasonic sensors work by emitting sound waves at a frequency too high for
humans to hear. They then wait for the sound to be reflected, calculating distance
based on the time required for the. Using the Arduino Code provided we were able to
turn the signals received from the sonar sensor into an actual distance measurement.
We were able to measure different distances up to 3 meters away within a good margin
of accuracy.

Answer to Questions:
a. Describe the function of a sonar sensor. Can it be used to detect water level?
- Sonar Sensor Measure distance using ultrasonic waves and waiting for the
echo of the waves emitted. we can find the water depth calculation by finding
the distance between the transceiver and the surface of the water.
b. In the experiment, what is the maximum distance (in meters) the sonar sensor
can detect? Why?
- In the experiment we were only able to test up to 3 meters.
c. SUGGEST the INDUSTRIAL APPLICATION of this kind of experiment
- Sonar sensors are greatly used in the industry , one application of the sensor
is in factories. Where they are used to measure if a product has passed
through in the production line.

You might also like