Raspberry Pi Essentials

Book description

Get up and running with the Raspberry Pi to develop captivating projects

In Detail

The Raspberry Pi is an inexpensive, single-board computer system about the size of a deck of cards. This computer can be configured to use a standard-size keyboard, monitor, and mouse.

The book begins by teaching you how to build and configure a Raspberry Pi development environment.

Next, you will get acquainted with concepts such as connecting USB peripherals for video and image capture, and high-quality audio. Using GPIO peripherals, you will drive LEDs and sense switches and connect SMBUS-controlled peripherals. Over the course of eight chapters, you will gain experience with desktop tools, the shell command line, and Python scripts.

This book includes hands-on projects that involve building a talking clock, creating a camera-based movement detection system, developing an Internet radio, building an RC-servo control program, configuring remote access to a Raspberry Pi, and building a line-following robot.

What You Will Learn

  • Build your own full-fledged Raspberry Pi hardware and install the Raspbian OS
  • Configure the Raspberry Pi development environment and get acquainted with OS configuration and tools
  • Build a camera-based project using PiCam and USB cameras
  • Build and configure a stereo audio system using VLC
  • Explore the Raspberry Pi GPIO to connect to the outside world
  • Utilize and explore extensive I2C interface support built into the Raspberry Pi to enhance your system
  • Configure remote access and battery power for a mobile Raspberry Pi
  • Build a fully functional Raspberry Pi line-following robot using PiCam

Table of contents

  1. Raspberry Pi Essentials
    1. Table of Contents
    2. Raspberry Pi Essentials
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Getting Started with Raspberry Pi
      1. Let's get started
      2. Unboxing the Raspberry Pi
        1. Configure power for Pi
      3. Local display, keyboard, mouse, or remote headless access
      4. Selecting a screen
        1. Connecting VGA displays
      5. Getting your SD Card ready
      6. Booting the Raspberry Pi for the first time
        1. It's time to power up the Pi
        2. No video on initial boot
        3. Final installation configuration
      7. A quick tour of the desktop
      8. Instructions for downloading all project files
      9. Summary
    9. 2. Configuring the Raspberry Pi Desktop and Software
      1. Hardware and software networking configuration
        1. Client reservations for Ethernet and wireless
      2. Configuring the Raspberry Pi desktop and software
        1. Keeping the development environment up to date
        2. Setting up a screensaver
        3. Manually locking your session
      3. Desktop and file manager accelerators
        1. Adding root privileges to the PCManFM file manager
        2. Programming on the Raspberry Pi
        3. Developing with Bash shell scripts
      4. Project 1 – Building a talking clock with a Bash script
        1. Creating project files and directories
      5. Building a talking clock with Python 3
      6. Summary
    10. 3. Raspberry Pi and Cameras
      1. Connecting cameras to the Raspberry Pi
      2. PiCam and PiNoIR
      3. Webcams
      4. Project architecture for the Raspberry Pi security camera
      5. Features and limitations of the cameras
        1. Testing camera capability
        2. Viewing CPU resource for the luvcview application
        3. Verifying the PiCam operation
        4. Controlling data storage for video
        5. Testing the data storage limit
      6. Project 1 – Running raspivid as a background service
      7. Project 1a – Creating a Bash script to drive raspivid
        1. Testing the picam.sh script
      8. Project 1b – Creating a movement detector with a USB camera
        1. Test the webcam installation
        2. A final word on resolution and frame rate for movement detection
      9. Project 2 – Combining the webcam movement detector and the PiCam camera
      10. Project 3 – Creating a simple Python GUI for the security application
      11. Summary
    11. 4. Raspberry Pi Audio Input and Output
      1. Audio quality and bandwidth
      2. Audio capability on the Raspberry Pi
        1. Limited headphone output
      3. Understanding the ALSA configuration
        1. Configuring the default device for ALSA
      4. Configuring the Raspberry Pi to support high-quality sound
      5. Project 1 – Installing an advanced audio playback application
      6. Building an Internet radio based on VLC and Raspberry Pi
      7. Project 2a – Running VLC in the background for the Internet radio
        1. Starting VLC automatically at reboot
      8. Project 2b – Designing a playlist file for the Internet radio
        1. Chapter 4 supplemental materials
      9. Project 2c – Parsing the playlist file for the Internet radio
      10. Project 2d – Implementing a Python text interface to VLC
      11. Project 3 – Implementing a TKinter GUI for the Internet radio
        1. Running tktest.py
        2. Creating a clock in the radio UI
        3. Running tkradio.py
      12. Recording sound files on the Pi
      13. Summary
    12. 5. Port Input and Output on the Raspberry Pi
      1. Understanding Raspberry Pi digital input and output ports
        1. Using breakout boards with the Raspberry Pi
      2. Driving LEDs as output indicators
        1. Python LED demo
      3. TKinter LED demo
        1. Block 1 – initialization
        2. Block 2 – on/off buttons
        3. Block 3 – monostable function
        4. Block 4 – loop flash
        5. Block 5 – PWM flash
        6. Block 6 – TKPWM flash and toggle tkrun
        7. Block 7 – start the application
      4. TKinter switch demo
        1. Block 1 – the activity indicator
        2. Block 2 – the Edge switch detector
        3. Block 3 – the Event switch detector
      5. Adding a physical switch interface to the Internet radio
      6. Project 1 – Add a switch interface to the Internet radio
      7. Summary
    13. 6. Driving I2C Peripherals on the Raspberry Pi
      1. Getting started with I2C
        1. Understanding address fields
        2. Driving RC servos
        3. Raspberry Pi software requirements for SMBus
        4. Programming the PCA 9685 to drive a servo
        5. PCA 9685 addressing and registers
      2. Project 1 – Python control of a PWM board driving RC servo motors
        1. Code block 1 – imports, constants, and variables
        2. Code block 2 – I2C access functions
        3. Code block 3 – the PCA9685 specific code
        4. Code block 4: the test code
          1. Other demo code
      3. Summary
    14. 7. Going Mobile with Raspberry Pi
      1. Remote access to the Raspberry Pi
        1. Using PuTTY remote access
        2. Installing PuTTY on Microsoft Windows
      2. Remote access from Linux and OSX
      3. Testing your remote session from a PC or Mac
      4. Battery power systems
        1. Selecting regulators
        2. Measuring Raspberry Pi project current
        3. Potential battery power solutions
          1. Adafruit PowerBoost 1000 Basic
          2. Adafruit PowerBoost 500C
          3. Power banks as an alternative mobile power system
      5. Project 1 – Selecting a project battery capacity
      6. Summary
    15. 8. Creating a Raspberry Pi Line-following Robot
      1. Implementing a line-following robot
      2. Line-following robot architecture
        1. Software architecture
        2. Software module functions
      3. Implementing rbuttons.py
        1. Downloading rbuttons.py and test-buttons.py
        2. Implementing rcam.py
        3. Installing the pip manager
          1. Installing the pip package manager
          2. Installing Pillow
        4. Downloading rcam.py
      4. Implementing rwheel.py
        1. Downloading rwheel.py and test-rwheel.py
      5. Implementing navigate.py
        1. Downloading navigate.py
        2. The steering methodology
        3. Open loop servo control
        4. Analyzing camera data
      6. Steering algorithm
      7. Time to build the mobile system
        1. Checking wireless connectivity
      8. Line-following robot
        1. Assembling the robot
        2. How to bring up your robot
        3. Navigating the robot
      9. Summary
    16. Index

Product information

  • Title: Raspberry Pi Essentials
  • Author(s): Jack Creasey
  • Release date: April 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781784396398