-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRobotics_Lab.html
More file actions
401 lines (391 loc) · 27 KB
/
Robotics_Lab.html
File metadata and controls
401 lines (391 loc) · 27 KB
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>AI105 Bluefruit Lab</title>
<link href="styles/style.css" rel="stylesheet" type="text/css" />
<script src="https://kit.fontawesome.com/c16180f477.js" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="scripts/map_highlight/jquery.maphilight.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<link rel="stylesheet" href="styles/foundation.min.css">
<link rel="icon" type="image/x-icon" href="Images/favicon.jpg">
</head>
<body>
<div id="roboticsTabModals">
<div class=" modal" id="breadboardRobotModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">What is a Breadboard?</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Prototype boards (commonly called breadboards) are used for
wiring circuits together without soldering. They allow you to rapidly reconfigure
components so you can prototype circuit designs.
If you took the breadboard apart, you would see that each column of holes is connected
by a metal strip. If you connect a wire to one of the holes, anything you plug into
another hole in the same column would be connected to that wire. Note that the gap down the
center
of the board electrically
divides the columns of holes in the top half of the board from those in bottom half.
<img src="Images/Robot/breadboard_backside.jpg" class="img-fluid" alt="Wiring"
style="width: 200px">
</div>
</div>
</div>
</div>
<div class="modal modal-fullscreen-md-down" id="servoButtonModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Starter Code</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<h6>Activity 5</h6>
<pre><code class="Robot_Button_Starter_code language-python"></code></pre>
<!-- <h6>Buttons</h6>
<pre><code class="Buttons_code language-python"></code></pre> -->
</div>
</div>
</div>
</div>
<div class="modal modal-fullscreen-md-down" id="servoLightModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Starter Code</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<h6>Activity 6</h6>
<pre><code class="Robot_Light_starter_code language-python"></code></pre>
</div>
</div>
</div>
</div>
<div class="modal modal-fullscreen-md-down" id="servoMicrophoneModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Starter Code</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<h6>Microphone</h6>
<pre><code class="Microphone_code language-python"></code></pre>
<h6>Servo Control</h6>
<pre><code class="Lab_Robot_code language-python"></code></pre>
</div>
</div>
</div>
</div>
<div class="modal modal-fullscreen-md-down" id="servoAccelModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Starter Code</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<h6>Activity 7</h6>
<pre><code class="Robot_Accelerometer_starter_code language-python"></code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<a class="anchor-link" id="robotTop" aria-label="Link to this section: robotTop"></a>
<ul class="nav nav-pills">
<li class="nav-item">
<a class="nav-link" href="index.html">Welcome</a>
</li>
<li class="nav-item">
<a class="nav-link" href="Initial_Steps.html"><span style="font-size: 1em; color:blue;"><i
class="fa-solid fa-terminal"></i></span> Initial Steps</a>
</li>
<li class="nav-item">
<a class="nav-link" href="Sensor_lab.html"><span style="font-size: 1em; color: blue;"><i
class="fa-solid fa-temperature-three-quarters"></i></span>Temperature Sensor</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="page" href="Exploration.html"><span style="font-size: 1em; color:blue;"><i
class="fa-solid fa-microchip"></i></span> Exploring your board / Sensor Activities</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#"><span style="font-size: 1em; color:blue;"><i
class="fa-solid fa-robot"></i></span> Robotics</a>
</li>
<li class="nav-item">
<a class="nav-link" href="genAIactivity.html"><span style="font-size: 1em; color:blue;"><i
class="fa-solid fa-brain"></i></span> GenAI Activity</a>
</li>
<li class="nav-item">
<a class="nav-link" href="Troubleshooting.html"><span style="font-size: 1em; color: red;"><i
class="fa-solid fa-bug"></i></span> Troubleshooting</a>
</li>
<li class="nav-item">
<a class="nav-link" href="Further Reading.html"><span style="font-size: 1em; color: green;"><i
class="fa-solid fa-book"></i></span> Further Reading</a>
</li>
</ul>
</div>
<div class="row">
<div class="col-sm-2">
<nav class="nav flex-column sticky-top">
<a class="nav-link" href="#robotTop">Top</a>
<a class="nav-link" href="#robotSetup">Setup</a>
<a class="nav-link" href="#Calibration">Calibration</a>
<a class="nav-link" href="#makeARobot">Activity 4</a>
<a class="nav-link" href="#robotExplorations">Activities 5-7</a>
</nav>
</div>
<div class="col-sm-10">
<div class="row">
<h2 class="text-bg-primary p-2">Initial Setup <a class="anchor-link" id="robotSetup"
aria-label="Link to this section: Initial Setup"></a></h2>
<ol class="list-group list-group-numbered">
<!-- <li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
Start with the temperature sensor kit (you'll replace the code).
</div>
</li> -->
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
Secure your servo, one of the servo horns (your choice which one to use), and a 3 pin double sided header.
<br>
<img src="Images/Initial Steps/Servo.jpg" class="img-fluid border border-info"
alt="Servo" style="width: 140px">
<img src="Images/Initial Steps/Servo_horns.png" class="img-fluid border border-info"
alt="Servo horns" style="width: 200px">
<img src="Images/Doublesided_headers.jpg" class="img-fluid border border-info"
alt="Doublesided headers" style="width: 120px">
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
If needed, plug the servo into a 3 pin double sided header (image on the right).
<img src="Images/Robot/pin_in_servo.png" class="img-fluid border border-info"
alt="Doublesided headers" style="width: 150px">
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
If it is not already attached to the servo, select one of the servo horns from the
plastic bag and gently press it on to the servo shaft.
<br>
<img src="Images/Robot/servo_horns.jpg" class="img-fluid border border-info"
alt="Servo Horns" style="height: 175px">
<img src="Images/Robot/servo_wo_horns.jpg" class="img-fluid border border-info"
alt="Servo without horns" style="height: 175px">
<img src="Images/Robot/servo_w_horn.jpg" class="img-fluid border border-info"
alt="Servo with horn" style="height: 175px">
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
Connect <a href="#" data-bs-toggle="tooltip" data-bs-html="true" data-bs-title='<img src="Images/Initial Steps/Jumper_wires.png" class="img-fluid"
alt="jumper wires" style="width: 100px">'>
wire jumpers
</a> from your header (the component you soldered onto your PCB) to your breadboard as shown in the table and image
below. Mouse over the table below to highlight the connections. Then plug in the 3 pin header connected to the servo to the breadboard,
directly beneath where the jumper wires are connected (ensure the servo is oriented correctly). Note: you do not need to use the particular colors shown for each wire.
Also, note that the image shows shortened wires for clarity - your wires are longer.
<table class="table table-hover table-striped">
<thead>
<tr>
<th scope="col">Servo Cable Color</th>
<th scope="col">Header Socket Label</th>
</tr>
</thead>
<tbody>
<tr>
<td id="gndWireTbl">brown or black</td>
<td>GND</td>
</tr>
<tr>
<td id="pwrWireTbl">red</td>
<td id>VOUT</td>
</tr>
<tr>
<td id="ctlWireTbl">orange, yellow, white, or blue</td>
<td>A1</td>
</tr>
</tbody>
</table>
<img class="map img-fluid border border-info border-4" src="Images/Robot/wiring.jpg"
alt="Wiring" style="cursor: pointer; height: 200px" data-bs-toggle="modal"
data-bs-target="#breadboardRobotModal" usemap="#wiringMap" id="robotWiring">
<map name="wiringMap">
<area id="gndWire1" class="grounds" shape="poly"
coords="94,41,99,43,99,46,78,61,51,72,48,67, " href="#" title="Ground Wire"
data-maphilight='{"groupBy":".grounds"}'>
<area id="gndWire2" class="grounds" shape="rect" coords="47,68,52,108" href="#"
title="Ground Wire" data-maphilight='{"groupBy":".grounds"}'>
<area id="pwrWire1" class="pwrWires" shape="poly"
coords="66,40,72,40,72,46,55,61,42,72,37,72,37,67,50,54" href="#"
title="VOUT Wire" data-maphilight='{"groupBy":".pwrWires"}'>
<area id="pwrWire2" class="pwrWires" shape="rect" coords="36,72,44,105" href="#"
title="VOUT Wire" data-maphilight='{"groupBy":".pwrWires"}'>
<area id="ctlWire1" class="ctlWires" shape="poly"
coords="47,39,54,39,54,46,40,59,33,73,26,73,26,67,34,52" href="#"
title="A1 (control wire)" data-maphilight='{"groupBy":".ctlWires"}'>
<area id="ctlWire2" class="ctlWires" shape="rect" coords="26,72,38,104" href="#"
title="A1 (control wire)" data-maphilight='{"groupBy":".ctlWires"}'>
</map>
</div>
</li>
</ol>
</div>
<div class="row">
<h2 class="text-bg-primary p-2">Servo Calibration <a class="anchor-link" id="Calibration"
aria-label="Link to this section: Calibration"></a></h2>
<ol class="list-group list-group-numbered">
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
Copy the code below to your device and run it.
<pre><code class="Servo_code language-python"></code></pre>
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
The servo should now be alternating between spinning full-speed clockwise, stopping,
spinning full-speed counterclockwise, and stopping, as indicated by text in the Mu console and on the Gizmo display.
If the servo doesn't move at all, check the <a href="Troubleshooting.html">troubleshooting step 5</a>.
If the servo is spinning when it is supposed to be stopped, use a small Phillips
screwdriver to turn the potentiometer on the underside of the servo (looks like a tiny
screw head) gently in a clockwise direction. If the servo speeds up, turn the
potentiometer in the other direction until the spinning stops.
<p>
<img src="Images/Robot/servo_screw.jpg" class="img-fluid border border-info"
alt="Wiring" style="height: 150px">
<img src="Images/Robot/servo_adjust.jpg" class="img-fluid border border-info"
alt="Wiring" style="height: 150px">
</p>
Once the servo stops and turns in concert with the text in the Mu console display and Gizmo display, the
servo is calibrated.
</div>
</li>
</ol>
</div>
<div class="row">
<h2 class="text-bg-primary p-2">Make a Robot! (GRADED) <a class="anchor-link" id="makeARobot"
aria-label="Link to this section: Make a Robot!"></a></h2>
<ol class="list-group list-group-numbered">
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
<p>This program below <strong>turns your device into a <u>robot</u></strong> because it performs the <i>“sense-think-act”</i> cycle that all robots do by reading the temperature sensor <i>(sense)</i>, calculating how fast to spin the servo based on that temperature <i>(think)</i>, and then sending a signal to the servo motor to make it spin at an appropriate speed <i>(act)</i>.</p>
<p>Copy the code below to your device and run it by clicking the "Save" button. The motor will be off or spinning slowly at low temperatures (such as ambient room temperature) and will spin rapidly at higher temperatures (like when you touch the temperature sensor with a finger and heat it up). </p>
<pre><code class="Lab_Robot_code language-python"></code></pre>
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto position-relative">
<p>It is your job to trace the remaining above program and identify what lines represent the SENSING, THINKING, and ACTING for this robot. </p>
<p>Note: Your temperature and RPM may vary from the image below depending on the room temperature.</p>
<img src="Images/Robot/robTempSens.png" class="img-fluid" alt="Temperature Sensor Robot"
style="height: 300px">
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
<p style="font-size: 18em; color: red;">
<i class="fa-solid fa-hand"></i>
</p>
<p class="text-white bg-danger">After you review the program and locate the relevant lines, you must explain to your instructor which parts of the code perform the Sense, Think, and Act steps. Be specific by referencing the line numbers. This explanation is required and is part of your grade!</p>
</div>
</li>
</ol>
</div>
<div class="row">
<h2 class="text-bg-primary p-2">Robot Activities (GRADED) <a class="anchor-link" id="robotExplorations"
aria-label="Link to this section: Explorations"></a></h2>
<h5 class="text-warning bg-dark">You will be graded on your successful completion of the activities below. Starter code is provided; however, it is necessary to modify the code to complete the task. Use your experience with Python programming concepts (iteration, conditionals, order of operations, functions, etc.) and the previous examples to complete each task.
</h5>
<div class="fw-bold">Robot Activities</div>
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-start">
<div>
<span class="me-2"><strong> Activity 5:</strong></span>
<div class="ms-2 me-auto">
Create a button-activated propeller! Write a program that spins the servo counterclockwise while button B is held down
and clockwise while button A is held down. If neither button is pushed, the servo
shouldn't rotate. You choose the speed.
<button type="button" class="btn btn-info btn-sm" data-bs-toggle="modal"
data-bs-target="#servoButtonModal">
Starter Code
</button>
</div>
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start">
<div>
<span class="me-2"><strong> Activity 6:</strong></span>
<div class="ms-2 me-auto">
Create a light-activated fan! Write a program that will adjust the servo's speed based on input from the
light sensor.
The brighter it is, the faster the servo should spin.
<button type="button" class="btn btn-info btn-sm" data-bs-toggle="modal"
data-bs-target="#servoLightModal">
Starter Code
</button>
</div>
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start">
<div>
<span class="me-2"><strong> Activity 7:</strong></span>
<div class="ms-2 me-auto">
Create a tilt-activated motor with NeoPixel light tilt indicators! Write a program that continuously adjusts the servo's speed based on input from the
accelerometer.
If the device is tipped to the left, the servo should spin counterclockwise.
If it's
tipped to the right, the servo should spin clockwise. The more it's tipped,
the faster
the servo should spin.
<br><br>Additionally, use the NeoPixel lights to visually indicate the direction of the tilt.
<ul>
<li>If the device is tilted to the right, the right half of the NeoPixels should light up green.</li>
<li>If the device is tilted to the left, the left half of the NeoPixels should light up green.</li>
</ul>
This provides both motion and visual feedback based on the tilt of the device!
<button type="button" class="btn btn-info btn-sm" data-bs-toggle="modal"
data-bs-target="#servoAccelModal">
Starter Code
</button>
</div>
</div>
</li>
</ul>
<p style="font-size: 18em; color: red;">
<i class="fa-solid fa-hand"></i>
</p>
<p class="text-white bg-danger">Verify this with your instructor. This is part of your
grade! You must complete all the robot activities before the end of Lab 3. </p>
<h5 class="text-warning bg-dark"> When complete with all in class activities, you can move onto the GenAI Activity.
</h5>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
<script src="scripts/script.js"></script>
<script src="scripts/highlight.min.js"></script>
</body>
<br>
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<li class="page-item">
<a class="page-link" href="Exploration.html" tabindex="-1">Previous (Exploration)</a>
</li>
<a class="page-link" href="genAIactivity.html">Next (GenAI Activity)</a>
</li>
</ul>
</nav>
</html>