0%

Book Description

Start building amazing projects with the Raspberry Pi right out of the box

About This Book

  • Explore the vast range of opportunities provided by Raspberry Pi and other hardware components such as a webcam, the Pi camera, and sensors
  • Get hands-on experience with coding, networking, and hardware with the Raspberry Pi platform
  • Learn through ample screenshots that offer a play-by-play account of how to implement Raspberry-Pi-based real-life projects

Who This Book Is For

What's the best way to learn how to use your Raspberry Pi? By example! If you want something exciting to do whilst getting to grips with what your Pi can offer, this is the book for you. With both simple and complex projects, you'll create a wide variety of cool toys and functions with your Raspberry Pi - all with minimal coding experience necessary.

What You Will Learn

  • Set up your Raspberry Pi and get it ready for some interesting real-life projects
  • Work with images, videos, webcams, and the Pi camera and create amazing time-lapse videos
  • Explore the amazing world of Minecraft Pi
  • Get to know how to use PiGlow for GPIO programming
  • Interface your Pi with Grove Sensors and implement IoT applications
  • Build your own cluster with Raspberry Pi
  • Understand the networking and network programming fundamentals

In Detail

Want to put your Raspberry Pi through its paces right out of the box? This tutorial guide is designed to get you learning all the tricks of the Raspberry Pi through building complete, hands-on hardware projects. Speed through the basics and then dive right in to development!

Discover that you can do almost anything with your Raspberry Pi with a taste of almost everything. Get started with Pi Gaming as you learn how to set up Minecraft, and then program your own game with the help of Pygame. Turn the Pi into your own home security system with complete guidance on setting up a webcam spy camera and OpenCV computer vision for image recognition capabilities. Get to grips with GPIO programming to make a Pi-based glowing LED system, build a complete functioning motion tracker, and more. Finally, get ready to tackle projects that push your Pi to its limits. Construct a complete Internet of Things home automation system with the Raspberry Pi to control your house via Twitter; turn your Pi into a super-computer through linking multiple boards into a cluster and then add in advanced network capabilities for super speedy processing!

Style and approach

This step-by-step guide to building Raspberry-Pi-based projects is explained in a conversational and easy-to-follow style. Each topic is explained sequentially in the process of creating real-life projects, and detailed explanations of the basic and advanced features of various Python libraries are also included.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Raspberry Pi By Example
    1. Table of Contents
    2. Raspberry Pi By Example
    3. Credits
    4. About the Authors
    5. About the Reviewers
    6. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    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. Introduction to Raspberry Pi and Python
      1. Single-board computers
      2. Raspberry Pi
        1. Raspberry Pi models
      3. Operating systems
        1. Raspbian
      4. Setting up the Raspberry Pi
        1. Preparing MicroSD card manually
        2. Booting up our Pi for the first time
        3. Shutting down and rebooting Pi safely
        4. Updating the Pi
      5. Getting started with Python
        1. Turtle programming with Python
      6. Summary
    9. 2. Minecraft Pi
      1. Introduction to Minecraft Pi
      2. Playing Minecraft Pi
        1. Movement control in Minecraft Pi
        2. Action control in Minecraft Pi
        3. Other controls in Minecraft Pi
      3. Python programming for Minecraft Pi
      4. Summary
    10. 3. Building Games with PyGame
      1. Introducing PyGame
      2. Installing PyGame
      3. Drawing a binary fractal tree
      4. Building a snake game
      5. Summary
    11. 4. Working with a Webcam and Pi Camera
      1. Working with webcams
        1. Crontab
        2. Creating a timelapse sequence using fswebcam
        3. Webcam video recording and playback
      2. Working with the Pi Camera and NoIR Camera modules
        1. Using raspistill and raspivid
        2. Using picamera in Python with the Pi Camera module
        3. The Pi camera versus the webcam
      3. Summary
    12. 5. Introduction to GPIO Programming
      1. Introducing GPIO pins
      2. Building an LED Blinker
        1. Connecting a button
      3. Installing PiGlow
      4. Using PiGlow
      5. Building a binary clock
      6. Summary
    13. 6. Creating Animated Movies with Raspberry Pi
      1. Introducing stop-motion animation
      2. Setting up the prerequisites
        1. Setting up and testing the camera
        2. Adding the hardware button
      3. Rendering the video
      4. Summary
    14. 7. Introduction to Computer Vision
      1. Introducing Computer Vision
      2. Introducing OpenCV
      3. Setting up Pi for Computer Vision
        1. Testing the OpenCV installation with Python
      4. Introducing NumPy
        1. Array creation
        2. Basic operations on arrays
        3. Linear algebra
      5. Working with images
        1. Using matplotlib
      6. Working with Webcam using OpenCV
        1. Saving a video using OpenCV
        2. Pi Camera and OpenCV
      7. Retrieving image properties
      8. Arithmetic operations on images
      9. Splitting and merging image color channels
        1. Negating an image
      10. Logical operations on images
      11. Colorspaces and conversions
      12. Tracking in real time based on color
      13. Summary
    15. 8. Creating Your Own Motion Detection and Tracking System
      1. Thresholding images
        1. Otsu's method
      2. Noise
        1. Kernels for noise removal
        2. 2D convolution filtering
        3. Low pass filtering
      3. Morphological transformations on images
      4. Motion detection and tracking
      5. Summary
    16. 9. Grove Sensors and the Raspberry Pi
      1. Introducing the GrovePi
      2. Setting up the GrovePi
      3. Displaying the weather
      4. Intruder detection system
      5. Summary
    17. 10. Internet of Things with the Raspberry Pi
      1. Introducing the Internet of Things
      2. Installing the Twitter API for Python
        1. Using Tweepy
      3. Setting up a SQLite database in Python
      4. Building a tweeting weather station
        1. Adding speech capabilities to our weather station
      5. Summary
    18. 11. Build Your Own Supercomputer with Raspberry Pi
      1. Introducing a Pi-based supercomputer
      2. Installing and configuring MPICH2 and MPI4PY
        1. Installing the MPICH library
        2. Installing MPI4PY
      3. Setting up the Raspberry Pi cluster
      4. Setting up SSH access from the host to the client
      5. Running code in parallel
      6. Performance benchmarking of the cluster
      7. Introducing N-Body simulations
      8. Installing and running GalaxSee
      9. Summary
    19. 12. Advanced Networking with Raspberry Pi
      1. Introducing DHCP
      2. A few networking concepts
      3. Configuring a Raspberry Pi to act as a DHCP server
      4. Introducing Domain Naming System (DNS)
      5. Setting up a DNS server on the Pi
      6. Configuring the setup for a web server
      7. Automating node discovery in a network
      8. Summary
    20. 13. Setting Up a Web Server on the Raspberry Pi
      1. Introducing and installing Apache on Raspbian
      2. Installing PHP and MySQL
      3. Installing WordPress
        1. Configuring the WordPress installation
      4. Summary
    21. 14. Network Programming in Python with the Pi
      1. The basics of sockets
      2. The difference between TCP and UDP
        1. The architecture and programming of UDP sockets
          1. Sending and receiving data with UDP
          2. UDP servers and NCAT
          3. An echo server using Python UDP sockets
          4. A UDP client
        2. The architecture of TCP sockets
          1. Creating a TCP socket
          2. Connecting to a server with a TCP socket
          3. Receiving data from the server
        3. Programming socket servers
          1. Binding a socket
          2. Listening for incoming connections
          3. Handling multiple connections
      3. Looking back
      4. A Telnet client in Python
      5. A chat program
        1. The chat server
        2. The chat client
      6. References
      7. Exercise
      8. Summary
    22. A. Newer Raspberry Pi Models
      1. The Raspberry Pi Zero
      2. The Raspberry Pi 3
    23. Index