-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lab3.html
212 lines (181 loc) · 11.9 KB
/
Lab3.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>ECE 4160: Lab 3</title>
<link rel="icon" type="image/x-icon" href="assets/img/favicon.ico" />
<!-- Font Awesome icons (free version)-->
<script src="https://use.fontawesome.com/releases/v6.1.0/js/all.js" crossorigin="anonymous"></script>
<!-- Google fonts-->
<link href="https://fonts.googleapis.com/css?family=Saira+Extra+Condensed:500,700" rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com/css?family=Muli:400,400i,800,800i" rel="stylesheet" type="text/css" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="css/styles.css" rel="stylesheet" />
</head>
<body id="page-top">
<!-- Navigation-->
<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top" id="sideNav">
<a class="navbar-brand js-scroll-trigger" href="#page-top">
<span class="d-block d-lg-none">Eshita Sangani</span>
<span class="d-none d-lg-block"><img class="img-fluid img-profile rounded-circle mx-auto mb-2" src="assets/profile.jpg" alt="..." /></span>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="index.html">About</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="Lab1.html">Lab 1</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="Lab2.html" >Lab 2</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="Lab3.html" style="color: rgb(31, 78, 47);">Lab 3</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="Lab4.html">Lab 4</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="Lab5.html">Lab 5</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="Lab6.html">Lab 6</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="Lab7.html">Lab 7</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="Lab8.html">Lab 8</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="Lab9.html">Lab 9</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="Lab10.html">Lab 10</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="Lab11.html">Lab 11</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="Lab12.html">Lab 12</a></li>
</ul>
</div>
</nav>
<!-- Page Content-->
<section class="resume-section" id="experience">
<div class="resume-section-content">
<h2 class="mb-2">Lab 3 <span class="text-primary">Time of Flight Sensors</span></h2>
<p class="mb-5">
The purpose of this lab was to gain familiarity with time of flight sensors, one of
the first sensors that we will equip our robot with.
</p>
<div class="d-flex flex-column flex-md-row justify-content-between mb-5">
<div class="flex-grow-1">
<h3 class="mb-0">I2C Setup</h3>
<p>
Since we will be using 2 TOF sensors, we have to make sure that we are
able to properly process and distinguish the data received from each TOF.
The address of one of the sensors is already hardwired on the Artemis, so
we must come up with a way to distinguish the two sensors being used.
We can either change the address on the software interface or make use
of the XSHUT pin on the sensor. The XSHUT pin will hold all sensors connected
except for the one that you can then reconfigure. The default I2C address
is 0x29, as seen in the image below. I chose to enable the sensors separately
through their shutdown pins because you would not need to change
the address of the sensors every time they power off. In addition, it is more
power and energy efficient but also comes at the cost of communication delays.
I didn't use the other method because I did not want to have to change the I2C
address every time the sensor is powered off, even though it would give the benefit
of less communication delays. I decided to solder the XSHUT pin of one sensor
to pin 8 of my Artemis board, which I then used to shut off the corresponding
sensor during setup and change the address of the other sensor. In the image below,
the address printed is 0x29.
</p>
<p>
<img src="assets/port.jpg" alt="..." width="55%" />
</p>
<p>
This is how I changed the address of one of the sensors by setting it to 32.
</p>
<p>
<script src="https://gist.github.com/eshitasangani/a5816c6362ee24e4a3b771fb70fd5324.js"></script>
</p>
<p>
I chose to place both sensors at the front of my robot. I want to measure
both distances to be able to develop an accurate frame of reference from
the front. As they will be placed next to each other, the robot will kind of
have "eyes" or a full point of view and also can account for blind spots
in the front. The robot could possibly miss situations on the far sides on
both sides if it does not fall in the field of view.
</p>
</div>
</div>
<div class="d-flex flex-column flex-md-row justify-content-between mb-5">
<div class="flex-grow-1">
<h3 class="mb-0">TOF Connections</h3>
<p>
<img src="assets/tof.jpg" alt="..." width="55%" />
</p>
<p>
<img src="assets/fulltof.jpg" alt="..." width="55%" />
</p>
</div>
</div>
<div class="d-flex flex-column flex-md-row justify-content-between mb-5">
<div class="flex-grow-1">
<h3 class="mb-0">TOF Modes + Readings</h3>
<p>
The TOF sensor has 3 modes that can be used - short, medium, and long.
Long distance mode allows for the longest range - 4m but is very
sensitive to ambient light. Short distance mode is not as sensitive
to ambient light, but has a max ranging distance of 1.3m.
I chose to use short distance mode because of its resistance against
ambient light as it will lessen the overall error as it
can operate in a bright area but at the cost of the range distance.
</p>
<p>
After deciding which mode to use, I used the ReadDistance example
from the Soarkfun library on one of the TOF sensors to understand
how the short mode would use. I took the measurements in 4 cm
increments from 0 cm to 150 cm. I measured this using the white
box as a frame of reference as seen in the picture below, and
measured
The standard deviation of the data
is miniscule, confirming the repeatability of the short distance mode.
Using the stopRanging() function, I was able to see that
the ranging time is 97ms with .stopRanging() and 95ms without
the .stopRanging() function.
</p>
<p>
<img src="assets/port.jpg" alt="..." width="55%" />
</p>
</div>
</div>
<div class="d-flex flex-column flex-md-row justify-content-between mb-5">
<div class="flex-grow-1">
<h3 class="mb-0">2 TOF Sensors</h3>
<p>
When hooking up both TOF sensors, I had to
I set up the initialization of both TOF sensors first, shut down one
of the sensors, and change the address of the other sensor. Then the first
sensor is turned bck on.
My loop takes around 9 ms to execute , and the current limiting factor is
how long it takes to check if the new data is ready.
One issue that I had faced was the speed of the readings, it would
sometimes get stuck and not continue to display the measurements.
I used .startRanging() instead of .stopRanging() to only iitialize
the sensors once and also used .checkForDataReady() to only print
the appropiate distance reading if there is a new reading available.
This is similar to the implementation of the notification handler
in the previous lab.
</p>
<p>
<img src="assets/bothonline.jpg" alt="..." width="55%" />
</p>
<p>
<script src="https://gist.github.com/eshitasangani/e0a1c7f62ec9fe52366007345cde3470.js"></script>
</p>
</div>
</div>
<div class="d-flex flex-column flex-md-row justify-content-between mb-5">
<div class="flex-grow-1">
<h3 class="mb-0">TOF + Bluetooth</h3>
<p>
Combining the TOF sensor data with the bluetooth functionality from the
previous lab, I slightly altered the temperature command to
instead be able to send TOF sensor data from the Artemis to the computer.
To add a new command, the arduino sketch, the cmd_types file, as well as the demo.ipynb file needed
to be updated. The new command is able to collect data from both
sensors for a specified amount of time and then the computer receives
the reading from both sensors.
</p>
</div>
</div>
</div>
</section>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="js/scripts.js"></script>
</body>
</html>