Make: Getting Started with Raspberry Pi: An Introduction to the Fastest-
Selling Computer in the World,4THEdition
ISBN: 9789355421722
Author: Shawn Wallace
Edition 4/ED
Publisher: Shroff/Maker Media
Description
What can you do with the Raspberry Pi, the affordable computer the size of a credit card? All sorts of things!
If you’re learning how to program — or looking to build new electronic projects — this hands-on guide will
show you just how valuable that flexible little platform can be.
Updated to include coverage of the Raspberry Pi Models 2 and 3, Getting Started with Raspberry Pi takes you
step by step through many fun and educational possibilities. Take advantage of several preloaded
programming languages. Use the Raspberry Pi with Arduino. Create Internet-connected projects. Play with
multimedia. With Raspberry Pi, you can do all of this and more.
Get acquainted with hardware features on the Pi
Learn enough Linux to move around the operating system
Start programming in Python
Use the Pi’s input and output pins to do some hardware hacking
Discover how Arduino and the Raspberry Pi can work together
Create your own Pi-based web server with Python
Work with the Raspberry Pi Camera Module and USB webcams
Make the Pi the centerpiece of your Internet of Things project
Contents
What They’re Saying. .................................................................................................. vii
Preface. .......................................................................................................................... ix
1/Getting Up and Running ............................................................................................1
A Tour of the Boards ..........................................................................................................2
The Proper Peripherals .....................................................................................................8
The Case ..........................................................................................................................13
Choose Your Distribution ................................................................................................15
Flash the SD Card............................................................................................................15
For Advanced Users: Create Your Own Disk Image................................................16
Booting Up .......................................................................................................................17
Configuring Your Pi ..........................................................................................................17
Getting Online..................................................................................................................22
Shutting Down .................................................................................................................24
Running Headless ....................................................................................................24
Troubleshooting...............................................................................................................25
Going Further...................................................................................................................26
2/Getting Around Linux on the Raspberry Pi...........................................................27
Using the Command Line ...............................................................................................31
Files and the File system..........................................................................................32
More Linux Commands ..................................................................................................37
Processes ..................................................................................................................39
Sudo and Permissions .............................................................................................41
The Network .............................................................................................................43
/etc ...................................................................................................................................44
Setting the Date and Time ..............................................................................................44
Installing New Software ..................................................................................................45
Sound in Linux .................................................................................................................46
Upgrading Your Firmware ...............................................................................................46
Going Further...................................................................................................................47
iv Contents
3/Other Operating Systems and Linux Distributions..............................................49
Distributions for Home Theater .....................................................................................50
Distributions for Music ...................................................................................................52
Retro Computing and Retro Gaming .............................................................................53
Internet of Things ............................................................................................................53
Other Useful Distributions ..............................................................................................54
Going Further...................................................................................................................55
4/Python on the Pi ........................................................................................................57
Hello, Python....................................................................................................................58
A Bit More Python ...........................................................................................................60
Objects and Modules ......................................................................................................63
Even More Modules .........................................................................................................67
Launching Other Programs from Python ......................................................................70
Troubleshooting Errors ...................................................................................................72
Going Further...................................................................................................................73
5/Arduino and the Pi ....................................................................................................75
Installing Arduino on the Raspberry Pi OS ....................................................................78
Finding the Serial Port .............................................................................................79
Talking in Serial................................................................................................................80
Using Firmata ..................................................................................................................84
Going Further...................................................................................................................86
6/Basic Input and Output.............................................................................................87
Using Inputs and Outputs ...............................................................................................90
Digital Output: Lighting Up an LED .........................................................................92
Digital Input: Reading a Button ...............................................................................97
Project: Cron Lamp Timer ............................................................................................100
Scripting Commands .............................................................................................100
Connecting a Lamp ................................................................................................102
Scheduling Commands with Cron ........................................................................103
Going Further.................................................................................................................106
7/Programming Inputs and Outputs with Python .................................................107
Installation .....................................................................................................................107
Testing GPIO in Python .................................................................................................109
Blinking an LED .............................................................................................................110
Reading a Button ...........................................................................................................112
Project: Simple Soundboard ........................................................................................114
Going Further.................................................................................................................119
Contents v
8/Analog Input and Output .......................................................................................121
Output: Converting Digital to Analog ...........................................................................122
Test-Driving PWM ...................................................................................................124
Taking PWM Further ...............................................................................................125
Input: Converting Analog to Digital ..............................................................................126
Variable Resistors...................................................................................................132
Going Further.................................................................................................................136
9/Working with Cameras...........................................................................................137
Connecting and Testing the Camera Module ..............................................................141
Project: Making a GIF .............................................................................................144
Capturing Video......................................................................................................144
Testing USB Webcams ..................................................................................................145
Installing and Testing Open CV.....................................................................................146
Additional Step for the Raspberry Pi Camera Module ........................................148
Displaying an Image ......................................................................................................148
Modifying an Image .......................................................................................................151
Accessing the Camera ..................................................................................................153
Face Detection ...............................................................................................................156
Project: Raspberry Pi Photobooth ...............................................................................158
Going Further.................................................................................................................163
10/Python and the Internet. ......................................................................................165
Download Data from a Web Server ..............................................................................165
Fetching the Weather Forecast ..............................................................................167
Serving Pi (Be a Web Server)........................................................................................176
Flask Basics ............................................................................................................176
Connecting the Web to the Real World ........................................................................180
Project: Web Lamp ........................................................................................................183
Going Further.................................................................................................................188
A/Writing an SD Card Image ....................................................................................189
B/The Raspberry Pi Pico ............................................................................................197
C/Another Raspberry Pi?! .........................................................................................210
Index ............................................................................................................................214
Make: Raspberry Pi and AVR Projects
Rs.500.00
ISBN: 9789351109143
Author: Cefn Hoile, Sjoerd Dirk Meijer, Clare Bowman
Edition: 1
Publisher: Shroff/O'Reilly
Description
As an incredibly cheap, credit-card sized computer, the Raspberry Pi is breaking down barriers by
encouraging people of all ages to experiment with code and build new systems and objects; and this
book provides readers with inspiring and insightful examples to explore and build upon. Written for
intermediate to seasoned Raspberry Pi users, this book explores four projects from around the world,
explained by their makers. These projects cover five major categories in the digital maker space: music,
light, games, home automation, and the Internet of Things.
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1. Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
The Power of the Pi. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Raspbian. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Who Is This Book For?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Projects in This Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Picussion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Materials and Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Solderless Breadboarding Materials. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Solderless Breadboard Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Soldering Materials. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Soldering Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Configuring Your Raspberry Pi. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Exercise 1: Blink. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Attaching the UART. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Testing with the Blink Sketch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Troubleshooting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Exercise 2: Knock. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Loading the Knock Sketch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Displaying Knock Messages in the Python Shell. . . . . . . . . . . . . . . . 26
Loading a Python Script to Display Knock! Messages. . . . . . . . . 28
Exercise 3: Sending Knock Messages Wirelessly. . . . . . . . . . . . . . . . . . 29
Using Bluetooth for Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Transmitting Wireless Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Triggering Audio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Troubleshooting Audio from the Pi. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
iii
Contents
Exercise 4: Talking Wearables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Using Python Threading for Multiple Wearables. . . . . . . . . . . . . . . . 36
Running Audio on Multiple Wearables. . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Exercise 5: One Man Band. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Adding an Accelerometer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Detecting Orientation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Adding the KnockLedControl Sketch. . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Processing Accelerometer Data on the Pi. . . . . . . . . . . . . . . . . . . . . . 48
Running the One Man Band. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
How the One Man Band Works. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Proper Gestures for the One Man Band. . . . . . . . . . . . . . . . . . . . . . . . 60
Where Next?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
3. Raspberries from Scratch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
The Conductive Keyboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Materials. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Installing Software. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Raspberry Pi as AVR Programmer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Building the Conductive Keyboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Exercise 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Exercise 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Exercise 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Exercise 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Exercise 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Testing the Conductive Keyboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Extending the Conductive Keyboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Exercise 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Exercise 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Exercise 8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Exercise 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Programming and Testing the Conductive Keyboard. . . . . . . . . . 94
Using the Conductive Keyboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Using the ShrimpKey with Scratch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
A Scratch Primer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Using the Conductive Keyboard in Scratch. . . . . . . . . . . . . . . . . . . . 102
Project 1: Interactive Art Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Using the Conductive Keyboard with the Art Project. . . . . . . . . 109
Project 2: Memory Game. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
4. The Internet of Fish. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
iv Contents
Materials. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Hardware Materials. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Software Materials. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Before You Start. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Setting Up SSH Communication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
A Thermometer That Reads and Writes. . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Texting with Raspberry Pi. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Sign Up for Twilio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Put Raspberry Pi in the Loop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Update temp.py. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Building the Pi Web Server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Set Up Apache. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Make a Basic Website. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Install MySQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Build a Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Connect the MySQL Database to temp.py. . . . . . . . . . . . . . . . . . . . 153
Connect the MySQL Database to data.php. . . . . . . . . . . . . . . . . . . . 158
Design a Graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Next Steps and Acknowledgments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
5. Internet-Connected Giraffe Mood Lamp. . . . . . . . . . . . . . . . . . . . . . . . 167
Materials and Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Hardware. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Electronics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Selecting a Lamp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Adding the Required Packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Creating a Twitter Account for Your Lamp. . . . . . . . . . . . . . . . . . . . 175
Downloading Code for the Lamp and Configuring Twitter
Access. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Walking Through lamp.py. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
onArg.py. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Walking Through onArg.py. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Running lamp.py When the Raspberry Pi Starts. . . . . . . . . . . . . . 188
Building the Lamp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Hacking the Lamp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
DC-to-DC Converter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
The RGB Matrix. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
The Switch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
The Stripboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
The Base. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Putting It All Together. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Contents v
Where to Go from Here?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
A. Appendix: The Missing Pieces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .231
Raspberry Pi Cookbook, 2nd Edition
Rs.850.00
ISBN: 9789352133895
Author: Monk
Edition: Second
Publisher: Shroff/O'Reilly
Description
With millions of new users and several new models, the Raspberry Pi ecosystem continues to
expand—along with a lot of new questions about the Pi’s capabilities. The second edition of this
popular cookbook provides more than 240 hands-on recipes for running this tiny low-cost
computer with Linux, programming it with Python, and hooking up sensors, motors, and other
hardware—including Arduino and the Internet of Things.
Prolific hacker and author Simon Monk also teaches basic principles to help you use
new technologies with Raspberry Pi as its ecosystem continues to develop. This
cookbook is ideal for programmers and hobbyists familiar with the Pi through resources,
including Getting Started with Raspberry Pi (O’Reilly). Python and other code examples
from the book are available on GitHub.
Set up your Raspberry Pi and connect to a network
Work with its Linux-based operating system
Program Raspberry Pi with Python
Give your Pi "eyes" with computer vision
Control hardware through the GPIO connector
Use Raspberry Pi to run different types of motors
Work with switches, keypads, and other digital inputs
Use sensors to measure temperature, light, and distance
Connect to IoT devices in various ways
Create dynamic projects with Arduino
Table of Contents
1. Chapter 1 Setup and Management
1. 1.0. Introduction
2. 1.1. Selecting a Model of Raspberry Pi
3. 1.2. Enclosing a Raspberry Pi
4. 1.3. Selecting a Power Supply
5. 1.4. Selecting an Operating System Distribution
6. 1.5. Writing a MicroSD Card with NOOBS
7. 1.6. Connecting the System
8. 1.7. Connecting a DVI or VGA Monitor
9. 1.8. Using a Composite Video Monitor/TV
10. 1.9. Adjusting the Picture Size on Your Monitor
11. 1.10. Maximizing Performance
12. 1.11. Changing Your Password
13. 1.12. Setting the Pi to Boot Straight into a Windowing System
14. 1.13. Shutting Down Your Raspberry Pi
15. 1.14. Installing the Raspberry Pi Camera Module
16. 1.15. Using Bluetooth
2. Chapter 2 Networking
1. 2.0. Introduction
2. 2.1. Connecting to a Wired Network
3. 2.2. Finding Your IP Address
4. 2.3. Setting a Static IP Address
5. 2.4. Setting the Network Name of a Raspberry Pi
6. 2.5. Setting Up a Wireless Connection
7. 2.6. Connecting with a Console Lead
8. 2.7. Controlling the Pi Remotely with SSH
9. 2.8. Controlling the Pi Remotely with VNC
10. 2.9. Controlling the Pi Remotely with RDP
11. 2.10. File Sharing on a Mac Network
12. 2.11. Sharing the Pi Screen on a Mac
13. 2.12. Using a Raspberry Pi for Network Attached Storage
14. 2.13. Network Printing
3. Chapter 3 Operating System
1. 3.0. Introduction
2. 3.1. Moving Files Around Graphically
3. 3.2. Starting a Terminal Session
4. 3.3. Navigating the Filesystem Using a Terminal
5. 3.4. Copying a File or Folder
6. 3.5. Renaming a File or Folder
7. 3.6. Editing a File
8. 3.7. Viewing the Contents of a File
9. 3.8. Creating a File Without Using an Editor
10. 3.9. Creating a Directory
11. 3.10. Deleting a File or Directory
12. 3.11. Performing Tasks with Superuser Privileges
13. 3.12. Understanding File Permissions
14. 3.13. Changing File Permissions
15. 3.14. Changing File Ownership
16. 3.15. Making a Screen Capture
17. 3.16. Installing Software with apt-get
18. 3.17. Removing Software Installed with apt-get
19. 3.18. Installing Python Packages with Pip
20. 3.19. Fetching Files from the Command Line
21. 3.20. Fetching Source Code with Git
22. 3.21. Running a Program or Script Automatically on Startup
23. 3.22. Running a Program or Script Automatically as a Service
24. 3.23. Running a Program or Script Automatically at Regular Intervals
25. 3.24. Finding Things
26. 3.25. Using the Command-Line History
27. 3.26. Monitoring Processor Activity
28. 3.27. Working with File Archives
29. 3.28. Listing Connected USB Devices
30. 3.29. Redirecting Output from the Command Line to a File
31. 3.30. Concatenating Files
32. 3.31. Using Pipes
33. 3.32. Hiding Output to the Terminal
34. 3.33. Running Programs in the Background
35. 3.34. Creating Command Aliases
36. 3.35. Setting the Date and Time
37. 3.36. Finding Out How Much Room You Have on the SD Card
4. Chapter 4 Software
1. 4.0. Introduction
2. 4.1. Making a Media Center
3. 4.2. Installing Office Software
4. 4.3. Installing other Browsers
5. 4.4. Using the Pi Store
6. 4.5. Making a Webcam Server
7. 4.6. Running a Vintage Game Console Emulator
8. 4.7. Running Minecraft Pi Edition
9. 4.8. Running a Minecraft Server
10. 4.9. Running Open Arena
11. 4.10. Raspberry Pi Radio Transmitter
12. 4.11. Running GIMP
13. 4.12. Internet Radio
5. Chapter 5 Python Basics
1. 5.0. Introduction
2. 5.1. Deciding Between Python 2 and Python 3
3. 5.2. Editing Python Programs with IDLE
4. 5.3. Using the Python Console
5. 5.4. Running Python Programs from the Terminal
6. 5.5. Variables
7. 5.6. Displaying Output
8. 5.7. Reading User Input
9. 5.8. Arithmetic
10. 5.9. Creating Strings
11. 5.10. Concatenating (Joining) Strings
12. 5.11. Converting Numbers to Strings
13. 5.12. Converting Strings to Numbers
14. 5.13. Finding the Length of a String
15. 5.14. Finding the Position of One String Inside Another
16. 5.15. Extracting Part of a String
17. 5.16. Replacing One String of Characters with Another Inside a String
18. 5.17. Converting a String to Upper- or Lowercase
19. 5.18. Running Commands Conditionally
20. 5.19. Comparing Values
21. 5.20. Logical Operators
22. 5.21. Repeating Instructions an Exact Number of Times
23. 5.22. Repeating Instructions Until Some Condition Changes
24. 5.23. Breaking Out of a Loop
25. 5.24. Defining a Function in Python
6. Chapter 6 Python Lists and Dictionaries
1. 6.0. Introduction
2. 6.1. Creating a List
3. 6.2. Accessing Elements of a List
4. 6.3. Finding the Length of a List
5. 6.4. Adding Elements to a List
6. 6.5. Removing Elements from a List
7. 6.6. Creating a List by Parsing a String
8. 6.7. Iterating Over a List
9. 6.8. Enumerating a List
10. 6.9. Sorting a List
11. 6.10. Cutting Up a List
12. 6.11. Applying a Function to a List
13. 6.12. Creating a Dictionary
14. 6.13. Accessing a Dictionary
15. 6.14. Removing Things from a Dictionary
16. 6.15. Iterating Over Dictionaries
7. Chapter 7 Advanced Python
1. 7.0. Introduction
2. 7.1. Formatting Numbers
3. 7.2. Formatting Dates and Times
4. 7.3. Returning More Than One Value
5. 7.4. Defining a Class
6. 7.5. Defining a Method
7. 7.6. Inheritance
8. 7.7. Writing to a File
9. 7.8. Reading from a File
10. 7.9. Pickling
11. 7.10. Handling Exceptions
12. 7.11. Using Modules
13. 7.12. Random Numbers
14. 7.13. Making Web Requests from Python
15. 7.14. Command-Line Arguments in Python
16. 7.15. Running Linux Commands from Python
17. 7.16. Sending Email from Python
18. 7.17. Writing a Simple Web Server in Python
19. 7.18. Doing More Than One Thing at a Time
20. 7.19. Doing Nothing in Python
21. 7.20. Using Python with Minecraft Pi Edition
8. Chapter 8 Computer Vision
1. 8.0. Introduction
2. 8.1. Installing SimpleCV
3. 8.2. Setting Up a USB Camera for Computer Vision
4. 8.3. Using a Raspberry Pi Camera Module for Computer Vision
5. 8.4. Counting Coins
6. 8.5. Face Detection
7. 8.6. Motion Detection
8. 8.7. Optical Character Recognition
9. Chapter 9 Hardware Basics
1. 9.0. Introduction
2. 9.1. Finding Your Way Around the GPIO Connector
3. 9.2. Keeping Your Raspberry Pi Safe When Using the GPIO Connector
4. 9.3. Setting Up I2C
5. 9.4. Using I2C Tools
6. 9.5. Setting Up SPI
7. 9.6. Installing PySerial for Access to the Serial Port from Python
8. 9.7. Installing Minicom to Test the Serial Port
9. 9.8. Using a Breadboard with Jumper Leads
10. 9.9. Using a Breadboard with a Pi Cobbler
11. 9.10. Using a Raspberry Squid
12. 9.11. Using a Raspberry Squid Button
13. 9.12. Converting 5V Signals to 3.3V with Two Resistors
14. 9.13. Converting 5V Signals to 3.3V with a Level Converter Module
15. 9.14. Powering a Raspberry Pi with Batteries
16. 9.15. Powering a Raspberry Pi with a LiPo Battery
17. 9.16. Getting Started with the Sense HAT
18. 9.17. Getting Started with the Explorer HAT Pro
19. 9.18. Getting Started with a RaspiRobot Board
20. 9.19. Using a Pi Plate Prototyping Board
21. 9.20. Making a Hardware At Top (HAT)
22. 9.21. The Pi Compute Module
23. 9.22. The Pi Zero
10.Chapter 10 Controlling Hardware
1. 10.0. Introduction
2. 10.1. Connecting an LED
3. 10.2. Leaving the GPIO Pins in a Safe State
4. 10.3. Controlling the Brightness of an LED
5. 10.4. Make a Buzzing Sound
6. 10.5. Switching a High-Power DC Device Using a Transistor
7. 10.6. Switching a High-Power Device Using a Relay
8. 10.7. Controlling High-Voltage AC Devices
9. 10.8. Making a User Interface to Turn Things On and Off
10. 10.9. Making a User Interface to Control PWM Power for LEDs and Motors
11. 10.10. Changing the Color of an RGB LED
12. 10.11. Using Lots of LEDs (Charlieplexing)
13. 10.12. Using an Analog Meter as a Display
14. 10.13. Programming with Interrupts
11.Chapter 11 Motors
1. 11.0. Introduction
2. 11.1. Controlling Servo Motors
3. 11.2. Controlling Servo Motors Precisely
4. 11.3. Controlling Many Servo Motors
5. 11.4. Controlling the Speed of a DC Motor
6. 11.5. Controlling the Direction of a DC Motor
7. 11.6. Using a Unipolar Stepper Motor
8. 11.7. Using a Bipolar Stepper Motor
9. 11.8. Using a Stepper Motor HAT to Drive a Bipolar Stepper Motor
10. 11.9. Using a RaspiRobot Board to Drive a Bipolar Stepper Motor
11. 11.10. Building a Simple Robot Rover
12.Chapter 12 Digital Inputs
1. 12.0. Introduction
2. 12.1. Connecting a Push Switch
3. 12.2. Toggling with a Push Switch
4. 12.3. Using a Two-Position Toggle or Slide Switch
5. 12.4. Using a Center-Off Toggle or Slide Switch
6. 12.5. Debouncing a Button Press
7. 12.6. Using an External Pull-up Resistor
8. 12.7. Using a Rotary (Quadrature) Encoder
9. 12.8. Using a Keypad
10. 12.9. Detecting Movement
11. 12.10. Adding GPS to the Raspberry Pi
12. 12.11. Intercepting Keypresses
13. 12.12. Intercepting Mouse Movements
14. 12.13. Using a Real-Time Clock Module
13.Chapter 13 Sensors
1. 13.0. Introduction
2. 13.1. Using Resistive Sensors
3. 13.2. Measuring Light
4. 13.3. Measuring Temperature with a Thermistor
5. 13.4. Detecting Methane
6. 13.5. Measuring a Voltage
7. 13.6. Reducing Voltages for Measurement
8. 13.7. Using Resistive Sensors with an ADC
9. 13.8. Measuring Temperature with an ADC
10. 13.9. Measuring the Raspberry Pi CPU Temperature
11. 13.10. Measuring Temperature, Humidity, and Pressure with a Sense HAT
12. 13.11. Measuring Temperature Using a Digital Sensor
13. 13.12. Measuring Acceleration with an MCP3008 Module
14. 13.13. Using the Inertial Management Unit (IMU) of the Sense HAT
15. 13.14. Finding Magnetic North with the Sense HAT
16. 13.15. Sensing a Magnet with a Reed Switch
17. 13.16. Sensing a Magnet with the Sense HAT
18. 13.17. Measuring Distance
19. 13.18. Capacitative Touch Sensing
20. 13.19. Displaying Sensor Values
21. 13.20. Logging to a USB Flash Drive
14.Chapter 14 Displays
1. 14.0. Introduction
2. 14.1. Using a Four-Digit LED Display
3. 14.2. Displaying Messages on an I2C LED Matrix
4. 14.3. Using the Sense HAT LED Matrix Display
5. 14.4. Displaying Messages on an Alphanumeric LCD HAT
6. 14.5. Displaying Messages on an Alphanumeric LCD Module
7. 14.6. Using an OLED Graphical Display
8. 14.7. Using Addressable RGB LED Strips
15.Chapter 15 The Internet of Things
1. 15.0. Introduction
2. 15.1. Controlling GPIO Outputs Using a Web Interface
3. 15.2. Displaying Sensor Readings on a Web Page
4. 15.3. Sending Email and Other Notifications with IFTTT
5. 15.4. Sending Tweets Using ThingSpeak
6. 15.5. CheerLights
7. 15.6. Sending Sensor Data to ThingSpeak
8. 15.7. Responding to Tweets Using Dweet and IFTTT
16.Chapter 16 Arduino and Raspberry Pi
1. 16.0. Introduction
2. 16.1. Programming an Arduino from Raspberry Pi
3. 16.2. Communicating with the Arduino by Using the Serial Monitor
4. 16.3. Setting Up PyFirmata to Control an Arduino from a Raspberry Pi
5. 16.4. Writing Digital Outputs on an Arduino from a Raspberry Pi
6. 16.5. Using PyFirmata with TTL Serial
7. 16.6. Reading Arduino Digital Inputs Using PyFirmata
8. 16.7. Reading Arduino Analog Inputs Using PyFirmata
9. 16.8. Analog Outputs (PWM) with PyFirmata
10. 16.9. Controlling a Servo Using PyFirmata
11. 16.10. Custom Communication with an Arduino over TTL Serial
12. 16.11. Custom Communication with an Arduino over I2C
13. 16.12. Using Small Arduinos with a Raspberry Pi
14. 16.13. Getting Started with an aLaMode Board and a Raspberry Pi
15. 16.14. Using an Arduino Shield with an aLaMode Board and a Raspberry Pi
17.Appendix Parts and Suppliers
1. Parts
2. Prototyping Equipment
3. Resistors and Capacitors
4. Transistors and Diodes
5. Integrated Circuits
6. Opto-Electronics
7. Modules
8. Miscellaneous
18.Appendix Raspberry Pi Pinouts
1. Raspberry Pi 3/2 model B, B+, A+, Zero
2. Raspberry Pi model B rev. 2, A
3. Raspberry Pi model B rev. 1
Raspberry Pi Hacks: Tips & Tools for Making Things with the Inexpensive Linux Computer
Rs.725.00
ISBN: 9789351104292
Author: Tom Callaway, Ruth Suehle
Edition: 1
Publisher: Shroff/O'Reilly
Description
With more than 60 practical and creative hacks, this book helps you turn Raspberry Pi into the
centerpiece of some cool electronics projects. Want to create a controller for a camera or a robot?
Set up Linux distributions for media centers or PBX phone systems? That’s just the beginning of
what you’ll find inside Raspberry Pi Hacks.
If you’re looking to build either a software or hardware project with more computing power than
Arduino alone can provide, Raspberry Pi is just the ticket. And the hacks in this book will give
you lots of great ideas.
Use configuration hacks to get more out of your Pi
Build your own web server or remote print server
Take the Pi outdoors to monitor your garden or control holiday lights
Connect with SETI or construct an awesome Halloween costume
Hack the Pi’s Linux OS to support more complex projects
Decode audio/video formats or make your own music player
Achieve a low-weight payload for aerial photography
Build a Pi computer cluster or a solar-powered lab
Table of Contents
1. Chapter 1 Configuration Hacks
1. Hack 1. Choose and Format the Right SD Card
2. Hack 2. Mount the SD Card
3. Hack 3. Decode the LEDs
4. Hack 4. Update the Firmware
5. Hack 5. Monitor the Raspberry Pi Hardware
6. Hack 6. Overclock Your Pi
7. Hack 7. Overvolt for Higher Performance
8. Hack 8. Get More USB Ports
9. Hack 9. Troubleshoot Power Problems
10. Hack 10. Unbreak Your Raspberry Pi
11. Hack 11. Go Headless
12. Hack 12. Connect with SSH
13. Hack 13. Give Your Pi a Static IP Address
14. Hack 14. Learn to Speak GPIO
15. Hack 15. Connect GPIO Pins to a Breadboard
16. Hack 16. Add a USB Serial Console
17. Hack 17. Add a Reset Button
18. Hack 18. Get Power to the Pi on the Move
19. Hack 19. Test Your Might (in Volts)
20. Hack 20. Add Additional Memory with Swap
2. Chapter 2 Hacking Linux for the Raspberry Pi
1. Hack 21. Build a Cross-Compiler Toolchain
2. Hack 22. Build a Custom Kernel
3. Hack 23. Update to the Latest Prebuilt Kernel
4. Hack 24. Split Memory Between the GPU and Linux Userspace
5. Hack 25. Update the Firmware and Prebuilt Binary Kernel the Easy Way
6. Hack 26. Emulate the Pi
7. Hack 27. Try Occidentalis: The Raspberry Pi Distro for (Advanced) Education
8. Hack 28. Monitor the Pi’s IP Address
9. Hack 29. Run Android on the Raspberry Pi
3. Chapter 3 Raspberry Pi Around the House
1. Hack 30. Share Files with Samba
2. Hack 31. Use Your Raspberry Pi as a Remote Print Server
3. Hack 32. Make Calls with a Raspberry Pi Asterisk Telephone System
4. Hack 33. Build Your Own Web Server
5. Hack 34. Control a LEGO Robot
6. Hack 35. (Appear to) Survive a Gaping Chest Wound
7. Hack 36. Look for Aliens
4. Chapter 4 Hacking the Outdoors
1. Hack 37. Tell the Temperature Outside (Without Going Out There)
2. Hack 38. Check on Your Plants
3. Hack 39. Make Your Pi Water-Resistant (with a Case)
4. Hack 40. Make Your Pi Water-Resistant (Without a Case)
5. Hack 41. Find Geocaches from Your Car
6. Hack 42. See the Light
7. Hack 43. Listen to Aircraft Transponders
8. Hack 44. Control Aerial Photography
9. Hack 45. Have the Best Holiday Lights Display
5. Chapter 5 Multimedia Hacks
1. Hack 46. Play Video Files
2. Hack 47. Enable Additional Video Codecs
3. Hack 48. Build a Pi MusicBox
4. Hack 49. Turn Your Pi into a Radio
5. Hack 50. Control the Pi via Touchscreen
6. Hack 51. Emulate Classic Video Game Consoles
7. Hack 52. Connect a DSLR
8. Hack 53. Set Up a Photobooth
9. Hack 54. Turn Your Pi into a Tiny Media Center
10. Hack 55. Watch Movies in the Backseat of Your Car
6. Chapter 6 Extend Your Pi
1. Hack 56. Control GPIO from a Web Browser
2. Hack 57. Add a Tiny Screen
3. Hack 58. Connect Arduino Shields to Your Raspberry Pi
4. Hack 59. Control a 3D Printer
5. Hack 60. Add a Numeric Keypad
6. Hack 61. Add a Heat Sink
7. Hack 62. Enable the Raspberry Pi Camera on Pidora
8. Hack 63. Build a Solar-Powered Lab
9. Hack 64. Build a MIDI Controller (on the Cheap!)
10. Hack 65. Build a Raspberry Pi Supercomputer
Make: Jumpstarting the Raspberry Pi Zero W - Control the World Around
you with a $10 Computer
ISBN: 9789352137329
Author: Akkana Peck
Edition: First
Publisher: Shroff/Maker Media
Description
ALL MAKE: INDIAN REPRINTS ARE IN GRAYSCALE
Get up and running quickly with the new Jumpstarting ebook series from Make:. The
super-small $10 Raspberry Pi Zero W includes wireless LAN and Bluetooth
connectivity and is 40% faster than the original Raspberry Pi.
Why choose the Raspberry Pi Zero W? It's small. It's cheap. It's power-efficient. It has
WiFi and Bluetooth Low Energy (BLE) built in. And it has the same general-purpose
input/output (GPIO) header that bigger Raspberry Pi models have: the gateway to
controlling all sorts of hardware.
Projects include:
An environmental monitor that can keep track of the temperature in your house, and even
turn on your fan or air conditioner before you get home from work
A wearable light string that monitors news feeds and websites to alert you when there's
something interesting going on
This is the perfect book for students, teachers, and hobbyists who want a quick-start
guide to the Raspberry Pi Zero W. No prior experience with programable boards is
required.
Table of Contents
Acknowledgments vii
1 Getting Started 1 Hardware Requirements 2 About the Raspberry Pi Zero W 2 Installing
Raspbian 4 Connecting to a Monitor, Keyboard, and Mouse 6 Headless: Connecting Without a
Monitor 9 Finding Your Pi on the Local Network 12 SSHing to Your Raspberry Pi 13 Logging
In and Changing the Default Password 14 Basic Configuration 15 The PIXEL Desktop 17
Introducing the Linux Command Line 18 Installing Software 20 Getting Help 21
2 Blink an LED 23 Hardware Requirements 24 What Is GPIO? 25 Headers: Hooking Up to the
Pi Zero W 25 Wiring an LED on a Breadboard 28 The Raspberry Pi Pin Layout 31 Controlling
an LED from the Command Line 33 Blinking an LED from the Command Line 35 Blinking an
LED from a Python Program 36 Fade an LED 39 Python Blink Using RPi-gpio 40
vi
Python Fade using RPi-gpio 42 Reading Input: A Pushbutton 43 Other Languages, Other
Interfaces 46
3 A Temperature Notifier and Fan Control 47 Hardware Requirements 48 What Is I2C? 49
Choosing a Sensor 50 A Temperature Tweeter 59 Controlling a Fan or Air Conditioner 65
4 A Wearable News Alert Light Show 73 Hardware Requirements 74 DotStars 77 NeoPixels 82
Searching for Twitter Keywords 89 Web Scraping in Python 95 Making It Portable: Batteries 98
Bottom of Form
Make: Jumpstarting JavaScript - Build a Twitter Bot and LED Alert System
with Node.js and Raspberry Pi
ISBN: 9789352137404
Author: Lynn Beighley
Edition: First
Publisher: Shroff/Maker Media
Description
ALL MAKE: INDIAN REPRINTS ARE IN GRAYSCALE
Jumpstarting books provide an avenue for makers to quickly master topical
knowledge!
Each book starts with instructions on how to install or initialize the hardware or
software needed to reach the "Hello, World" stage of getting started!
The second project in the book builds on the first to use more of the hardware or
software's capabilities. Later projects expand the user's knowledge into lesser-known
aspects of the topic.
All Jumpstarting projects are for Makers -- they provide hands-on, real-world experience in
making the hardware or software do what you want it to do!
Table of Contents
Preface vi
1 Meet JavaScript and Node.js! 1 Install Node on Mac 2 Install Node on Windows 5 Install
Node on Linux 7 Node Is Installed; Now What? 9
2 Getting into JavaScript 13 Strings, Math, and the REPL 13 Functions 16 Using
JavaScript Files 17 Make a Web Server 18
3 Creating a Node Twitter Bot on Raspberry Pi 21 Create and Authorize Your Twitter
Account 21 Create a Configuration File 24 Create the Twitter Bot 25
4 Flash an LED in Response to a Twitter Event 33 Set Up the LED on Your Raspberry Pi
34 Create the Blink Program 36 Make Your Bot Detect Your Twitter Handle 37 Make
Your Bot Blink the LED When Mentioned 39 Node, Pi, and the Internet of Things 40
vi
PREFACE: WHAT IS NODE.JS? JavaScript is a programming language that web
browsers can run. Browsers like Firefox and Chrome are built with engines that can
understand and execute programs written in the JavaScript language. Firefox has an
engine called SpiderMonkey, and Chrome’s engine is called V8. Running JavaScript in a
browser limits what you can do with it. For example, with JavaScript in a browser, you are
limited to interacting with web pages. You can detect errors when people enter information
in a form. You can open browser windows and alert boxes. But you can’t control anything
outside of a browser. Fortunately, you have another option. When you install and use the
JavaScript extension Node.js, your JavaScript code can run independently of a web
browser. (You’ll often see Node.js simply called Node, and that’s what we’ll do for the rest
of this book.) Node is the V8 JavaScript engine bundled together with libraries that handle
input/output and networking. This means that Node lets you use JavaScript outside of a
browser to run shell scripts, manage back-end services, and run directly on devices.
What You Bring to the Book
* Basic familiarity with programming concepts
* Ability to set up and connect a Raspberry Pi
* Ability to access and use a console
* Understanding of sudo, directories, and file creation/editing