You are on page 1of 12

NAME: ABOU YAHYA ZARA

STUDENT ID: 11169649

SUB- GROUP: GROUP 41

LABORATORY SESSION NAME: THURSDAYS AFTERNOON

LABORATORY SESSION INSTRUCTOR: DR. E. D. FORSON

LAB ASSIGNMENT: B3

DATE: 20TH JULY, 2023.


TITLE:
STUDYING HOW ELECTROMAGNETISM IS APPLIED IN ROBOTICS USING AN
ARDUINO AND AN ULTRASONIC SENSOR.

OBJECTIVE:
FINDING THE SPEED OF SOUND IN DRY AIR USING AN ULTRASONIC RANGE
FINDER.
INTRODUCTION

In today's technology, electromagnetism is a branch of physics that is essential to many different


technological applications. Electromagnetism is the foundation of contemporary technology,
being used in everything from motors and generators to wireless communication and magnetic
sensors. The Arduino micro-controller is one flexible instrument that has grown in favor in recent
years due to its use in electromagnetism. An open-source electronics platform called an Arduino
is built on simple hardware and software. Arduino boards can detect inputs, such as light on a
sensor or pressure on a button, and convert them into outputs, such as turning on a motor or an
LED or posting anything online. Users can write and upload code to control electronic devices
and communicate with sensors using this system, which comprises of a programmable micro-
controller board and a programming environment. The advantages of using Arduino in
electromagnetism are numerous. Relays, solenoids, and actuators are just a few examples of the
electromechanical components that can be interfaced with using the device's digital and analog
input/output ports. Arduino enables the control of electromagnet strength, polarity, and timing,
allowing the development of complex electromagnetic systems. Due to Arduino's compatibility
with a variety of sensors, feedback methods can be integrated into electromagnetic applications.
Rotary encoders, for example, can give position and speed feedback for spinning
electromechanical devices. These feedback techniques improve the precision and dependability
of electromagnetism-based initiatives. Additionally, the programmability of Arduino enables for
the construction of complicated algorithms and control systems in electromagnetic applications.
Users can easily implement functionality such as pulse-width modulation (PWM) for precise
control of electromagnet power, closed-loop control for maintaining desired magnetic field
strength, and communication protocols to interface with other devices by utilizing libraries and
code examples available in the Arduino ecosystem. Arduino's versatility and ease of use make it
a great platform for students, enthusiasts, and professionals to investigate and experiment with
electromagnetic ideas. It enables rapid prototyping of electromagnetism-based applications and
gives a hands-on approach to learning.
THEORY
In the realm of robotics, electromagnetism plays a crucial role, enabling the development of intelligent
and interactive robots. By understanding the principles of electromagnetism, engineers can create
robots that sense, manipulate, and respond to their surroundings. This lab report focuses on the
application of electromagnetism in robotics using Arduino. Specifically, we explore the use of ultrasonic
sensors, which utilize sound waves and echo detection to measure distances. Ultrasonic sensors emit
high-frequency sound waves and calculate the time it takes for the echo to return. By dividing this time
by the speed of sound in air (approximately 343 meters per second at room temperature), we can
determine the distance traveled by the ultrasonic signal using the formula:

Distance = (Speed of Sound × Time) / 2

This formula takes into account the round-trip time, as the sound wave travels to the object and back to
the sensor. With the integration of Arduino, accurate time measurements can be obtained, allowing real-
time distance calculations. Through experimental analysis, we aim to demonstrate the practical
implementation of electromagnetism in robotics using ultrasonic sensors and Arduino. This exploration
opens up possibilities for applications such as object detection, obstacle avoidance, and spatial mapping.

Experiment Diagram

PROCEDURE
Download and install Arduino IDE (https://www.arduino.cc/en/Main/Software)
• Plug in your Arduino Board
• Select the proper board in the IDE and the proper COM port.
• Press the Upload button to upload the program to the board

• Connect the SR04 VCC, SR04 GND, SR04 TRG, SR04 ECHO pins to the Arduino board.
• Input the codes below for the distance measurement analysis and connect your Arduino board
to the PC via the USB cable.

• Select the Arduino Port under Tools on the Arduino IDE (See Figure 4)
• Compile and run the code.
• Use the Signal Monitor to observe the distance measurements for various obstacle ranges

TABLE OF VALUES
Metre rule measurement Ultrasonic distance reading D Inverse (cm)-1 ±0.01 Time delay(s) ±0.01
D (cm)±0.01
(cm)±0.01
10.00 9.00 0.11 583.09

20.00 21.00 0.05 1107.87

30.00 29.00 0.03 1690.96

40.00 39.00 0.03 2332.36

50.00 48.00 0.02 2973.76

60.00 57.00 0.02 3440.23

70.00 68.00 0.01 4139.94

80.00 79.00 0.01 4606.41

90.00 89.00 0.01 5189.50

100.00 97.00 0.01 5772.59


GRAPH

120.00
110.00
y = 0.0172x
100.00
90.00
80.00
70.00
D(cm)

60.00
50.00
40.00
30.00
20.00
10.00
0.00
0.00 1000.00 2000.00 3000.00 4000.00 5000.00 6000.00 7000.00
ΔT(s)

DEDUCTION:
Y=mx +c (1)
𝛥𝑇×𝐶
D= (2)
2

Comparing equation (1) and (2),


𝑐
Y=D, x=ΔT, m=2

But from the graph, m=0.0172


Therefore, c=2m
c= 2(0.0172)
c= 0.0344cm/µs
Speed of sound from the graph is 0.0344cm/µs.
ERROR ANALYSIS
Slope of line of worst fit =0.0171cm/s
Slope of line of best fit =0.0172cm/s

Error= (0.0172-0.0171)/ 0.0171


= ±0.0058
Slope= (0.0172 ± 0.0058) cm/s

RESULTS AND ANALYSIS


The theoretical value of the speed of sound is 0.0343cm/µs. The experimental value is
0.0344cm/µs. Comparing these two values, it can be observed that there is a slight deviation
from the theoretical value. This may be due to errors experienced during the lab session. The
errors may include irregularities in the ultrasonic sound reading, etc.

DICUSSION
Electromagnetism and sound play important roles in robotics. Electromagnetism can be used to
control the movement of robots, while sound can be used to detect the presence of objects and
measure their distance.
Sound can be used to detect the presence of objects and measure their distance using ultrasonic
sensors. Ultrasonic sensors emit high-frequency sound waves that bounce off objects and return
to the sensor. By measuring the time it takes for the sound wave to return. the sensor can
determine the distance to the object.
The speed of sound is an important factor in the accuracy of ultrasonic sensors. The speed of
sound varies depending on the temperature and humidity of the air. This can affect the accuracy
of the distance measurements made by the sensor. By using electromagnets to control the
movement of the robot. the robot can be programmed to compensate for changes in the speed of
sound and maintain accurate distance measurements
Overall, the application of electromagnetism and sound in robotics is an important arca of
research and development. By combining these two technologies, robots can be programmed to
perform complex tasks and interact with their environment in new and innovative ways
PRECAUTIONS
When conducting an experiment to determine the speed of sound in electromagnetism
using an Arduino, there are several precautions that should be taken to ensure accurate
is important to ensure that the distance between the two devices used in the experiment is
inaccurately measured. This can be done using a measuring tape or ruler, and the distance should
be measured multiple times to ensure consistency.
It is important to ensure that the experiment is conducted in a controlled environment-free from
external factors that could affect the speed of sound, such as temperature and humidity.
Finally, it is important to take multiple measurements and calculate an average value 10 ensure
that the results are accurate and reliable. This can be done using the Arduino to record multiple
measurements and calculate the average speed of sound based on those measurements.
Overall, by taking these precautions, researchers and engineers can ensure that their experiments
to determine the speed of sound in electromagnetism using an Arduino are accurate, reliable, and
provide valuable data for the development of robotics and other applications that rely on
ultrasonic sensors.

CONCLUSION
In conclusion, an experiment to determine the speed of sound in electromagnetism would involve
measuring the time it takes for a sound wave to travel a known distance between two points
By dividing the distance between the two devices by the time it took for the sound wave to travel
that distance, you can calculate the speed of sound in electromagnetism.

You might also like