Mark Edward Soper

Expanding Your Raspberry Pi

Storage, printing, peripherals, and network connections for your Raspberry Pi

Mark Edward Soper

Indianapolis, Indiana, USA

Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book's product page, located at www.apress.com/978-1-4842-2921-7 . For more detailed information, please visit http://www.apress.com/source-code .

ISBN 978-1-4842-2921-7

e-ISBN 978-1-4842-2922-4

https://doi.org/10.1007/978-1-4842-2922-4

Library of Congress Control Number: 2017952610

© Mark Edward Soper 2017

This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.

Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.

While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.

Printed on acid-free paper

Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.

Contents

  1. Chapter 1:​ Raspberry Pi System Anatomy
    1. Model Overview
      1. Common Features
      2. Model A Family
      3. Model B Family
      4. Zero
    2. CPU and RAM
      1. System-on-a-Chip (SoC)
      2. CPU, RAM, and SoC Features
    3. Ports
    4. Board-Level Connectors
    5. Integrated Network Features
    6. Power Supplies
    7. Summary
  2. Chapter 2:​ The Distro Bunch
    1. Raspbian
      1. Raspbian with PIXEL Fast Facts
      2. Raspbian Lite Fast Facts
    2. Other Linux Distros Available with NOOBS
      1. LibreELEC_​R Pi 2 Overview and Fast Facts
      2. Lakka_​R Pi 2 Overview and Fast Facts
      3. OSMC_​P2 Overview and Fast Facts
      4. RISC OS Overview and Fast Facts
      5. Windows 10 IoT Core Overview and Fast Facts
    3. Other Linux Distros Available with PINN
      1. Arch Linux ARM
      2. RetroPie
    4. Using NOOBS
      1. Installing an OS with NOOBS
      2. Restarting NOOBS
    5. Using PINN:​ An Alternative to NOOBS
    6. Using BerryBoot
      1. Installing BerryBoot
      2. Installing an OS with BerryBoot
      3. More Options for BerryBoot
      4. Loading an OS with BerryBoot
    7. Other Linux Distros for Raspberry Pi
      1. FreeBSD
      2. NetBSD
      3. Fedora and CentOS
      4. OpenWRT
    8. Choosing the Best Distro for the Task
      1. Creating Your Media
    9. Summary
  3. Chapter 3:​ Adding Mass Storage
    1. Recommended Memory Card Types
    2. Expanding a Partition on a Flash Memory Card
      1. Determining the Current Partition Size (Parted)
      2. Expanding the Partition Using Parted
      3. Expanding the Partition with RootFS-Expand (CentOS)
      4. Expanding the Partition Used by RISC OS
    3. Connecting a USB Flash Drive or Memory Card
      1. Mounting a Drive for Read/​Write Access
    4. Partitioning a Flash Memory Card or USB Drive
    5. Formatting a Drive with ext4 File System
    6. Adding and Using an External Hard Drive
    7. Adding and Using a WDLabs Pi Drive
    8. Wireless Drives
    9. Troubleshooting
      1. Incorrectly Formatted Media
      2. Not Enough Power
      3. Drive Can’t Be Mounted in Read/​Write Mode
    10. Summary
  4. Chapter 4:​ Connecting to a Workgroup Network
    1. Distro and Raspberry Pi Configuration
      1. Connecting to a Windows Share with PIXEL
      2. Connecting to a Windows Share from the Command Line with smbclient
      3. Connecting to Different Workgroups
      4. Connecting to an OSX (MacOS) Share from Raspbian PIXEL
    2. Using Wireless Drives
      1. Connecting to a SanDisk Connect Wireless Flash Drive
      2. Connecting to a Seagate Wireless Plus Drive
    3. Printing to a Network Printer
      1. Configuring CUPS
      2. Setting Printer Defaults
      3. Testing Your Printer
    4. Scanning with a Network Scanner
    5. Raspberry Pi Linux Samba Server Configuration
      1. Creating Local Users
      2. Creating a Network User
      3. Configuring smb.​conf
      4. Logging into the Raspberry Pi
    6. Connecting to Raspberry Pi from an Android Device
    7. Connecting to Raspberry Pi from an iOS Device
    8. Troubleshooting
    9. Summary
  5. Chapter 5:​ Sharing an Internet Connection
    1. Hardware Used in This Chapter
    2. Configuring the Pi for Sharing (Hardware)
    3. Configuring the Pi for Sharing (Software)
      1. Planning the Network Configuration
    4. Sharing a Wired Connection Using a Wireless Adapter
      1. Sharing a Wireless Connection Using an Ethernet Port and Switch
    5. Troubleshooting
    6. Summary
  6. Chapter 6:​ Setting Up a Print and Scan Server
    1. Hardware Used in This Chapter
    2. Connecting via USB
    3. Selecting a Distro
    4. Manual Connections to a Wireless Network
    5. Installing and Using CUPS
      1. Adding Users to the Print Administration Group
      2. Configuring CUPS for Remote Administration
      3. Logging into CUPS Remotely
      4. Selecting and Configuring a Printer with CUPS
      5. Installing Printer Drivers
    6. Installing and Configuring Samba
      1. Connecting to a Samba Print Server with Windows
      2. Connecting to a Samba Print Server with MacOS (OSX)
    7. Installing and Configuring SANE
    8. Configuring SANE as a Server
      1. Connecting to SANE from Windows
      2. Connecting to SANE from MacOS (OSX)
    9. Headless Boot
      1. Connecting via SSH Using Windows
    10. Troubleshooting
    11. Summary
  7. Chapter 7:​ Imaging and Video
    1. Hardware Used in This Chapter
    2. Connecting a Camera to the Camera Port
      1. Swapping Cables for a Raspberry Pi Zero
      2. Enabling the Camera Port
    3. Using Raspivid to Capture Video
      1. Raspivid Options and Examples
      2. Playing Videos with OMXplayer
      3. Converting Recordings with MP4Box
    4. Using Raspistill to Take Photos
      1. Taking Time-Lapse Photos with Raspistill
      2. Viewing Raspistill Photo Metadata
    5. Controlling the Raspberry Pi Camera with Python
    6. Controlling Your Raspberry Pi Camera with Android or iOS
      1. Using RaspiCAM Remote for Android
      2. Using BerryCam for iOS
    7. Using a Webcam with a Raspberry Pi
      1. Using Fswebcam
      2. Capturing Video or Stills Using Guvcview
      3. Using RaspiCAM Remote with a Webcam
    8. Connecting to an Image Scanner
      1. Installing SANE with PIXEL, Other Linux GUIs
      2. Using Simple Scan
      3. Using Xscan
    9. Troubleshooting
      1. Raspberry Pi Camera Issues
      2. Camera App Issues
      3. Network Issues
      4. Webcam Issues
      5. Scanner Issues
    10. Summary
  8. Chapter 8:​ Media Serving
    1. Hardware Used in This Chapter
    2. Selecting a Distro
    3. BerryBoot, WD PiDrive, and Media Serving
    4. Using LibreELEC
      1. Adding Media Files
    5. Connecting to a PLEX Server with RasPlex
    6. Troubleshooting
      1. Network Settings
      2. Audio Playback
    7. Summary
  9. Chapter 9:​ GPIO Anatomy and Applications
    1. Hardware Used in This Chapter
      1. What Can You Do with GPIO?​
      2. GPIO Pinouts
      3. Raspberry Pi GPIO Pin Numbering Schemes
    2. Programming the GPIO Interface
    3. Using a Gertboard
    4. Using a PiFace Control and Display Board
    5. Using a Breadboard
    6. Troubleshooting
    7. Summary
  10. Chapter 10:​ Taking Your Raspberry Pi on the Road
    1. Power Usage
    2. Configuring the Raspberry Pi for Minimal Power Consumption
      1. Disabling HDMI
      2. Disabling Onboard LEDs
      3. Enabling Login and Control via TTY
      4. Disabling USB Hub and Ethernet
    3. Choosing a Power Source
      1. Estimated Battery Runtimes
    4. Car Chargers and Raspberry Pi
    5. Using Intelligent Power Management Peripherals
      1. MoPi Mobile Power for Raspberry Pi
      2. LiFePO 4 wered/​Pi 3
      3. Sleepy Pi and Sleepy Pi 2
    6. Comparing Power Management Products for Raspberry Pi
    7. Troubleshooting
    8. Summary
  11. Index

About the Author and About the Technical Reviewer

About the Author

Mark Edward Soper is an internationally published expert on technical topics ranging from CompTIA A+ Certification to Microsoft Windows and an instructor who has taught thousands of students in industry seminars and employee training about computer and device troubleshooting and repair, digital imaging, Microsoft Windows, and networking. Mark has seen the industry change from an emphasis on understanding hardware and what makes it work to the computer as appliance. He’s excited to see that devices such as the Raspberry Pi are not only useful for teaching how computers work but also capable of being put to work in home and business environments. Mark thanks God for the opportunity to share technical knowledge around the world and for his family, who use technology at work and play.

About the Technical Reviewer

A440135_1_En_BookFrontmatter_Figb_HTML.jpg

Massimo Nardone has more than 22 years of experience in Security, Web/Mobile development, Cloud, and IT Architecture. His true IT passions are Security and Android.

He has been programming and teaching how to program with Android, Perl, PHP, Java, VB, Python, C/C++, and MySQL for more than 20 years.

He holds a Master of Science degree in Computing Science from the University of Salerno, Italy.

He has worked as a Project Manager, Software Engineer, Research Engineer, Chief Security Architect, Information Security Manager, PCI/SCADA Auditor, and Senior Lead IT Security/Cloud/SCADA Architect for many years.

Technical skills include: Security, Android, Cloud, Java, MySQL, Drupal, Cobol, Perl, Web and Mobile development, MongoDB, D3, Joomla, Couchbase, C/C++, WebGL, Python, Pro Rails, Django CMS, Jekyll, Scratch, etc.

He currently works as Chief Information Security Officer (CISO) for Cargotec Oyj.

He worked as visiting lecturer and supervisor for exercises at the Networking Laboratory of the Helsinki University of Technology (Aalto University). He holds four international patents (PKI, SIP, SAML, and Proxy areas).

Massimo has reviewed more than 40 IT books for different publishing companies, and he is the coauthor of Pro Android Games (Apress, 2015).

This book is dedicated to Antti Jalonen and his family, who are always there when I need them.