About the Author |
|
xv | |
About the Technical Reviewer |
|
xvii | |
Acknowledgments |
|
xix | |
Introduction |
|
xxi | |
Chapter 1 Introducing the Raspberry Pi Pico |
|
1 | (42) |
|
What Is a Microcontroller? |
|
|
2 | (1) |
|
A Tour of the Raspberry Pi Pico |
|
|
3 | (17) |
|
|
5 | (3) |
|
|
8 | (2) |
|
RP2040-Based Alternatives |
|
|
10 | (10) |
|
Getting Started with the Pico |
|
|
20 | (22) |
|
|
20 | (8) |
|
|
28 | (1) |
|
Installing MicroPython on the Pico |
|
|
28 | (9) |
|
|
37 | (5) |
|
|
42 | (1) |
Chapter 2 Introducing MicroPython |
|
43 | (42) |
|
|
44 | (18) |
|
|
45 | (2) |
|
|
47 | (2) |
|
|
49 | (1) |
|
What Does MicroPython Run On? |
|
|
50 | (1) |
|
Experimenting with Python on Your PC |
|
|
51 | (11) |
|
|
62 | (7) |
|
File Operations with a Utility |
|
|
63 | (6) |
|
Off and Running with MicroPython |
|
|
69 | (13) |
|
Example 1 - Blink the LED |
|
|
70 | (4) |
|
Example 2 - Toggle the LED |
|
|
74 | (4) |
|
|
78 | (3) |
|
|
81 | (1) |
|
|
82 | (3) |
Chapter 3 How to Program in MicroPython |
|
85 | (68) |
|
|
86 | (7) |
|
|
87 | (2) |
|
|
89 | (1) |
|
|
90 | (1) |
|
|
91 | (2) |
|
|
93 | (12) |
|
|
95 | (2) |
|
|
97 | (4) |
|
|
101 | (4) |
|
|
105 | (14) |
|
|
105 | (1) |
|
|
106 | (2) |
|
|
108 | (11) |
|
Learning Python by Example |
|
|
119 | (32) |
|
How Do I Create and Execute Python Files? |
|
|
120 | (1) |
|
|
120 | (5) |
|
Example 2: Using Complex Data and Files |
|
|
125 | (8) |
|
Example 3: Using Functions |
|
|
133 | (8) |
|
|
141 | (10) |
|
|
151 | (1) |
|
|
151 | (2) |
Chapter 4 Low-Level Hardware Support |
|
153 | (60) |
|
|
154 | (1) |
|
|
155 | (35) |
|
Built-In and Standard Libraries |
|
|
156 | (14) |
|
Built-In Functions and Classes |
|
|
170 | (6) |
|
|
176 | (5) |
|
MicroPython-Specific Libraries |
|
|
181 | (7) |
|
|
188 | (2) |
|
Working with Low-Level Hardware |
|
|
190 | (3) |
|
Drivers and Libraries to the Rescue! |
|
|
191 | (2) |
|
|
193 | (18) |
|
Inter-integrated Circuit (12C) |
|
|
195 | (9) |
|
Serial Peripheral Interface (SPI) |
|
|
204 | (7) |
|
|
211 | (2) |
Chapter 5 Electronics for Beginners |
|
213 | (58) |
|
|
214 | (16) |
|
|
214 | (6) |
|
|
220 | (8) |
|
Powering Your Electronics |
|
|
228 | (2) |
|
|
230 | (17) |
|
|
230 | (1) |
|
|
231 | (1) |
|
|
232 | (1) |
|
|
233 | (1) |
|
Light-Emitting Diode (LED) |
|
|
234 | (2) |
|
|
236 | (1) |
|
|
237 | (1) |
|
|
237 | (2) |
|
|
239 | (1) |
|
|
240 | (1) |
|
|
241 | (1) |
|
Breadboard and Jumper Wires |
|
|
242 | (2) |
|
|
244 | (3) |
|
Using a Breadboard to Build Circuits |
|
|
247 | (4) |
|
|
251 | (17) |
|
|
251 | (4) |
|
|
255 | (13) |
|
|
268 | (1) |
|
|
269 | (2) |
Chapter 6 Project: Hello, World! MicroPython Style |
|
271 | (36) |
|
Getting Started with Pico Projects |
|
|
272 | (3) |
|
|
272 | (1) |
|
|
273 | (1) |
|
|
273 | (2) |
|
|
275 | (2) |
|
|
277 | (3) |
|
|
280 | (4) |
|
|
284 | (16) |
|
|
284 | (1) |
|
|
285 | (2) |
|
|
287 | (8) |
|
|
295 | (5) |
|
|
300 | (5) |
|
|
303 | (2) |
|
|
305 | (2) |
Chapter 7 Project: Pedestrian Crossing |
|
307 | (18) |
|
|
308 | (1) |
|
|
309 | (3) |
|
|
312 | (10) |
|
|
314 | (1) |
|
|
315 | (1) |
|
|
315 | (1) |
|
|
316 | (6) |
|
|
322 | (2) |
|
|
323 | (1) |
|
|
324 | (1) |
Chapter 8 Project: Soil Moisture Monitor |
|
325 | (44) |
|
|
326 | (1) |
|
|
327 | (8) |
|
|
329 | (1) |
|
|
330 | (1) |
|
|
331 | (1) |
|
Potential Hardware Conflicts |
|
|
332 | (3) |
|
|
335 | (4) |
|
Load the Pimoroni Image on the Pico |
|
|
336 | (1) |
|
|
337 | (2) |
|
|
339 | (26) |
|
|
340 | (4) |
|
|
344 | (15) |
|
|
359 | (6) |
|
|
365 | (2) |
|
|
366 | (1) |
|
|
367 | (2) |
Chapter 9 Introducing Grove |
|
369 | (22) |
|
|
369 | (10) |
|
The Grove Component System |
|
|
370 | (9) |
|
|
379 | (9) |
|
|
380 | (2) |
|
|
382 | (5) |
|
|
387 | (1) |
|
Where to Buy Grove Components |
|
|
387 | (1) |
|
Using the Components with Your Pico |
|
|
388 | (1) |
|
|
389 | (2) |
Chapter 10 Project: Sound Activated Lights |
|
391 | (20) |
|
|
392 | (1) |
|
|
392 | (6) |
|
|
394 | (1) |
|
|
395 | (1) |
|
|
395 | (2) |
|
|
397 | (1) |
|
|
398 | (1) |
|
|
399 | (4) |
|
|
399 | (1) |
|
|
400 | (1) |
|
|
401 | (1) |
|
|
401 | (2) |
|
|
403 | (5) |
|
|
404 | (1) |
|
|
404 | (4) |
|
|
408 | (2) |
|
|
409 | (1) |
|
|
410 | (1) |
Chapter 11 Project: Simon Game |
|
411 | (42) |
|
|
411 | (1) |
|
|
412 | (3) |
|
|
413 | (1) |
|
|
414 | (1) |
|
|
415 | (7) |
|
|
416 | (6) |
|
|
422 | (26) |
|
Install Software Libraries |
|
|
422 | (1) |
|
|
423 | (1) |
|
|
423 | (7) |
|
|
430 | (4) |
|
|
434 | (11) |
|
|
445 | (3) |
|
|
448 | (2) |
|
|
450 | (1) |
|
|
451 | (2) |
Chapter 12 Project: Monitoring your Environment |
|
453 | (40) |
|
|
453 | (1) |
|
|
454 | (9) |
|
|
457 | (6) |
|
|
463 | (5) |
|
|
464 | (4) |
|
|
468 | (20) |
|
Install Software Libraries |
|
|
468 | (1) |
|
|
468 | (20) |
|
|
488 | (2) |
|
|
490 | (1) |
|
|
491 | (2) |
Chapter 13 Introducing IoT for the Cloud |
|
493 | (70) |
|
|
494 | (3) |
|
|
494 | (1) |
|
What Is Cloud Computing Then? |
|
|
495 | (1) |
|
How Does the Cloud Help IoT? |
|
|
496 | (1) |
|
|
497 | (5) |
|
IoT Cloud Services Available |
|
|
498 | (4) |
|
Connecting Your Pico to the Internet |
|
|
502 | (10) |
|
|
502 | (6) |
|
Using the Pico Wireless Pack |
|
|
508 | (4) |
|
|
512 | (1) |
|
Example 1: Pedestrian Crossing |
|
|
513 | (15) |
|
|
513 | (4) |
|
|
517 | (8) |
|
|
525 | (3) |
|
Example 2: Soil Moisture Monitor |
|
|
528 | (34) |
|
|
529 | (3) |
|
|
532 | (25) |
|
|
557 | (4) |
|
|
561 | (1) |
|
|
562 | (1) |
Chapter 14 Using ThingSpeak |
|
563 | (48) |
|
|
564 | (6) |
|
Create an Account in ThingSpeak |
|
|
565 | (2) |
|
|
567 | (3) |
|
How to Add ThingSpeak to Your Projects |
|
|
570 | (21) |
|
Using ThingSpeak with the Pico |
|
|
572 | (19) |
|
Example Project: IoT Environment Monitor |
|
|
591 | (19) |
|
|
592 | (1) |
|
|
593 | (4) |
|
Create the ThingSpeak Channel |
|
|
597 | (1) |
|
Prepare the Project Files |
|
|
598 | (1) |
|
|
599 | (4) |
|
Execute and Visualize the Data |
|
|
603 | (5) |
|
|
608 | (2) |
|
|
610 | (1) |
Appendix |
|
611 | (6) |
Index |
|
617 | |