Cover image for Raspberry Pi Hacks

Book 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.

Table of Contents

  1. Dedication
  2. Foreword
  3. Preface
    1. Who This Book Is For
    2. How to Use This Book
    3. Hardware Requirements
    4. Conventions Used in This Book
    5. Using Code Examples
    6. Safari® Books Online
    7. How to Contact Us
    8. Acknowledgments
    9. Contributors
  4. 1. Configuration Hacks
    1. . Choose and Format the Right SD Card
    2. . Mount the SD Card
    3. . Decode the LEDs
    4. . Update the Firmware
    5. . Monitor the Raspberry Pi Hardware
      1. Measure Component Voltage
      2. Measure Temperature
      3. Monitor Memory Split
      4. Check Custom Configuration Overrides
    6. . Overclock Your Pi
      1. Increase ARM CPU Frequency
      2. Increase SDRAM Frequency
      3. Increase GPU Frequency
      4. Pretested Overclock Presets
    7. . Overvolt for Higher Performance
    8. . Get More USB Ports
    9. . Troubleshoot Power Problems
      1. Think Twice Before Using the GPIO to Power the Pi
      2. Do Not Backpower the Pi over USB
      3. Get Power Through GPIO Safely
      4. Solve Power Problems
        1. Get a better power supply
        2. Get a better micro USB cable
      5. Test Your Cable’s Resistance
    10. . Unbreak Your Raspberry Pi
      1. Test Your Power Supply
      2. Replace the C6 Capacitor
    11. . Go Headless
    12. . Connect with SSH
    13. . Give Your Pi a Static IP Address
    14. . Learn to Speak GPIO
      1. Pin-Number Labeling
      2. BCM Labeling
      3. Label Your Own GPIO Pins
    15. . Connect GPIO Pins to a Breadboard
      1. GPIO Quick Reference
        1. Inter-Integrated Circuit (I2C)
        2. Pulse-Width Modulation (PWM)
        3. Universal Asynchronous Receiver/Transmitter (UART)
        4. Serial Peripheral Interface Bus (SPI)
    16. . Add a USB Serial Console
      1. Minicom
      2. Screen
      3. Using the Serial Device as a Login Console
      4. Weird Noise (or Missing Signal) on the Serial Connection?
    17. . Add a Reset Button
    18. . Get Power to the Pi on the Move
    19. . Test Your Might (in Volts)
    20. . Add Additional Memory with Swap
  5. 2. Hacking Linux for the Raspberry Pi
    1. . Build a Cross-Compiler Toolchain
      1. Install crosstool-ng
      2. Configure crosstool-ng
      3. Add crosstool-ng to Your PATH
      4. Configure the Cross-Compiler
        1. Paths and Misc Options
        2. Target Options
        3. Toolchain Options
        4. Operating System Options
        5. Binary Utilities Options
        6. C Compiler Options
        7. C-library Options
      5. Begin the Build
    2. . Build a Custom Kernel
      1. Download the Kernel Source Tree
      2. Configure the Linux Kernel
      3. Build the Kernel Image
      4. Install a New Kernel
      5. Post-Installation Tasks
    3. . Update to the Latest Prebuilt Kernel
      1. Get the Prebuilt Linux Kernel
      2. Install the Prebuilt Kernel Modules
    4. . Split Memory Between the GPU and Linux Userspace
      1. Allocate Memory with config.txt
      2. Automatically Share Memory
    5. . Update the Firmware and Prebuilt Binary Kernel the Easy Way
    6. . Emulate the Pi
    7. . Try Occidentalis: The Raspberry Pi Distro for (Advanced) Education
    8. . Monitor the Pi’s IP Address
      1. Build the LCD Pi Plate
      2. Install Software to Control the LCD Pi Plate
      3. Run the Code
    9. . Run Android on the Raspberry Pi
  6. 3. Raspberry Pi Around the House
    1. . Share Files with Samba
    2. . Use Your Raspberry Pi as a Remote Print Server
    3. . Make Calls with a Raspberry Pi Asterisk Telephone System
      1. Installing Asterisk
      2. Starting Asterisk
      3. Setting Up a Softphone
        1. Configure an SIP account
        2. Register your SIP client
        3. Set up an extension in the dialplan
    4. . Build Your Own Web Server
      1. Set Up a Basic Blog Server
      2. Use Coder for Your Website
    5. . Control a LEGO Robot
      1. Installing ROS and Dependencies
      2. Testing the ROS Connection to the NXT Brick
      3. Just Python, Please
    6. . (Appear to) Survive a Gaping Chest Wound
      1. Build the Costume
      2. Add the Battle Wound
      3. A Simple Script
      4. Finish the Costume
      5. Put It All Together
    7. . Look for Aliens
      1. Setting Up BOINC
      2. BOINC Account Managers
        1. BOINC Account Manager (BAM!)
        2. GridRepublic
        3. AndroBOINC
  7. 4. Hacking the Outdoors
    1. . Tell the Temperature Outside (Without Going Out There)
    2. . Check on Your Plants
    3. . Make Your Pi Water-Resistant (with a Case)
    4. . Make Your Pi Water-Resistant (Without a Case)
    5. . Find Geocaches from Your Car
      1. Gathering Hardware
        1. GPS receiver
        2. LCD screen
        3. Power cord
        4. Serial console
        5. Indicator LED
        6. Project box
      2. Preparing the Software Image
      3. Wiring the Cacheberry Pi
      4. Loading Cache Data
    6. . See the Light
      1. Accessing the Sensor via Python
      2. Accessing the Sensor Directly from the Kernel
    7. . Listen to Aircraft Transponders
      1. Set Up the Code
      2. Run the Script
    8. . Control Aerial Photography
      1. Build the Payload
      2. Gather Gas, Balloon, and Parachute
      3. Install Software
      4. Track the Payload
      5. Prepare for Launch
      6. Mission Success
    9. . Have the Best Holiday Lights Display
      1. Connect the Hardware
      2. Install the Software
  8. 5. Multimedia Hacks
    1. . Play Video Files
    2. . Enable Additional Video Codecs
    3. . Build a Pi MusicBox
      1. Getting and Configuring the Software
      2. Playing Music
        1. Multi-room audio
        2. Music Player Daemon (MPD)
        3. Networked music
        4. Local music
      3. Sound Configuration
      4. Security
      5. Getting Your Hands Dirty
        1. Mopidy
        2. rc.local
        3. Working at Midnight
        4. Static network
      6. Updating
    4. . Turn Your Pi into a Radio
      1. How It Works
      2. Accessing Hardware
      3. Fun with FM
    5. . Control the Pi via Touchscreen
      1. Choosing a Touchscreen
      2. Installing and Enabling Drivers
      3. Xorg Configuration
      4. Using the Touchscreen
    6. . Emulate Classic Video Game Consoles
    7. . Connect a DSLR
      1. Geting Started with gPhoto
      2. Basic Capture Commands and Variables
      3. Finding More About Your Camera
    8. . Set Up a Photobooth
    9. . Turn Your Pi into a Tiny Media Center
      1. Decode MPEG-2 and VC-1
      2. Add a Remote Control
      3. Shortcut for Cord Cutters
      4. Add Some Content
    10. . Watch Movies in the Backseat of Your Car
      1. Your Reliant (in Terms of Power) Automobile
      2. Storage for Your Movies
      3. Touchscreen
      4. Powered USB Hub
      5. Software
      6. Enabling Touchscreen Support
      7. Adding Videos
      8. Putting It All Together
  9. 6. Extend Your Pi
    1. . Control GPIO from a Web Browser
    2. . Add a Tiny Screen
    3. . Connect Arduino Shields to Your Raspberry Pi
      1. Using the arduPi Library
        1. Enable the UART port
        2. Compile the arduPi library and a program using it
        3. Run your program
      2. GPIO input
      3. Analog-to-Digital Conversion
      4. UART
      5. I2C
      6. SPI
    4. . Control a 3D Printer
    5. . Add a Numeric Keypad
      1. How the Matrix Keypad Works
      2. Connecting the Keypad to the Raspberry Pi
      3. Installing the Software
      4. Running the Program
    6. . Add a Heat Sink
    7. . Enable the Raspberry Pi Camera on Pidora
    8. . Build a Solar-Powered Lab
      1. Gather Hardware
      2. Set Up the Raspberry Pi
    9. . Build a MIDI Controller (on the Cheap!)
      1. Hardware
      2. Software
      3. Ergonomics
    10. . Build a Raspberry Pi Supercomputer
      1. Build MPI to Run Code on Multiple Nodes
      2. Flash Me… Once
      3. Use SSH Instead of Password Login Between the Pis
      4. Build More Nodes
      5. Use Python Bindings for MPI
      6. Notes on Making MPI Shared Libraries for Raspberry Pi
  10. Index
  11. Colophon
  12. Copyright