O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning Raspberry Pi

Book Description

Unlock your creative programming potential by creating web technologies, image processing, electronics- and robotics-based projects using the Raspberry Pi

In Detail

Raspberry Pi is one of the most popular development boards and a staple tool among developers because of its low cost and flexibility.

Learning Raspberry Pi is a practical tutorial, providing you with the skills required to design and build your own projects. By working through the examples and projects in the book, you will build up your knowledge of software and hardware development and be able to create projects of your own.

This book contains a set of tutorials and examples for commonly used technologies, accompanied by practical projects that bring the topics together. Each individual project that you become involved with allows you to develop an important set of skills, building up your confidence to tackle more advanced applications of your own.

What You Will Learn

  • Get to grips with the basics of Linux administration, along with the inner workings of Linux distributions
  • Develop a web interface that can be used to upload selected files and create playlists
  • Discover how to connect your Raspberry Pi to the real world using analog inputs
  • Build your own remote-controlled robot
  • Get to know about different image processing operations
  • Explore troubleshooting tips and tricks
  • Create your own Twitter-enabled Raspberry Pi camera

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 files e-mailed directly to you.

Table of Contents

  1. Learning Raspberry Pi
    1. Table of Contents
    2. Learning Raspberry Pi
    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. Getting to know your Raspberry Pi
        1. Different types of operating systems
        2. The Raspbian OS
        3. The Arch Linux ARM OS
        4. The RISC OS
        5. OpenELEC and Raspbmc
        6. Other operating systems
        7. Command summary
      2. Installation methods
        1. NOOBS and BerryBoot
        2. Installing Raspbian using RAW images
          1. Writing an image using Windows
          2. Writing an image using Linux
          3. Raspbian OS interface
          4. Expanding the filesystem
        3. Installing Raspbian using raspbian-ua-netinst
          1. Preparing the NetInstall on Linux
          2. Preparing the NetInstall on Windows
          3. Post-install configuration for Raspbian distribution
      3. User management
      4. Remotely accessing Raspberry Pi
        1. The SSH remote server
          1. Securing SSH
          2. Transferring files
          3. X11 Forwarding
          4. Maintaining remote session using screen
          5. The reverse SSH
        2. Virtual display using VNC
        3. Share the keyboard and mouse using Synergy
      5. Installing a web server
        1. Adding PHP support
        2. Installing WordPress
      6. Summary
    9. 2. Developing Web Applications
      1. Getting started with HTML, JavaScript, and jQuery
        1. Adding page content with HTML
        2. Customizing the visual appearance
        3. Adding interactivity with JavaScript
        4. Simplifying scripts with jQuery
      2. An introduction to Python
        1. Syntax
        2. Data types
        3. Decorators
        4. Modules
        5. Flask
      3. Creating an Internet radio station
        1. Creating the user interface
        2. Writing the backend
        3. Connecting the user interface to the backend
        4. Setting up MPD
      4. Deploying Flask applications
      5. Summary
    10. 3. Introduction to Electronics
      1. Understanding the physics behind electronics
        1. Charge, voltage, current, and resistance
      2. Basic laws of electronics
        1. Ohm's law
        2. Kirchhoff's law
          1. Kirchhoff's Current Law (KCL)
          2. Kirchhoff's Voltage Law (KVL)
      3. Electronics components
        1. Resistors
        2. Diodes
        3. Switches
        4. Integrated circuits
        5. Sensors
        6. LCD
        7. Wire
        8. Breadboard
        9. Raspberry Pi electronics
        10. WiringPi
      4. Developing a digital clock
        1. Setting up Raspberry Pi
          1. Understanding HD44780-based LCD
        2. Connecting LCD pins and Raspberry Pi GPIO pins
        3. Scripting
          1. The __init__ function
          2. The clear function
          3. The cmd function
          4. The message function
      5. Developing an e-mail notifier
        1. Connecting LCD pins and Raspberry Pi GPIO pins
        2. Scripting
      6. Developing an alarm clock
        1. Connecting LCD pins, Raspberry Pi GPIO pins, and a speaker
        2. Scripting
      7. Summary
    11. 4. Getting into Robotics
      1. Introduction to robotics
      2. More electronic components
        1. Introduction to motors
        2. Introduction to multimeter
        3. Robotic base
        4. Level converter
        5. Motor driver IC
          1. H-Bridge
        6. The Raspberry Pi camera
          1. Setting up the camera
          2. Usage of modules
            1. Taking a picture
            2. Recording a video
        7. An Ultrasonic sensor
        8. The Raspberry Pi battery
        9. The Raspberry Pi Wi-Fi module
      3. Developing a remote-controlled robot with live feed and live distance to the nearest wall
        1. Calculating distance using an ultrasonic sensor
          1. Setting up Raspberry Pi
          2. Connecting ultrasonic sensors pins and Raspberry Pi pins
          3. Scripting
        2. Displaying live feed from the Raspberry Pi camera module
          1. Setting up Raspberry Pi
          2. Connecting the Raspberry Pi and Raspberry Pi camera module
          3. Scripting
        3. Developing a remote-controlled robot using Raspberry Pi
          1. Setting up Raspberry Pi
          2. Connecting Raspberry Pi pins and robot
          3. Scripting
            1. Creating a user interface for controlling the robot
            2. Controlling the movement of the robot
              1. Initialization
              2. Robot movement
                1. Forward
                2. Others
            3. Server files that can control the Raspberry Pi GPIO
        4. Merging everything
          1. Connection
          2. Scripting
            1. Updating the user interface
            2. Updating server-related files
      4. Summary
    12. 5. Introduction to Image Processing
      1. What is image processing?
        1. Images and types of images
          1. The grayscale image
          2. Color/RGB
        2. Image formats
        3. Applications of image processing
      2. The Raspberry Pi camera module
      3. The image processing library
        1. Introduction to OpenCV
          1. Installation
            1. The first approach
            2. The second approach
      4. A quick start to image processing
        1. Reading and opening an image
        2. Saving the image in other formats
        3. Saving the image as a grayscale image
        4. Pixel-related operation on the image
          1. Accessing and modifying pixel values
          2. Accessing image properties
        5. Arithmetic operations on the image
          1. Image addition
          2. Image blending
        6. Reading and opening a video
      5. Creating time-lapse videos with the Raspberry Pi camera
        1. Taking time-lapse pictures
        2. Merging images into a video
      6. Developing a Twitter-controlled Raspberry Pi camera
        1. Setting up
          1. Setting up Raspberry Pi
          2. Getting Twitter Access keys
        2. Scripting
      7. Summary
    13. 6. Image Processing Algorithms
      1. Important image processing operations
        1. The image smoothing filter
          1. Averaging
          2. Gaussian filtering
          3. Median filtering
          4. Bilateral filtering
        2. Morphological operations
          1. Erosion
          2. Dilation
          3. Opening
          4. Closing
      2. Core algorithms
        1. Edge detection
        2. Background subtraction
          1. BackgroundSubtractorMOG
          2. BackgroundSubtractorMOG2
      3. Machine learning
        1. Object detection algorithm
        2. Face detection
        3. Eye detection
      4. Projects
        1. The track object position
        2. OpenRelief
          1. Capabilities
          2. Technical specifications
        3. Twitter-enabled surveillance systems
      5. Summary
    14. 7. Troubleshooting, Tips/Tricks, and Resources for Advanced Users
      1. Troubleshooting
        1. Power/booting/installation
          1. The LED status and their interpretation
            1. The red Power LED does not turn ON, nothing gets displayed on screen
            2. The red power LED is blinking
            3. The red power LED is ON, the green LED does not flash, and nothing gets displayed on screen
            4. The green LED blinks in a specific pattern
          2. A colored splash screen stays forever
          3. Kernel panic on boot
          4. Raspberry Pi shuts down after booting up
        2. Inputs
        3. USB webcam
        4. Networking
        5. Sound
        6. The Raspberry Pi camera
          1. RaspiStill does not work, no image is taken
        7. Display
        8. Firmware updates
        9. Manual disk resize
      2. Tips and tricks
        1. Play MP3 files
        2. Remove boot messages
        3. Remove the Raspberry Pi logo from boot screen
        4. Remove unnecessary files from Raspberry Pi
        5. Show all/hidden folders/file
        6. Show a list of Python modules installed on systems
        7. Raspberry Pi board info / CPU info
        8. Overclock Raspberry Pi without voiding warranty
        9. Freeing up RAM on Raspberry Pi
        10. Set memory split between ARM and GPU in Raspberry Pi
        11. Capture a screenshot using Raspberry Pi
        12. Find the IP address of the Raspberry Pi
        13. Buy a Raspberry Pi case
        14. Make your own Raspberry Pi case
        15. Use Chrome browser in Raspberry Pi
        16. Shut down your Raspberry Pi
        17. I would like to connect x device to my Raspberry Pi. How can I be sure it is going to work?
        18. Some useful commands
      3. Resources for advanced users
        1. Projects
          1. The touchscreen car dashboard
          2. A talking book player
          3. The Morse code transmitter
          4. The automated pet feeder
          5. Home automation system using Raspberry Pi and Arduino
          6. Face-recognizing safe with Raspberry Pi
          7. Supercomputer
        2. Useful resources
      4. Summary
    15. Index