References to figures are in italics.
alarms
Arduino collision alarm, 178–183
Arduino door buzzer alarm, 105–107
Arduino fire alarm, 116–118
Arduino glass break alarm, 157–160
Arduino HC-SR04 distance sensor intruder alarm, 172–178
Arduino infrared motion detector alarm, 163–167
Arduino rooster alarm, 144–148
Arduino TFT display door entry alarm with SD card logging, 199–206
Arduino water detector alarm, 138–141
Raspberry Pi fire alarm, 119–121
Raspberry Pi glass break alarm, 160–162
Raspberry Pi infrared collision proximity sensor alarm, 124–126
Raspberry Pi motion detection alarm, 167–171
Raspberry Pi reed switch door alarm, 109–111
analog input, 8
analog joysticks, 69
ArduCAM class (code listing), 33–34
ArduCAM minicamera library software installation, 207
ArduCAM OV2640 minicamera, 206, 207
mini portable programmable digital camera system, 207–220
Arduino
logo, 1
overview, 1
Arduino cameras, 206–207
See also ArduCAM OV2640 minicamera
Arduino door buzzer alarm (code listing), 107
Arduino example projects
collision alarm, 178–183
DHT11 temperature and humidity sensor test, 129–136
door buzzer alarm, 105–107
fire alarm, 116–118
flame sensor test, 114–116
glass break alarm, 157–160
HC-SR04 distance sensor intruder alarm, 172–178
infrared motion detector alarm, 163–167
infrared proximity/collision detector, 122–124
joystick test, 69–72
LED buzzer siren, 51–53
light clapper, 149–152
random RGB LED colors using a potentiometer, 53–56
reed switch test, 104–105
RGB LED, 48–51
rooster alarm, 144–148
rotary encoder controlling an RGB LED, 87–94
rotary encoder test, 84–87
serial monitor and LED indicator, 46–48
“Simon Says” game, 72–84
soil moisture detector, 141–144
TFT display and SD card reader/writer test, 186–198
TFT display door entry alarm with SD card logging, 199–206
TMP36 temperature sensor test, 112–113
water detector alarm, 138–141
Arduino fire alarm (code listing), 117
Arduino infrared motion detector alarm (code listing), 165–166
Arduino infrared proximity/collision detector (code listing), 123–124
Arduino joystick test (code listing), 71
Arduino reed switch test (code listing), 105
Arduino RGB LED example (code listing), 50
Arduino rotary encoder test (code listing), 86
Arduino soil moisture detector (code listing), 143–144
Arduino SRL, 2
Arduino TFT display screen, 185–186
door entry alarm with SD card logging, 199–206
and SD card reader/writer test, 186–198
Arduino TMP36 test (code listing), 113
Arduino Uno
analog input, 8
communication, 6–7
overview, 2–3
specifications, 4
USB connection ports, 4
audio output jack, 18
basic Python class (code listing), 38
bitwise operators, 29–30
“Blink” sketch (code listing), 14
blinker counter, 59–61
blinking LED (code listing), 22
boards, 13
Boolean operators, 29
break statement, 33
ButtonPressed( ) function (code listing), 80
buzzers, 44
Arduino collision alarm, 178–183
Arduino door buzzer alarm, 105–107
Arduino fire alarm, 116–118
Arduino glass break alarm, 157–160
Arduino HC-SR04 distance sensor intruder alarm, 172–178
Arduino infrared motion detector alarm, 163–167
Arduino infrared proximity/collision detector, 122–124
Arduino LED buzzer siren, 51–53
Arduino rooster alarm, 144–148
Arduino water detector alarm, 138–141
cameras. See ArduCAM OV2640 minicamera; Arduino cameras
CaptureImage( ) function (code listing), 214
C/C++ language
arithmetic operators, 28
bitwise operators, 29–30
Boolean operators, 29
comments, 25
comparison operators, 28–29
compound operators, 30–31
constants, 26–27
control structures, 32–33
conversion, 32
curly braces, 27
data types, 25–26
define statement, 27
include statement, 27
pointer access operators, 31
semicolon, 27
variable scope, 31
CheckTurnOnOffLight( ) function (code listing), 151
classes, 37–38
inheritance, 39
collision alarm, 178–183
color codes, resistors, 43
color selector, 62–65
communication, Arduino Uno, 6–7
comparison operators, 28–29
compound operators, 30–31
constants, 26–27
control flow statements, 36–37
control structures, 32–33
conversion, 32
curly braces, 27
data types, 25–26
debouncing, 75
def keyword, 37
define statement, 27
delay( ) function, 17
development system requirements, 10
DHT11 sensor. See temperature and humidity sensors
dictionaries, 36
display screen. See Arduino TFT display screen
Display Serial Interface (DSI), 18
DisplayEndScreen( ) function (code listing), 196
DisplayUserSelectionLED( ) function (code listing), 82
distance sensors, 171–172
Arduino collision alarm, 178–183
Arduino HC-SR04 distance sensor intruder alarm, 172–178
door buzzer alarm, 105–107
door entry alarm with SD card logging, 199–206
DrawCircle( ) function (code listing), 192
DrawLines( ) function (code listing), 190
DrawPoint( ) function (code listing), 193
DrawRectangle( ) function (code listing), 191
drivers, 13
duty cycle, 61
electric circuits, 41
electronics, basics of, 41–42
elif statement, 36
Ethernet sockets, 18
EvaluateUserEntry( ) function (code listing), 83
fading a LED (code listing), 62
flame sensor test (code listing), 115
Arduino fire alarm, 116–118
Arduino flame sensor test, 114–116
Raspberry Pi fire alarm, 119–121
Raspberry Pi flame sensor test, 118–119
FlashAllLEDS( ) function (code listing), 83
functions, in Python, 37
GetDistanceInches( ) function (code listing), 176, 181
GetJoyStickX( ) function (code listing), 82
GetTempFarenheit( ) function (code listing), 136
glass break alarm (code listing), 159
glass break alarms
Arduino, 157–160
Raspberry Pi, 160–162
global variables, 31
grounded circuits, 41
hands-on examples
Arduino ArduCAM OV2640 mini portable programmable digital camera system, 207–220
Arduino collision alarm, 178–183
Arduino DHT11 temperature and humidity sensor test, 129–136
Arduino door buzzer alarm, 105–107
Arduino fire alarm, 116–118
Arduino flame sensor test, 114–116
Arduino glass break alarm, 157–160
Arduino HC-SR04 distance sensor intruder alarm, 172–178
Arduino infrared motion detector alarm, 163–167
Arduino infrared proximity/collision detector, 122–124
Arduino joystick test, 69–72
Arduino LED buzzer siren, 51–53
Arduino light clapper, 149–152
Arduino random RGB LED colors using a potentiometer, 53–56
Arduino reed switch test, 104–105
Arduino RGB LED, 48–51
Arduino RGB light switch, 56–59
Arduino rooster alarm, 144–148
Arduino rotary encoder controlling an RGB LED, 87–94
Arduino rotary encoder test, 84–87
Arduino serial monitor and LED indicator, 46–48
Arduino “Simon Says” game, 72–84
Arduino soil moisture detector, 141–144
Arduino TFT display and SD card reader/writer test, 186–198
Arduino TFT display door entry alarm with SD card logging, 199–206
Arduino TMP36 temperature sensor test, 112–113
Arduino water detector alarm, 138–141
“Hello World” program with a LED, 12–16, 17
Raspberry Pi fire alarm, 119–121
Raspberry Pi flame sensor test, 118–119
Raspberry Pi glass break alarm, 160–162
Raspberry Pi “Hello World” program with a LED, 21–23
Raspberry Pi infrared collision/proximity sensor alarm, 124–126
Raspberry Pi LED blinker counter, 59–61
Raspberry Pi LED fading, 61–62
Raspberry Pi LED fading up and down using a button, 65–68
Raspberry Pi motion detection alarm, 167–171
Raspberry Pi “Out of Breath” game, 152–156
Raspberry Pi reed switch door alarm, 109–111
Raspberry Pi reed switch test, 108–109
Raspberry Pi RGB LED color selector, 62–65
Raspberry Pi rotary encoder LED blinker, 96–101
Raspberry Pi rotary encoder test, 94–96
HC-SR04. See distance sensors
HC-SR501. See infrared motion detectors
HDMI port, 18
“Hello World” program with a LED, 12–16
playing around with the code, 17
Raspberry Pi “Hello World” program with a LED, 21–23
IDE software, 10–12
installing, 13
IDLE development environment. See Python IDLE development environment
if else statement, 32
include statement, 27
indentation, 35
infrared motion detectors, 162, 163
Arduino infrared motion detector alarm, 163–167
Raspberry Pi motion detection alarm, 167–171
infrared proximity/collision sensors, 121, 122
Arduino infrared proximity/collision detector, 122–124
Raspberry Pi infrared collision/proximity sensor alarm, 124–126
inheritance, 39
InitializeCamera( ) function (code listing), 212
interpreted language, 34
See also Python for Raspberry Pi
IsSoundPartOfUniqueClap( ) function (code listing), 150
joysticks, 69
Arduino joystick test, 69–72
Arduino “Simon Says” game, 72–84
LED blinker counter (code listing), 60
LED buzzer siren program (code listing), 52–53
LEDs, 43–44
Arduino door buzzer alarm, 105–107
Arduino infrared motion detector alarm, 163–167
Arduino LED buzzer siren, 51–53
Arduino light clapper, 149–152
Arduino random RGB LED colors using a potentiometer, 53–56
Arduino RGB LED, 48–51
Arduino RGB light switch, 56–59
Arduino rotary encoder controlling an RGB LED, 87–94
Arduino Serial Monitor and LED indicator, 46–48
Arduino “Simon Says” game, 72–84
Arduino soil moisture detector, 141–144
Raspberry Pi “Hello World” program with a LED, 21–23
Raspberry Pi infrared motion detection alarm, 167–171
Raspberry Pi LED blinker counter, 59–61
Raspberry Pi LED fading, 61–62
Raspberry Pi LED fading up and down using a button, 65–68
Raspberry Pi motion detection alarm, 167–171
Raspberry Pi “Out of Breath” game, 152–156
Raspberry Pi RGB LED color selector, 62–65
Raspberry Pi rotary encoder LED blinker, 96–101
See also RGB LEDs
light clapper, 149–152
light detectors, 144
Arduino rooster alarm, 144–148
light switch, 56–59
light-emitting diodes. See LEDs
Linux, Arduino IDE files for, 10
listings. See specific functions
lists, 35
LoadImage( ) function (code listing), 189
LoadTestImage( ) function (code listing), 189
local variables, 31
loop( ) function (code listing), 17, 77–79, 94, 130–131, 141, 148, 152, 177, 183, 196, 205, 218
Mac, Arduino IDE files for, 10
magnetic field sensors. See reed switches
memory saver include file, 207
micro SD card reader, 18–19
micro USB socket, 18
MicrosecondsToInches( ) function (code listing), 175, 180
mini portable programmable digital camera system, 207–220
MIPi camera serial interface (CSI), 18
motion detectors. See infrared motion detectors
New File button, 11
object-oriented language, 34
See also Python for Raspberry Pi
object-oriented programming, 33
Ohm’s law, 42
OOP. See object-oriented programming
Open File button, 11
operators
bitwise, 29–30
Boolean, 29
comparison, 28–29
compound, 30–31
pointer access, 31
“Out of Breath” game, 152–156
“Out of Breath” game (code listing), 154–155
parallel connections, 42
pass statement, 37
photo resistors, 144
Arduino rooster alarm, 144–148
piezo buzzers, 44
PlayComputerEntryOnLED( ) function (code listing), 80
pointer access operators, 31
potentiometers, 44–45
Arduino random RGB LED colors using a potentiometer, 53–56
PrintBrightnessLevel( ) function (code listing), 146–147
PrintComputerEntry( ) function (code listing), 79
PrintData( ) function (code listing), 136
PrintDebug( ) function (code listing), 93
PrintDebugInfo( ) function (code listing), 183
PrintMoistureStatus( ) function (code listing), 140
ProcessButtonRelease( ) function (code listing), 92–93
ProcessJoyStickMovement( ) function (code listing), 81
ProcessRotaryEncoder( ) function (code listing), 90–91
ProcessWaitingState( ) function (code listing), 175, 204
pulse-width modulation (PWM), 5
push button LED fader (code listing), 67
push buttons, 45
Arduino ArduCAM OV2640 mini portable programmable digital camera system, 207–220
Arduino fire alarm, 116–118
Arduino glass break alarm, 157–160
Arduino HC-SR04 distance sensor intruder alarm, 172–178
Arduino infrared motion detector alarm, 160–162
Arduino RGB light switch, 56–59
Arduino “Simon Says” game, 72–84
Arduino TFT display door entry alarm with SD card logging, 199–206
Arduino water detector alarm, 138–141
Raspberry Pi fire alarm, 119–121
Raspberry Pi glass break alarm, 160–162
Raspberry Pi infrared motion detection alarm, 167–171
Raspberry Pi LED fading up and down using a button, 65–68
Python for Raspberry Pi
arithmetic operators, 35
class inheritance, 39
classes, 37–38
comments, 34
control flow statements, 36–37
functions, 37
modules, 37
overview, 34
statements and indentation, 35
variable types, 35–36
Python IDLE development environment, 21
random colors using a potentiometer (code listing), 55–56
range( ) function, 36
Raspberry Pi 3 Model B, 17–18
hardware overview, 18–19
system setup, 20–21
Raspberry Pi collision/proximity alarm (code listing), 126
Raspberry Pi door alarm (code listing), 110
Raspberry Pi example projects
fire alarm, 119–121
flame sensor test, 118–119
glass break alarm, 160–162
“Hello World” program with a LED, 21–23
infrared collision proximity sensor alarm, 124–126
LED blinker counter, 59–61
LED fading, 61–62
LED fading up and down using a button, 65–68
motion detection alarm, 167–171
“Out of Breath” game, 152–156
reed switch door alarm, 109–111
reed switch test, 108–109
RGB LED color selector, 62–65
rotary encoder LED blinker, 96–101
rotary encoder test, 94–96
Raspberry Pi fire alarm (code listing), 121
Raspberry Pi flame sensor test (code listing), 119
Raspberry Pi glass break alarm (code listing), 161–162
Raspberry Pi motion detection alarm (code listing), 169–170
Raspberry Pi, overview, 17
Raspberry Pi reed switch test (code listing), 109
Raspberry Pi rotary encoder test (code listing), 96
ReadDataEntryDHT11( ) function (code listing), 134–135
ReadDHT11StartSignal( ) function (code listing), 132–133
ReadFifoBurstWriteSDCard( ) function (code listing), 215–216
ReadFile( ) function (code listing), 195
ReadLogFile( ) function (code listing), 203
Arduino door buzzer alarm, 105–107
Arduino reed switch test, 104–105
Arduino TFT display door entry alarm with SD card logging, 199–206
Raspberry Pi reed switch door alarm, 109–111
Raspberry Pi reed switch test, 108–109
Reset button, 5
ResetData( ) function (code listing), 131
ResetSoundConfirmation( ) function (code listing), 147
resistors, 42–43
Arduino ArduCAM OV2640 mini portable programmable digital camera system, 207–220
Arduino fire alarm, 116–118
Arduino glass break alarm, 157–160
Arduino HC-SR04 distance sensor intruder alarm, 172–178
Arduino infrared motion detector alarm, 160–162
Arduino RGB light switch, 56–59
Arduino rooster alarm, 144–148
Arduino TFT display door entry alarm with SD card logging, 199–206
Arduino water detector alarm, 138–141
Raspberry Pi fire alarm, 119–121
Raspberry Pi glass break alarm, 160–162
Raspberry Pi infrared motion detection alarm, 167–171
Raspberry Pi LED blinker counter, 59–61
Raspberry Pi LED fading, 61–62
Raspberry Pi LED fading up and down using a button, 65–68
return keyword, 37
return statement, 33
RGB LED color selector (code listing), 64–65
RGB LEDs, 44
Arduino random RGB LED colors using a potentiometer, 53–56
Arduino RGB LED, 48–51
Arduino RGB light switch, 56–59
Raspberry Pi RGB LED color selector, 62–65
See also LEDs
RGB light switch (code listing), 58–59
rooster alarm, 144–148
RoosterCall( ) function (code listing), 147
rotary encoder controller, 84
Arduino rotary encoder controlling an RGB LED, 87–94
Arduino rotary encoder test, 84–87
Raspberry Pi rotary encoder LED blinker, 96–101
Raspberry Pi rotary encoder test, 94–96
rotary encoder LED controller (code listing), 99–101
rotary encoder RGB LED controller (code listing), 89
Save button, 12
SD card reader/writer, 185–186
TFT display and SD card reader/writer test, 186–198
SelectComputerEntry( ) function (code listing), 79
Selection2String( ) function (code listing), 93
semicolon, 27
SendTriggerSignal( ) function (code listing), 175, 181
sensors
distance sensors, 171–183
flame sensors, 113–119
infrared motion detectors, 162–171
infrared proximity/collision sensors, 121–126
light detectors/photo resistors, 144–148
sound detectors, 148–156
temperature and humidity sensors, 126–136
temperature sensor, 111–113
water detectors/soil moisture sensors, 137–144
sequences, 38
Serial Monitor and LED Blink (code listing), 47
Serial Monitor and LED Blink sketch, 47
Serial Monitor button, 12
Serial Monitor, communication, 6
series connections, 42
SetCameraResolution( ) function (code listing), 217
SetDistanceTrip( ) function (code listing), 176
SetLEDColor( ) function (code listing), 89
sets, 35–36
setup( ) function (code listing), 76, 90, 130, 140, 146, 150, 174, 180, 189, 202, 213
SetupLEDPinMapping( ) function (code listing), 76
SetupLEDS( ) function (code listing), 76
“Simon Says” game, 72–84
LED buzzer siren program, 52–53
Serial Monitor and LED Blink, 47
Smart Projects. See Arduino SRL
soil moisture sensors, 137–138, 141–144
See also water detectors
sound detectors, 148
Arduino glass break alarm, 157–160
Arduino light clapper, 149–152
Raspberry Pi glass break alarm, 160–162
Raspberry Pi “Out of Breath” game, 152–156
StartSignalToDHT11( ) function (code listing), 131
strings, 35
temperature and humidity sensors, 126
Arduino DHT11 temperature and humidity sensor test, 129–136
operational information, 127
requesting data from the DHT11 sensor, 127–128
temperature sensors, 111–113
text editors, 21
TFT display screen. See Arduino TFT display screen
TMP36 temperature sensor, 111–113
tolerance, 43
tuple, 35
TurnOffAllLEDS( ) function (code listing), 82
UpdateBuzzer( ) function (code listing), 182
UpdateRGBLED( ) function (code listing), 91–92
Upload button, 11
USB cable, 13
variable scope, 31
variable types, 35–36
Verify button, 11
video output jack, 18
water detectors, 137–138
alarm, 138–141
See also soil moisture sensors
Windows, Arduino IDE files for, 10
WriteFile( ) function (code listing), 194
WriteLogFile( ) function (code listing), 203