Microcontroller Prototypes with Arduino and a 3D Printer
Microcontroller Prototypes with Arduino and a 3D Printer
Learn, Program, Manufacture
Dimosthenis E. Bolanakis
Department of Air Force Science
Hellenic Air Force Academy
Athens
Greece
Contents
About the Author xi List of Figures xii List of Tables xxvi Preface xxvii
Acknowledgments xxx Abbreviations xxxi Syllabus xxxv
1 The Art of Embedded Computers 1
Overview of Embedded Computers and Their Interdisciplinarity 1 Computer vs. Embedded Computer
Programming and Application Development 2
Group 1: Programmable Logic Devices 3
Group 2: Reconfigurable Computers 4
Group 3: Microcomputers 4
Group 4: Single-Board Computers 6
Group 5: Mobile Computing Devices 6
TPACK Analysis Toward Teaching and Learning Microcomputers 7 TPACK Analysis of the
Interdisciplinary Microcontroller Technology 7 Content Knowledge (The What) 8
Technology Knowledge (The Why) 9
Pedagogical Knowledge (The How) 11
From Computational Thinking (CT) to Micro-CT (μCT) 12 CT Requirement and Embedded Computers 13
Microcomputers and Abstraction Process 14
The μCT Concept: An Onion Learning Framework 15
“Transparent” Teaching Methods 17
The Impact of Microcontroller Technology on the Maker Industry 19
Hardware Advancement in μC Technology 20
Software Advancement in μC Technology 23
The Impact of Arduino on the μC Community 23
Where Is Creativity in Embedded Computing Devices Hidden? 26
Creativity in Mobile Computing Devices: Travel Light, Innovate Readily! 26
Communication with the Outside World: Sensors, Actuators, and Interfaces 28
Conclusion 30
2 Embedded Programming with Arduino 31
NumberRepresentationand Special-FunctionCodes 31
Arduinoand CCommonLanguageReference 34
Workingwith Data(Variables,Constants,and Arrays) 36
ArduinoUARTInterfacetotheOutsideWorld(PrintingData) 39
ArduinoEx.2–1 40
ArduinoEx.2–2 44
ProgramFlowof Control(Arithmeticand BitwiseOperations) 47
ArduinoUARTInterface(FlowofControlandArithmetic/
BitwiseExamples) 52
ArduinoEx.2–3 52
ArduinoEx.2–4 53
ArduinoEx.2–5 54
ArduinoEx.2–6 59
ArduinoEx.2–7 63
CodeDecomposition(Functionsand Directives) 69
ArduinoEx.2–8 69
Conclusion 72
Problem2–1(DataOutputfromtheμCDevice:DatatypesandBytesReservedbythehw) 73
Problem2–2(DataOutputfromtheμCDevice:LogicalOperatorsin Control Flow) 73
Problem2–3(DataInputtotheμCDevice:ArithmeticandBitwiseOperations) 73
Problem2–4(CodeDecomposition) 73
3 Hardware Interface with the Outside World 75
DigitalPinInterface 75
ArduinoEx.3.1 76
ArduinoEx.3.2 77
ArduinoEx.3.3 81
ArduinoEx.3.4 82
ArduinoEx.3.5 84
AnalogPinInterface 86
ArduinoEx.3.6 87
ArduinoEx.3.7 91
InterruptPinInterface 91
ArduinoEx.3.8 94
UARTSerialInterface 96
ArduinoEx.3.9 97
ArduinoEx.3.10 98
ArduinoEx.3.11 99
SPISerialInterface 101
ArduinoEx.3.12 103Contents ix
ArduinoEx.3.13 110
ArduinoEx.3.14 115
ArduinoEx.3.15 121
I2CSerialInterface 122
ArduinoEx.3.16 125
ArduinoEx.3.17 130
ArduinoEx.3.18 135
ArduinoEx.3.19 142
Conclusion 146
Problem3.1(DataInputand Outputto/fromthe μCUsingPush-Button and LED IOUnits) 147
Problem3.2(PWM) 147
Problem3.3(UART,SPI,I2C) 147
4 Sensors and Data Acquisition 149
EnvironmentalMeasurementswith ArduinoUno 149
ArduinoEx.4–1 150
DAQAccompanyingSoftwareof theEx.4–1 157
DAQAccompanyingSoftwarewithGraphicalMonitoring
FeatureViagnuplot 166
ArduinoEx.4–2 169
Orientation,Motion,and GestureDetectionwith Teensy3.2 171
ArduinoEx.4–3 173
ArduinoEx.4–4 174
ArduinoEx.4–5 177
ArduinoEx.4–6 184
DAQAccompanyingSoftwareforOrientation,Motion,
and Gesture Detection with gnuplot 191
RealTimeMonitoringwithOpenGL 193
DistanceDetectionand1DGestureRecognitionwithTinyZero 200
ArduinoEx.4–7 201
ArduinoEx.4–8 205
DAQAccompanyingSoftwareforDistanceMeasurements 209
ColorSensingandWirelessMonitoringwithMicro:bit 211
ArduinoEx.4–9 212
ArduinoEx.4–10 216
OpenGLExampleApplyingtoRGBSensing 220
ArduinoEx.4–11 222
Conclusion 226
Problem4–1(DataAcquisitionofAtmosphericPressure) 226
Problem4–2(FusionofLinearAccelerationand
BarometricAltitude) 226
Problem4–3(1DGestureRecognition) 226
Problem4–4 (ColorSensing) 226x Contents
5 Tinkering and Prototyping with 3D Printing Technology 227
TinkeringwithaLow-costRCCar 227
ArduinoEx.5.1 231
ArduinoEx.5.2 236
APrototypeInteractiveGamefor SensoryPlay 237
HardwareBoardsof thePrototypeSystem 238
AssemblyProcessofthe3DPrintedPartsoftheSystem’sEnclosure 243
FirmwareCodeDesignand UserInstructions 249
ArduinoEx.5.3 250
ArduinoEx.5.4 253
ArduinoEx.5.5 256
ArduinoEx.5.6 260
3DPrinting 262
Modeling3DObjectswithFreeCADSoftware 262
Preparingthe3DPrintswithUltimakerCuraSoftware 269
3DPrintingwithPrimaCreatorP120 272
PresentationoftheRest3DModelsofthePrototypeInteractiveGame 276
PrototypeB(Modelingthebattery.stlPart) 276
PrototypeC(Modelingthebooster.stlPart) 278
PrototypeD(Modelingthespeaker.stlPart) 283
PrototypeE(Modelingthecover.stlPart) 284
PrototypeF(Modelingthebutton.stlPart) 287
PrototypeG(Modelingthesensor.stlPart) 290
PrototypeH(Modelingthefront.stlPart) 290
Conclusion 294
Problem5.1(TinkeringwithaLow-costRCCar) 294
Problem5.2(APrototypeInteractiveGamefor SensoryPlay) 294
Problem5.3(APrototypeInteractiveGamefor SensoryPlay) 295
Problem5.4(APrototypeInteractiveGamefor SensoryPlay) 296
Problem5.5(3DPrinting) 296
References 297
Index
a
absolute height 169, 187, 189, 190, 193, 226
absolute orientation 177, 181
acknowledge 4, 35, 123, 128, 129
b
baud rate 41, 54, 88, 94, 96, 98, 101, 154,
158–160, 162, 166, 169
bitmask 65, 80, 81, 84, 104, 106
bootloader 19, 22, 24, 43, 57, 173, 204, 205
bottom‐up design approach 249, 250, 253,
256, 260
byte 31, 34, 36–39, 43–45, 47, 56, 57, 59, 61, 63,
64, 66, 71, 73, 77, 97, 103–105, 108, 110, 113,
119, 123, 125, 126, 128, 134, 135, 138, 140,
159–162, 180, 184
c
class 3, 11, 15, 17, 116–118, 121, 135, 136, 140,
208, 223, 251, 253
clock phase (CPHA) 101, 103, 116, 118, 119
clock polarity (CPOL) 101, 103, 116, 118
clock stretching 136
code decomposition 69–73
coefficients (coeffs) 108–110, 112, 113,
128–130, 134, 155, 171
complement representation 33, 63, 66, 69, 71, 72
conditional branch 49, 50
constant 36–47, 50, 94, 205, 206, 251, 253
constructor 116–118, 121, 135, 136, 224
creativity 26–30, 149, 226, 294
critical thinking 187
d
data acquisition (DAQ) 4, 92, 93, 106, 108, 126,
149–226, 249
datatypes 36–39, 44, 45, 47, 50, 52, 54, 59, 69,
73, 161, 221, 258
debounce delay 84, 94
decimal 31–34, 38, 39, 43–47, 63, 89, 91, 94,
139, 162
duty cycle (DC) 86, 236
e
embedded programming 31–73
Euler angles 177, 179–184, 191–200, 220, 221
external interrupt 91, 93–95
f
falling edge 94, 101, 103, 105, 123
file pointer 164, 167–168
finite loop 48, 50, 51, 56
flowchart 12, 47, 48, 51, 52, 54, 55, 59, 60, 76,
83–85, 110, 111
flow of control 47–68
fractional digits 47
function‐like macros 72, 77, 79, 80
g
gimbal lock 180
global variables 43, 44, 70, 76, 77, 83, 110,
154, 236
gravity vector 179–184, 187, 188, 191–194
h
header file 2, 69–71, 110, 116, 117, 135, 136,
157–160, 164, 166, 178, 196, 206, 253, 258
hexadecimal 31, 32, 34, 38, 43, 44, 47, 52, 53,
59, 66, 104, 105, 108, 126, 216
i
idle state 97, 118
infinite loop 51, 53
initialization expression 50–51
international barometric formula 189, 190
interrupt service routine (ISR) 94
k
keywords 39, 44, 48–50, 56, 69, 116, 121, 135
l
labels 48, 94
latency 81, 82
least significant bit (LSB) 33, 97, 119, 123, 125,
126, 138–140, 181, 184
linear acceleration 179–184, 187, 191–195, 226
long‐cycle development era 1, 20, 23
loop counter 51, 52, 54, 119, 138, 162, 166, 168,
207, 208
LSB. see least significant bit (LSB)
m
Makers 1, 5, 7, 19–26, 28, 30, 171, 173, 200,
201, 205, 227, 262
micro‐computational thinking (μCT)
1, 12–19
most significant bit (MSB) 32, 33, 65, 104–106,
108, 112, 119, 123, 138, 181
multiple‐byte read 108–110, 112, 113, 125, 128,
130, 134, 135, 140, 142, 143
multiway branch 48
n
nibble 31, 34–36
numeral systems 31–34, 38, 59, 62, 67
numeric string 59–64, 66, 69, 70, 155, 162, 166,
168, 193, 221
o
object‐like macros 72, 76, 77
output data rate (ODR) 150–152, 154–156, 161,
162, 166, 168, 182
p
pipe 166, 168
pipe pointer 166
pointer 24, 54–59, 63, 66, 69, 70, 158–160, 163,
164, 166–168
polling 91
positional notation 33, 59, 62, 67
postfix 31, 51
predefined iterations 50–52
prefix 31, 38, 51
primitive shapes 262, 263
proprioception 238, 250, 260
pseudo‐architecture 13, 17–19
pseudo‐code 12, 13, 17–19, 47, 51, 69
pseudo‐hardware 13, 17–19
pseudo‐timing diagram 13, 17, 18
pull‐up resistor 83, 85, 94, 123
q
quotient 37, 62, 63
r
random number generator 260
raw measurements 108
reference voltage 87, 88, 96
remainder 37, 62, 63
RGB color model 216, 220
rising edge 101, 103
s
sensor fusion 177, 179, 182
sensory play 237–262, 294–296
sequential programming 4, 34, 47, 73, 75
short‐cycle development era 1, 20, 22, 30
simplicity in design 187, 202, 262, 294
start bit 97
stop bit 42, 97, 158, 159
string 38, 43–45, 47, 56–64, 66, 69, 70, 73, 99,
155, 158, 161, 162, 164, 166, 168, 174, 177, 184,
193, 196, 204, 210, 215, 221, 224, 226, 232, 233
subscript 16, 37, 38, 55, 56, 63, 66, 71
switch bounce 84, 94, 95
t
technological pedagogical content knowledge
(TPACK) 1, 7–12, 30
tinker 227
TPACK. see technological pedagogical content
knowledge (TPACK)
transparent teaching methods/strategies 12,
13, 17–19
true/false state 33
truth table 65, 103
typecasting 37, 39, 44, 45, 47, 52, 160
u
unconditional branch 48
update expression 51
v
variable scope 53
w
weighted codes 34
word 14, 26, 27, 31
كلمة سر فك الضغط : books-world.net
The Unzip Password : books-world.net


تعليقات