BeagleBone Cookbook

Book description

BeagleBone is an inexpensive web server, Linux desktop, and electronics hub that includes all the tools you need to create your own projects—whether it’s robotics, gaming, drones, or software-defined radio. If you’re new to BeagleBone Black, or want to explore more of its capabilities, this cookbook provides scores of recipes for connecting and talking to the physical world with this credit-card-sized computer.

All you need is minimal familiarity with computer programming and electronics. Each recipe includes clear and simple wiring diagrams and example code to get you started. If you don’t know what BeagleBone Black is, you might decide to get one after scanning these recipes.

  • Learn how to use BeagleBone to interact with the physical world
  • Connect force, light, and distance sensors
  • Spin servo motors, stepper motors, and DC motors
  • Flash single LEDs, strings of LEDs, and matrices of LEDs
  • Manage real-time input/output (I/O)
  • Work at the Linux I/O level with shell commands, Python, and C
  • Compile and install Linux kernels
  • Work at a high level with JavaScript and the BoneScript library
  • Expand BeagleBone’s functionality by adding capes
  • Explore the Internet of Things

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Who This Book Is For
    2. How to Use This Book
    3. Conventions Used in This Book
    4. Using Code Examples
    5. About the Diagrams
    6. Safari® Books Online
    7. How to Contact Us
    8. Acknowledgments
  2. Basics
    1. 1.0. Introduction
    2. 1.1. Picking Your Beagle
    3. 1.2. Getting Started, Out of the Box
    4. 1.3. Verifying You Have the Latest Version of the OS on Your Bone
    5. 1.4. Running the BoneScript API Tutorials
    6. 1.5. Wiring a Breadboard
    7. 1.6. Editing Code Using the Cloud9 IDE
    8. 1.7. Running JavaScript Applications from the Cloud9 IDE
    9. 1.8. Running Applications Automatically
    10. 1.9. Finding the Latest Version of the OS for Your Bone
    11. 1.10. Running the Latest Version of the OS on Your Bone
    12. 1.11. Updating the OS on Your Bone
    13. 1.12. Backing Up the Onboard Flash
    14. 1.13. Updating the Onboard Flash
  3. Sensors
    1. 2.0. Introduction
    2. 2.1. Choosing a Method to Connect Your Sensor
    3. 2.2. Input and Run a JavaScript Application for Talking to Sensors
    4. 2.3. Reading the Status of a Pushbutton or Magnetic Switch (Passive On/Off Sensor)
    5. 2.4. Reading a Position, Light, or Force Sensor (Variable Resistance Sensor)
    6. 2.5. Reading a Distance Sensor (Analog or Variable Voltage Sensor)
    7. 2.6. Reading a Distance Sensor (Variable Pulse Width Sensor)
    8. 2.7. Accurately Reading the Position of a Motor or Dial
    9. 2.8. Acquiring Data by Using a Smart Sensor over a Serial Connection
    10. 2.9. Measuring a Temperature
    11. 2.10. Reading Temperature via a Dallas 1-Wire Device
    12. 2.11. Sensing All Sorts of Things with SensorTag via Bluetooth v4.0
    13. 2.12. Playing and Recording Audio
  4. Displays and Other Outputs
    1. 3.0. Introduction
    2. 3.1. Toggling an Onboard LED
    3. 3.2. Toggling an External LED
    4. 3.3. Toggling a High-Voltage External Device
    5. 3.4. Fading an External LED
    6. 3.5. Writing to an LED Matrix
    7. 3.6. Driving a 5 V Device
    8. 3.7. Writing to a NeoPixel LED String
    9. 3.8. Using a Nokia 5510 LCD Display
    10. 3.9. Making Your Bone Speak
  5. Motors
    1. 4.0. Introduction
    2. 4.1. Controlling a Servo Motor
    3. 4.2. Controlling the Speed of a DC Motor
    4. 4.3. Controlling the Speed and Direction of a DC Motor
    5. 4.4. Driving a Bipolar Stepper Motor
    6. 4.5. Driving a Unipolar Stepper Motor
  6. Beyond the Basics
    1. 5.0. Introduction
    2. 5.1. Running Your Bone Standalone
    3. 5.2. Selecting an OS for Your Development Host Computer
    4. 5.3. Getting to the Command Shell via SSH
    5. 5.4. Getting to the Command Shell via the Virtual Serial Port
    6. 5.5. Viewing and Debugging the Kernel and u-boot Messages at Boot Time
    7. 5.6. Verifying You Have the Latest Version of the OS on Your Bone from the Shell
    8. 5.7. Controlling the Bone Remotely with VNC
    9. 5.8. Learning Typical GNU/Linux Commands
    10. 5.9. Editing a Text File from the GNU/Linux Command Shell
    11. 5.10. Using a Graphical Editor
    12. 5.11. Establishing an Ethernet-Based Internet Connection
    13. 5.12. Establishing a WiFi-Based Internet Connection
    14. 5.13. Sharing the Host’s Internet Connection over USB
    15. 5.14. Setting Up a Firewall
    16. 5.15. Installing Additional Packages from the Debian Package Feed
    17. 5.16. Removing Packages Installed with apt-get
    18. 5.17. Copying Files Between the Onboard Flash and the MicroSD Card
    19. 5.18. Freeing Space on the Onboard Flash or MicroSD Card
    20. 5.19. Installing Additional Node.js Packages
    21. 5.20. Using Python to Interact with the Physical World
    22. 5.21. Using C to Interact with the Physical World
  7. Internet of Things
    1. 6.0. Introduction
    2. 6.1. Accessing Your Host Computer’s Files on the Bone
    3. 6.2. Serving Web Pages from the Bone
    4. 6.3. Interacting with the Bone via a Web Browser
    5. 6.4. Displaying GPIO Status in a Web Browser
    6. 6.5. Continuously Displaying the GPIO Value via jsfiddle
    7. 6.6. Continuously Displaying the GPIO Value
    8. 6.7. Plotting Data
    9. 6.8. Sending an Email
    10. 6.9. Sending an SMS Message
    11. 6.10. Displaying the Current Weather Conditions
    12. 6.11. Sending and Receiving Tweets
    13. 6.12. Wiring the IoT with Node-RED
    14. 6.13. Serving Web Pages from the Bone by Using Apache
    15. 6.14. Communicating over a Serial Connection to an Arduino or LaunchPad
  8. The Kernel
    1. 7.0. Introduction
    2. 7.1. Updating the Kernel
    3. 7.2. Building and Installing Kernel Modules
    4. 7.3. Controlling LEDs by Using SYSFS Entries
    5. 7.4. Controlling GPIOs by Using SYSFS Entries
    6. 7.5. Compiling the Kernel
    7. 7.6. Using the Installed Cross Compiler
    8. 7.7. Applying Patches
    9. 7.8. Creating Your Own Patch File
  9. Real-Time I/O
    1. 8.0. Introduction
    2. 8.1. I/O with BoneScript
    3. 8.2. I/O with C and libsoc
    4. 8.3. I/O with devmem2
    5. 8.4. I/O with C and mmap()
    6. 8.5. Modifying the Linux Kernel to Use Xenomai
    7. 8.6. I/O with PRU Speak
  10. Capes
    1. 9.0. Introduction
    2. 9.1. Using a Seven-Inch LCD Cape
    3. 9.2. Using a 128 x 128-Pixel LCD Cape
    4. 9.3. Connecting Multiple Capes
    5. 9.4. Moving from a Breadboard to a Protoboard
    6. 9.5. Creating a Prototype Schematic
    7. 9.6. Verifying Your Cape Design
    8. 9.7. Laying Out Your Cape PCB
    9. 9.8. Migrating a Fritzing Schematic to Another Tool
    10. 9.9. Producing a Prototype
    11. 9.10. Creating Contents for Your Cape Configuration EEPROM
    12. 9.11. Putting Your Cape Design into Production
  11. Parts and Suppliers
    1. Parts
    2. Prototyping Equipment
    3. Resistors
    4. Transistors and Diodes
    5. Integrated Circuits
    6. Opto-Electronics
    7. Capes
    8. Miscellaneous
  12. Index

Product information

  • Title: BeagleBone Cookbook
  • Author(s): Mark A. Yoder, Jason Kridner
  • Release date: April 2015
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491915677