Contents in Detail
Acknowledgments
Introduction
Who Is This Book For?
About This Book
What Do You Need for This Book?
Organization of This Book
Primer
Getting Started with the Raspberry Pi
Uses for the Raspberry Pi
Differentiating Between Boards
Getting to Know the Raspberry Pi and its Accessories
Project Component List
Uploading the Operating System
Downloading Noobs
Formatting a MicroSD Card on Windows or macOS
Formatting a MicroSD Card on Linux
Loading Raspbian onto the MicroSD Card
Setting Up Your Raspberry Pi as a Desktop Computer
Connecting Your Raspberry Pi
Booting Up Your Pi for the First Time
Desktop Tour
Shutting Down, Rebooting, and Logging Off
Getting Started with Python
Python 3 Integrated Development Environment
Basic Python Instructions
The Python Editor
Your First Python Program
Making a Simple Calculator
LEDS
Project 1: Blinking an LED
Introducing the GPIO Pins
Introducing LEDS
Finding the Right Resistor
Wiring the Circuit
Writing the Script
Entering the Script
Running the Script
Taking It Further
Project 2: Pushbutton LED Flashlight
Introducing Switches and Buttons
Wiring the Circuit
Writing the Script
Taking It Further
Project 3: LED Dimmer Switch
Introducing Potentiometers
Reading Analog Signals with Raspberry Pi
Analog-to-Digital Converters
Pulse-Width Modulation
Wiring the Circuit
Writing the Script
Entering the Script
Running the Script
Taking It Further
Project 4: A Graphical user Interface for a Multicolor LED
Introducing RGB LEDs
Wiring the Circuit
Writing the Script
Controlling the Intensity and Closing the Window
Designing the User Interface with Tkinter
Running the Script
Taking It Further
Project 5: Rainbow Light Strip
Introducing the WS2812B Addressable RGB LED Strip
Introducing the Logic Level Converter
Wiring the Circuit
Writing the Script
Installing the WS281X Library
Enabling SPI Communication
Entering the Script
Running the Script
Taking It Further
Displays
Project 6: An LCD Reminder
Introducing the Liquid Crystal Display
Soldering the Headers
The LCD Module Pinout
Wiring Your Circuit
Writing the Script
Installing the Python Library for a Character LCD
Displaying a Character Message
Adding Other Functionality
Scrolling a Reminder Message
Running the Script
Taking It Further
Project 7: Mini Weather Forecaster
Introducing the OLED Display
Using the OpenWeatherMap API
Understanding JSON Syntax
Making an API Request
Wiring the Circuit
Writing the Script
Installing the Library for the OLED Display
Enabling I2C Communication
Entering the Script
Running the Script
Taking It Further
Project 8: Pong with a Sense HAT
Introducing Pong
Introducing the Raspberry Pi Sense HAT
Mounting the Board
Using the Sense HAT Emulator
Working with Sense HAT Functions and Controls
Controlling the LED Matrix
Reading Data from the Joystick
Writing the Script
Entering the Script
Running the Script
Taking It Further
Sensors
Project 9: All-in-One Weather Sensor Station
The Sense HAT as a Weather Station
The Temperature Sensor
The Humidity Sensor
The Barometric Pressure Sensor
Reading Temperature, Humidity, and Pressure
Building a User Interface for Your Readings
Writing the Script
Creating the User Interface
Automatically Updating the Readings
Running the Script
Taking It Further
Project 10: Intruder Alarm with Email Notifications
Introducing the PIR Motion Sensor
Sending an Email with Python
Finding Your SMTP Server Details
The Email-Sending Script
Running the Email-Sending Script
Wiring the Circuit
Writing the Script
Taking It Further
Project 11: Gas and Smoke Alarm
Introducing the MQ-2 Gas and Smoke Sensor
Introducing the Piezo Buzzer
Wiring the Circuit
Writing the Script
Setting the Threshold Value
Running the Script
Taking It Further
Project 12: Temperature and Humidity Data Logger
Introducing the DHT22 Sensor
Wiring the Circuit
Writing the Script
Installing the DHT22 Library
Entering the Script
Creating, Writing, and Closing .txt Files
Running the Script
Taking It Further
Cameras
Project 13: Burglar Detector with Photo Capture
Introducing the Raspberry Pi Camera Module V2
Building the Burglar Detector
Enabling the Camera
Connecting the Camera
Wiring the Circuit
Writing the Script
Entering the Script
Running the Script
Taking It Further
Project 14: Home Surveillance Camera
Recording Video to a File
Writing the Script
Entering the Script
Running the Script
Taking It Further
Web Applications
Project 15: Building Your First Website
Setting Up the Project Files
Setting Up an HTML Web Page
Setting Up the Basic Content
Adding the Title, Headings, and Paragraphs
Seeing Your Web Page
Adding Links, Images, and Buttons
Styling Your Page with CSS
Embedding a Style Sheet
Styling Your HTML Content
Styling the Header
Styling the title Class
Styling the Headings, Paragraphs, and Links
Styling the Button
Taking It Further
Project 16: Connecting Your Electronics to the Web
Introducing Web Servers
Introducing the Relay Module
Relay Pinout
Relay Usage
Project Overview
Wiring the Circuit
Preparing Your Pi to Run a Web Server
Installing Flask
Organizing Your Files
Writing the Scripts
Creating the Web Server
Writing the HTML File
Writing the CSS File
Launching Your Web Server
Taking It Further
Project 17: Internet of Things Control Center with Node-RED
Introducing Node-RED
Installing the DHT22 Nodes
Getting Started with Node-RED
Wiring the Circuit
Creating the Flow
Creating the Dashboard User Interface
Wiring the Nodes
Running Your Application
Taking It Further
Games and Toys
Project 18: Digital Drum Set
Preparing the Audio
Configuring the Audio
Getting the Audio Sample Files
Wiring the Circuit
Writing the Script
Taking It Further
Project 19: Make a Game in Scratch: Hungry Monkey
Introducing Scratch 2
Wiring the Circuit
Building the Script
Creating the Sprites and Choosing the Stage Background
Editing the Sprites
Adding Controls to the Monkey Sprite
Testing Your Script
Creating the Countdown Timer
Counting and Displaying the Score
Making the Bananas Fall From the Sky
Adding the Rotten Bananas
Playing the Game
Taking It Further
Project 20: Wi-Fi Remote-Controlled Robot
Project Outline
Preparing the Raspberry Pi
Wiring the Circuit
Wiring the DC Motors to MotoZero
Controlling the Motors with MotoZero
Writing the Application
Finding the Raspberry Pi IP Address
Creating the Node-RED Flow
Entering the Script
Running the Application
Powering Up the Robot
Taking It Further
Raspberry Pi GPIO Pin Guide
Decoding Resistor Values