Twenty projects using the Raspberry Pi, a tiny and affordable computer, for beginners looking to make cool things right away. Projects are explained with full-color visuals and simple step-by-step instructions.
20 Easy Raspberry Pi Projects is a beginner-friendly collection of electronics projects, perfectly suited for kids, parents, educators, and hobbyists looking to level up their hardware skills.
After a crash course to get you set up with your Raspberry Pi, you’ll learn how to build interactive projects like a digital drum set; a WiFi controlled robot; a Pong game; an intruder alarm that sends email notifications; a gas leak detector; a weather forecaster; and IoT gadgets that control electronics around the house. Along the way, you’ll work with core components like LCD screens, cameras, sensors, and even learn how to set up your own server.
Each project provides step-by-step instructions, full-color photos and circuit diagrams, and the complete code to bring your build to life. If you’re ready to hit the ground running and make something interesting, let 20 Easy Raspberry Pi Projects be your guide.
Author(s): Rui Santos, Sara Santos
Publisher: No Starch Press
Year: 2018
Language: English
Commentary: Vector PDF
Pages: 288
Contents
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
Part I: 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
Part II: 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
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
Part III: 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 Temperature and Humidity 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
Part IV: Cameras
Project 13: Burglar Detector and 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
Part V: 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
Part VI: 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
Appendix A: Raspberry Pi GPIO Pin Guide
Appendix B: Decoding Resistor Values