You are previewing BeagleBone Cookbook.
O'Reilly logo
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.

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. 1. Basics
    1. Introduction
    2. Picking Your Beagle
    3. Getting Started, Out of the Box
    4. Verifying You Have the Latest Version of the OS on Your Bone
    5. Running the BoneScript API Tutorials
    6. Wiring a Breadboard
    7. Editing Code Using the Cloud9 IDE
    8. Running JavaScript Applications from the Cloud9 IDE
    9. Running Applications Automatically
    10. Finding the Latest Version of the OS for Your Bone
    11. Running the Latest Version of the OS on Your Bone
    12. Updating the OS on Your Bone
    13. Backing Up the Onboard Flash
    14. Updating the Onboard Flash
  3. 2. Sensors
    1. Introduction
    2. Choosing a Method to Connect Your Sensor
    3. Input and Run a JavaScript Application for Talking to Sensors
    4. Reading the Status of a Pushbutton or Magnetic Switch (Passive On/Off Sensor)
    5. Reading a Position, Light, or Force Sensor (Variable Resistance Sensor)
    6. Reading a Distance Sensor (Analog or Variable Voltage Sensor)
    7. Reading a Distance Sensor (Variable Pulse Width Sensor)
    8. Accurately Reading the Position of a Motor or Dial
    9. Acquiring Data Using a Smart Sensor Over a Serial Connection
    10. Measuring a Temperature
    11. Reading Temperature via a Dallas 1-Wire Device
    12. Sensing All Sorts of Things with SensorTag via Bluetooth v4.0
    13. Playing and Recording Audio
  4. 3. Displays and Other Outputs
    1. Introduction
    2. Toggling an On-Board LED
    3. Toggling an External LED
    4. Toggling a High-Voltage External Device
    5. Fading an External LED
    6. Writing to an LED Matrix
    7. Driving a 5V Device
    8. Writing to a NeoPixel LED String
    9. Using a Nokia 5510 LCD Display
    10. Making Your Bone Speak
  5. 4. Motors
    1. Introduction
    2. Controlling a Servo Motor
    3. Controlling the Speed of a DC Motor
    4. Controlling the Speed and Direction of a DC Motor
    5. Driving a Bipolar Stepper Motor
    6. Driving a Unipolar Stepper Motor
  6. 5. Beyond the Basics
    1. Introduction
    2. Running Your Bone Standalone
    3. Selecting an OS for Your Development Host Computer
    4. Getting to the Command Shell via ssh
    5. Getting to the Command Shell via the Virtual Serial Port
    6. Viewing and Debugging the Kernel and u-boot Messages at Boot Time
    7. Verifying You Have the Latest Version of the OS on Your Bone From the Shell
    8. Controlling the Bone Remotely with VNC
    9. Learning Typical GNU/Linux Commands
    10. Editing a Text File from the GNU/Linux Command Shell
    11. Using a Graphical Editor
    12. Establishing an Ethernet-Based Internet Connection
    13. Establishing a WiFi-Based Internet Connection
    14. Sharing the Host’s Internet Connection Over USB
    15. Setting Up a Firewall
    16. Installing Additional Packages from the Debian Package Feed
    17. Removing Packages Installed with apt-get
    18. Copying Files Between the Onboard Flash and the MicroSD Card
    19. Freeing Space on the Onboard Flash or MicroSD Card
    20. Installing Additional Node.js Packages
    21. Using Python to Interact with the Physical World
    22. Using C to Interact with the Physical World
  7. 6. Internet of Things
    1. Introduction
    2. Accessing Your Host Computer’s Files on the Bone
    3. Serving Web Pages from the Bone
    4. Interacting with the Bone via a Web Browser
    5. Displaying GPIO Status in Web Browser
    6. Continuously Displaying the GPIO Value via jsfiddle
    7. Continuously Displaying the GPIO Value
    8. Plotting Data
    9. Sending an Email
    10. Sending an SMS Message
    11. Displaying the Current Weather Conditions
    12. Sending and Receiving Tweets
    13. Wiring the Internet of Things with Node-RED
    14. Serving Web Pages From the Bone Using Apache
    15. Communicating Over a Serial Connection to an Arduino or Launchpad
  8. 7. The Kernel
    1. Introduction
    2. Updating the Kernel
    3. Building and Installing Kernel Modules
    4. Controlling LEDs Using SYSFS Entries
    5. Controlling GPIOs Using SYSFS Entries
    6. Compiling the Kernel
    7. Using the Installed Cross Compiler
    8. Applying Patches
    9. Creating Your Own Patch File
  9. 8. Real-Time I/O
    1. Introduction
    2. I/O with BoneScript
    3. I/O with C and libsoc
    4. I/O with devmem2
    5. I/O with C and mmap()
    6. Modifying the Linux Kernel to Use Xenomai
    7. I/O with PRU Speak
  10. 9. Capes
    1. Introduction
    2. Using a Seven-Inch LCD Cape
    3. Using a 128-by-128-Pixel LCD Cape
    4. Connecting Multiple Capes
    5. Moving From a Breadboard to a Protoboard
    6. Creating a Prototype Schematic
    7. Verifying Your Cape Design
    8. Laying Out Your Cape PCB
    9. Migrating a Fritzing Schematic to Another Tool
    10. Producing a Prototype
    11. Creating Contents for Your Cape Configuration EEPROM
    12. Putting Your Cape Design Into Production
  11. A. 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. About the Authors
  13. Copyright