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

BeagleBone Essentials

Book Description

Harness the power of the BeagleBone Black to manage external environments using C, Bash, and Python/PHP programming

In Detail

The BeagleBone Black is an embedded system that is able to run complete GNU/Linux distributions such as Debian or Ubuntu. Having powerful distribution capabilities, and packed with an easily expandable embedded board, the BeagleBone Black is a device that will allow users to build powerful and versatile monitoring and controlling systems.

You start off by learning how to set up the board from scratch; you will be introduced to the concepts of compilation and cross-compilation of user-space and kernel-space applications with some basic debugging techniques. Next, you will move on to high-level programming by using scripting languages; you'll then learn how to get access to different kinds of peripherals such as serial ports, USB devices, I2C/SPI, and 1-Wire. Finally, you will discover how to use or develop system daemons in several programming languages, collect peripheral data, and control a device. Accessing all peripherals and writing good monitoring and controlling programs can be a complex task; it's all too easy to make mistakes early in development that lead to serious problems in production. This guide is an invaluable tutorial if you are planning to use a BeagleBone Black to control or monitor projects.

What You Will Learn

  • Set up and install a Debian operating system for your BeagleBone Black
  • Get access to the serial console to manage the BeagleBone Black's bootloader and kernel
  • Discover the pros and cons of native versus cross-compiling C applications
  • Compile the Linux kernel from scratch and add custom device drivers
  • Ascertain how a system daemon works and how high-level languages can interact with it
  • Work with electronic components to build a small circuit
  • Develop applications that interact with your circuits connected with the system's GPIOs, serial/USB ports, and I2C/SPI/1-Wire busses
  • Use RFID LF readers, temperature sensors, barcode readers, ADC/DAC, and other peripherals to monitor and control your surroundings

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. BeagleBone Essentials
    1. Table of Contents
    2. BeagleBone Essentials
    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
        1. Software prerequisites
        2. Hardware prerequisites
      3. Who this book is for
      4. Conventions
        1. Codes and command lines
        2. Kernel and logging messages
        3. File modifications
        4. Other 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. Installing the Developing System
      1. Embedded world terms
      2. A system overview
        1. The first login
      3. Checking out the preloaded tools
        1. The SSH tool
        2. The Apache web server
      4. Setting up a developing system
        1. The LAMP suite
          1. Apache
          2. PHP
          3. MySQL
        2. The compiler
      5. (Re)Installing Debian
        1. The virtual machine
        2. Setting up the host
          1. The serial connection
          2. The Ethernet connection
        3. The developing tools
      6. Summary
    9. 2. Managing the System Console
      1. Getting access to the serial console
      2. Basic system management
        1. File manipulation tools and friends
        2. Package management
        3. Managing the kernel messages
      3. A quick tour of the bootloader
        1. GPIOs management
        2. The environment
        3. Managing the storage devices
        4. The kernel command line
      4. Summary
    10. 3. Compiling versus Cross-compiling
      1. Native compilation versus cross-compilation
      2. Compiling a user-space software package
        1. Native compilation
        2. Cross-compilation
      3. Compiling the kernel
        1. The Linux kernel
        2. Device drivers
      4. Summary
    11. 4. Quick Programming with Scripts
      1. The GPIO subsystem
        1. The GPIOs on the BeagleBone Black
        2. The sysfs API
      2. Managing an LED in PHP
        1. The LAMP solution
        2. The built-in server solution
      3. Managing an LED in Python
      4. Managing an LED in Bash
      5. Summary
    12. 5. Device Drivers
      1. What is a device driver?
        1. Char, block, and net devices
      2. The modutils
      3. Writing our own device driver
      4. Summary
    13. 6. Serial Ports and TTY Devices
      1. What is a serial port?
        1. The electrical lines
      2. Implementation of serial ports
      3. The serial ports in Linux
      4. The communication parameters
      5. A simple serial echo
      6. Managing a real device
      7. Summary
    14. 7. Universal Serial Bus – USB
      1. What is the Universal Serial Bus?
      2. The electrical lines
      3. The USB bus in Linux
        1. Acting as a host
        2. Acting as a device
      4. Accessing the raw bus
      5. Summary
    15. 8. Inter-integrated Circuit – I2C
      1. What is the I2C bus?
      2. The electrical lines
      3. The I2C bus in Linux
      4. Getting access to I2C devices
        1. The EEPROM
        2. The ADC chip
      5. Accessing the bus directly
      6. Summary
    16. 9. Serial Peripheral Interface – SPI
      1. What is the SPI bus?
      2. The electrical lines
        1. The SPI bus in Linux
      3. Getting access to the SPI devices
      4. Accessing the raw bus
      5. Summary
    17. 10. 1-Wire Bus – W1
      1. What is the 1-Wire bus?
      2. The electrical lines
      3. The 1-Wire bus in Linux
      4. Getting access to 1-Wire devices
      5. Summary
    18. 11. Useful System Daemons
      1. What is a daemon?
      2. Useful and ready-to-use daemons
        1. Syslogd
          1. Using in Bash
          2. Using in C
          3. Using in PHP
          4. Using in Python
        2. Cron
        3. MySQL
          1. Getting access in Bash
          2. Getting access in C
          3. Getting access in PHP
          4. Getting access in Python
      3. Writing a custom daemon
        1. Using C
        2. Using PHP
        3. Using Python
        4. Using Bash
      4. Summary
    19. Index