Introduction |
|
xix | |
|
Part I Arduino Engineering Basics |
|
|
1 | (60) |
|
Chapter 1 Getting Up and Blinking with the Arduino |
|
|
3 | (16) |
|
Exploring the Arduino Ecosystem |
|
|
4 | (9) |
|
|
4 | (2) |
|
|
6 | (1) |
|
|
6 | (1) |
|
|
7 | (1) |
|
|
7 | (1) |
|
|
8 | (5) |
|
Creating Your First Program |
|
|
13 | (5) |
|
Downloading and Installing the Arduino IDE |
|
|
13 | (1) |
|
Running the IDE and Connecting to the Arduino |
|
|
14 | (2) |
|
Breaking Down Your First Program |
|
|
16 | (2) |
|
|
18 | (1) |
|
Chapter 2 Digital Inputs, Outputs, and Pulse-Width Modulation |
|
|
19 | (22) |
|
|
20 | (1) |
|
Wiring Up an LED and Using Breadboards |
|
|
20 | (1) |
|
|
21 | (1) |
|
|
22 | (2) |
|
Programming Digital Outputs |
|
|
24 | (1) |
|
|
25 | (2) |
|
Pulse-Width Modulation with analogWrite() |
|
|
27 | (8) |
|
|
29 | (1) |
|
Reading Digital Inputs with Pulldown Resistors |
|
|
29 | (3) |
|
Working with "Bouncy" Buttons |
|
|
32 | (3) |
|
Building a Controllable RGB LED Nightlight |
|
|
35 | (4) |
|
|
39 | (2) |
|
Chapter 3 Reading Analog Sensors |
|
|
41 | (20) |
|
Understanding Analog and Digital Signals |
|
|
42 | (3) |
|
Comparing Analog and Digital Signals |
|
|
43 | (1) |
|
Converting an Analog Signal to a Digital One |
|
|
44 | (1) |
|
Reading Analog Sensors with the Arduino: analogRead() |
|
|
45 | (9) |
|
|
45 | (5) |
|
|
50 | (2) |
|
Working with Analog Sensors to Sense Temperature |
|
|
52 | (2) |
|
Using Variable Resistors to Make Your Own Analog Sensors |
|
|
54 | (5) |
|
Using Resistive Voltage Dividers |
|
|
55 | (1) |
|
Using Analog Inputs to Control Analog Outputs |
|
|
56 | (3) |
|
|
59 | (2) |
|
Part II Controlling Your Environment |
|
|
61 | (100) |
|
Chapter 4 Using Transistors and Driving Motors |
|
|
63 | (28) |
|
|
65 | (15) |
|
Handling High-Current Inductive Loads |
|
|
65 | (1) |
|
Using Transistors as Switches |
|
|
66 | (1) |
|
|
67 | (1) |
|
Using a Secondary Power Source |
|
|
68 | (1) |
|
|
68 | (2) |
|
Controlling Motor Speed with PWM |
|
|
70 | (2) |
|
Using an H-Bridge to Control DC Motor Direction |
|
|
72 | (1) |
|
Building an H-bridge Circuit |
|
|
73 | (3) |
|
Operating an H-bridge Circuit |
|
|
76 | (4) |
|
|
80 | (6) |
|
Understanding the Difference Between Continuous Rotation and Standard Servos |
|
|
80 | (1) |
|
Understanding Servo Control |
|
|
80 | (5) |
|
|
85 | (1) |
|
Building a Sweeping Distance Sensor |
|
|
86 | (4) |
|
|
90 | (1) |
|
|
91 | (16) |
|
Understanding How Speakers Work |
|
|
92 | (3) |
|
|
92 | (2) |
|
How a Speaker Produces Sound |
|
|
94 | (1) |
|
Using tone() to Make Sounds |
|
|
95 | (7) |
|
Including a Definition File |
|
|
95 | (1) |
|
|
96 | (3) |
|
|
99 | (1) |
|
|
99 | (1) |
|
Making Note and Duration Arrays |
|
|
100 | (1) |
|
|
101 | (1) |
|
Understanding the Limitations of the tone() Function |
|
|
102 | (1) |
|
|
102 | (3) |
|
|
105 | (2) |
|
Chapter 6 USB and Serial Communication |
|
|
107 | (38) |
|
Understanding the Arduino's Serial Communication Capabilities |
|
|
108 | (7) |
|
Arduino Boards with an Internal or External FTDI USB-to-Serial Converter |
|
|
110 | (2) |
|
Arduino Boards with a Secondary USB Capable ATMega MCU Emulating a Serial Converter |
|
|
112 | (2) |
|
Arduino Boards with a Single USB-Capable MCU |
|
|
114 | (1) |
|
Arduino Boards with USB-Host Capabilities |
|
|
114 | (1) |
|
|
115 | (4) |
|
|
115 | (2) |
|
|
117 | (2) |
|
Changing Data Type Representations |
|
|
119 | (1) |
|
|
119 | (8) |
|
Reading Information from a Computer or Other Serial Device |
|
|
120 | (1) |
|
Telling the Arduino to Echb Incoming Data |
|
|
120 | (1) |
|
Understanding the Differences Between Chars and Ints |
|
|
121 | (1) |
|
Sending Single Characters to Control an LED |
|
|
122 | (3) |
|
Sending Lists of Values to Control an RGB LED |
|
|
125 | (2) |
|
|
127 | (7) |
|
|
127 | (1) |
|
|
128 | (1) |
|
Controlling a Processing Sketch from Your Arduino |
|
|
129 | (3) |
|
Sending Data from Processing to Your Arduino |
|
|
132 | (2) |
|
Learning Special Tricks with the Arduino Leonardo (and Other 32U4-Based Arduinos) |
|
|
134 | (10) |
|
|
135 | (1) |
|
Typing Data into the Computer |
|
|
135 | (4) |
|
Commanding Your Computer to Do Your Bidding |
|
|
139 | (1) |
|
|
140 | (4) |
|
|
144 | (1) |
|
Chapter 7 Shift Registers |
|
|
145 | (16) |
|
Understanding Shift Registers |
|
|
146 | (8) |
|
Sending Parallel and Serial Data |
|
|
147 | (1) |
|
Working with the 74HC595 Shift Register |
|
|
148 | (1) |
|
Understanding the Shift Register Pin Functions |
|
|
148 | (1) |
|
Understanding How the Shift Register Works |
|
|
149 | (2) |
|
Shifting Serial Data from the Arduino |
|
|
151 | (3) |
|
Converting Between Binary and Decimal Formats |
|
|
154 | (1) |
|
Controlling Light Animations with a Shift Register |
|
|
154 | (6) |
|
|
154 | (3) |
|
Responding to Inputs with an LED Bar Graph |
|
|
157 | (3) |
|
|
160 | (1) |
|
Part III Communication Interfaces |
|
|
161 | (94) |
|
|
163 | (18) |
|
|
164 | (1) |
|
|
164 | (3) |
|
Communication Scheme and ID Numbers |
|
|
165 | (2) |
|
Hardware Requirements and Pull-Up Resistors |
|
|
167 | (1) |
|
Communicating with an I2C Temperature Probe |
|
|
167 | (6) |
|
|
168 | (1) |
|
Referencing the Datasheet |
|
|
169 | (2) |
|
|
171 | (2) |
|
Combining Shift Registers, Serial Communication, and I2C Communications |
|
|
173 | (7) |
|
Building the Hardware for a Temperature Monitoring System |
|
|
173 | (1) |
|
Modifying the Embedded Program |
|
|
174 | (3) |
|
Writing the Processing Sketch |
|
|
177 | (3) |
|
|
180 | (1) |
|
|
181 | (18) |
|
|
182 | (1) |
|
SPI Hardware and Communication Design |
|
|
183 | (2) |
|
|
184 | (1) |
|
|
184 | (1) |
|
|
185 | (1) |
|
Communicating with an SPI Digital Potentiometer |
|
|
185 | (8) |
|
Gathering Information from the Datasheet |
|
|
186 | (3) |
|
|
189 | (1) |
|
|
190 | (3) |
|
Creating an Audiovisual Display Using SPI Digital Potentiometers |
|
|
193 | (4) |
|
|
194 | (1) |
|
|
195 | (2) |
|
|
197 | (2) |
|
Chapter 10 Interfacing with Liquid Crystal Displays |
|
|
199 | (22) |
|
|
200 | (3) |
|
Using the LiquidCrystal Library to Write to the LCD |
|
|
203 | (6) |
|
Adding Text to the Display |
|
|
204 | (2) |
|
Creating' Special Characters and Animations |
|
|
206 | (3) |
|
Building a Personal Thermostat |
|
|
209 | (10) |
|
|
210 | (1) |
|
Displaying Data on the LCD |
|
|
211 | (2) |
|
Adjusting the Set Point with a Button |
|
|
213 | (1) |
|
Adding an Audible Warning and a Fan |
|
|
214 | (1) |
|
Bringing It All Together: The Complete Program |
|
|
215 | (4) |
|
Taking This Project to the Next Level |
|
|
219 | (1) |
|
|
219 | (2) |
|
Chapter 11 Wireless Communication with XBee Radios |
|
|
221 | (34) |
|
Understanding XBee Wireless Communication |
|
|
222 | (6) |
|
|
223 | (1) |
|
The XBee Radio Shield and Serial Connections |
|
|
224 | (2) |
|
|
226 | (1) |
|
|
226 | (1) |
|
Associate LED and RSSI LED |
|
|
226 | (1) |
|
UART Selection Jumper or Switch |
|
|
226 | (1) |
|
Hardware vs. Software Serial UART Connection Option |
|
|
227 | (1) |
|
|
228 | (8) |
|
Configuring via a Shield or a USB Adapter |
|
|
228 | (1) |
|
Programming Option 1: Using the Uno as a Programmer (Not Recommended) |
|
|
229 | (1) |
|
Programming Option 2: Using the SparkFun USB Explorer (Recommended) |
|
|
230 | (1) |
|
Choosing Your XBee Settings and Connecting Your XBee to Your Host Computer |
|
|
230 | (1) |
|
Configuring Your XBee with X-CTU |
|
|
231 | (4) |
|
Configuring Your XBee with a Serial Terminal |
|
|
235 | (1) |
|
Talking with Your Computer Wirelessly |
|
|
236 | (10) |
|
Powering Your Remote Arduino |
|
|
236 | (1) |
|
USB with a Computer or a 5V Wall Adapter |
|
|
237 | (1) |
|
|
237 | (2) |
|
|
239 | (1) |
|
Revisiting the Serial Examples: Controlling Processing with a Potentiometer |
|
|
239 | (4) |
|
Revisiting the Serial Examples: Controlling an RGB LED |
|
|
243 | (3) |
|
Talking with Another Arduino: Building a Wireless Doorbell |
|
|
246 | (6) |
|
|
246 | (1) |
|
|
247 | (1) |
|
|
248 | (1) |
|
|
249 | (1) |
|
|
250 | (2) |
|
|
252 | (3) |
|
Part IV Advanced Topics and Projects |
|
|
255 | (86) |
|
Chapter 12 Hardware and Timer Interrupts |
|
|
257 | (20) |
|
Using Hardware Interrupts |
|
|
258 | (12) |
|
Knowing the Tradeoffs Between Polling and Interrupting |
|
|
259 | (1) |
|
Ease of Implementation (Software) |
|
|
260 | (1) |
|
Ease of Implementation (Hardware) |
|
|
260 | (1) |
|
|
260 | (1) |
|
|
261 | (1) |
|
Understanding the Arduino's Hardware Interrupt Capabilities |
|
|
261 | (1) |
|
Building-and Testing a Hardware-Debounced Button Interrupt Circuit |
|
|
262 | (1) |
|
Creating a Hardware-Debouncing Circuit |
|
|
262 | (5) |
|
Assembling the Complete Test Circuit |
|
|
267 | (1) |
|
|
267 | (3) |
|
|
270 | (2) |
|
Understanding Timer Interrupts |
|
|
270 | (1) |
|
|
270 | (1) |
|
Executing Two Tasks Simultaneously(ish) |
|
|
271 | (1) |
|
Building an Interrupt-Driven Sound Machine |
|
|
272 | (3) |
|
|
272 | (1) |
|
|
273 | (2) |
|
|
275 | (2) |
|
Chapter 13 Data Logging with SD Cards |
|
|
277 | (36) |
|
Getting Ready for Data Logging |
|
|
278 | (6) |
|
Formatting Data with CSV Files |
|
|
279 | (1) |
|
Preparing an SD Card for Data Logging |
|
|
279 | (5) |
|
Interfacing the Arduino with an SD Card |
|
|
284 | (13) |
|
|
284 | (4) |
|
|
288 | (1) |
|
|
289 | (4) |
|
|
293 | (4) |
|
|
297 | (8) |
|
Understanding Real-Time Clocks |
|
|
298 | (1) |
|
Using the DS1307 Real-Time Clock |
|
|
298 | (1) |
|
Using the RTC Arduino Third-Party Library |
|
|
299 | (1) |
|
Using the Real-Time Clock |
|
|
300 | (1) |
|
Installing the RTC and SD Card Modules |
|
|
300 | (1) |
|
|
301 | (4) |
|
Building an Entrance Logger |
|
|
305 | (7) |
|
|
306 | (1) |
|
|
307 | (4) |
|
|
311 | (1) |
|
|
312 | (1) |
|
Chapter 14 ConnectingYour Arduino to the Internet |
|
|
313 | (28) |
|
The Web, the Arduino, and You |
|
|
314 | (4) |
|
|
314 | (1) |
|
|
314 | (1) |
|
Network Address Translation |
|
|
315 | (1) |
|
|
316 | (1) |
|
|
316 | (1) |
|
|
316 | (1) |
|
|
316 | (1) |
|
|
316 | (1) |
|
|
317 | (1) |
|
|
317 | (1) |
|
|
317 | (1) |
|
Controlling Your Arduino from the Web |
|
|
318 | (11) |
|
Setting Up the I/O Control Hardware |
|
|
318 | (1) |
|
Designing a Simple Web Page |
|
|
318 | (2) |
|
Writing an Arduino Server Sketch |
|
|
320 | (1) |
|
Connecting to the Network and Retrieving an IP via DHCP |
|
|
321 | (1) |
|
Replying to a Client Response |
|
|
321 | (1) |
|
Putting It Together: Web Server Sketch |
|
|
322 | (4) |
|
Controlling Your Arduino via the Network |
|
|
326 | (1) |
|
Controlling Your Arduino over the Local Network |
|
|
326 | (1) |
|
Using Port Forwarding to Control your Arduino from Anywhere |
|
|
327 | (2) |
|
Sending Live Data to a Graphing Service |
|
|
329 | (10) |
|
Building a Live Data Feed on Xively |
|
|
330 | (1) |
|
Creating a Xively Account |
|
|
330 | (1) |
|
|
330 | (1) |
|
Installing the Xively and HttpClient Libraries |
|
|
331 | (1) |
|
|
332 | (1) |
|
Configuring the Xively Sketch and Running the Code |
|
|
332 | (3) |
|
Displaying Data on the Web |
|
|
335 | (1) |
|
|
336 | (1) |
|
Adding an Analog Temperature Sensor |
|
|
336 | (1) |
|
Adding Additional Sensor Readings to the Datastream |
|
|
336 | (3) |
|
|
339 | (2) |
|
Appendix Deciphering the ATMega Datasheet and Arduino Schematics |
|
|
341 | (8) |
|
|
341 | (4) |
|
Breaking Down a Datasheet |
|
|
341 | (3) |
|
Understanding Component Pin-outs |
|
|
344 | (1) |
|
Understanding the Arduino Schematic |
|
|
345 | (4) |
Index |
|
349 | |