You are previewing BeagleBone Black Cookbook.
O'Reilly logo
BeagleBone Black Cookbook

Book Description

Over 70 recipes and solutions for inventors, makers, and budding engineers to create projects using the BeagleBone Black

About This Book

  • Learn how to develop applications with the BeagleBone Black and open source Linux software

  • Sharpen your expertise in making sophisticated electronic devices

  • Explore the BeagleBone Black with this easy-to-succeed recipe format

  • Who This Book Is For

    If you are a hardware, Linux, and/or microcomputing novice, or someone who wants more power and possibilities with product prototypes, electronic art projects, or embedded computing experiments, then this book is for you. It is for Internet of Things enthusiasts who want to use more sophisticated hardware than the Raspberry Pi or the Arduino can provide.

    Whether you are an engineering student, a DIYer, an inventor, or an advanced electronics enthusiast, this book delivers accessible, compelling instructions for using an advanced microcomputing platform.

    What You Will Learn

  • Set up and run the BeagleBone Black for the first time

  • Learn the basics of microcomputing and Linux using the command line and easy kernel mods

  • Make introductory projects with Python, JavaScript, BoneScript, and Node.js

  • Explore physical computing and simple circuits using buttons, LEDs, sensors, and motors

  • Discover the unique features of the BeagleBone Black and its real-time computing functions

  • Build intermediate level audio and video applications

  • Assemble draft prototypes for wearable and Internet of Things devices

  • In Detail

    With dozens of how-tos, this book kicks off with the basic steps for setting up and running the BeagleBone Black for the first time, from connecting the necessary hardware and using the command line with Linux commands to installing new software and controlling your system remotely. Following these recipes, more advanced examples take you through scripting, debugging, and working with software source files, eventually working with the Linux kernel. Subsequently, you will learn how to exploit the board's real-time functions. We will then discover exciting methods for using sound and video with the system before marching forward into an exploration of recipes for building Internet of Things projects. Finally, the book finishes with a dramatic arc upward into outer space, when you explore ways to set up test recipes for building a project on board a small satellite's payload.

    Style and approach

    This comprehensive recipe book deconstructs a complex, often confusing piece of technology, and transforms it to become accessible and fun with snappy, unintimidating prose, and extensive easy-to-succeed instructions.

    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 code file.

    Table of Contents

    1. BeagleBone Black Cookbook
      1. Table of Contents
      2. BeagleBone Black Cookbook
      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
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Setting Up for the First Time
        1. Introduction
        2. First boot up
          1. Getting ready
          2. How to do it…
          3. Getting ready
          4. How to do it...
        3. Power requirements – basic guidelines
        4. Display
          1. Connecting an HDMI LCD
          2. How to do it...
          3. Connecting a non-HDMI LCD or cape
          4. How to do it...
          5. There's more…
        5. Essential GNU/Linux commands – the command shell
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Essential GNU/Linux commands – typical commands
          1. Getting ready
          2. System navigational command – change your directory – cd
          3. How to do it…
          4. There's more…
          5. System navigational command – show your current directory – pwd
          6. How to do it…
          7. System navigational command – find a file – find
          8. How to do it…
          9. Device and system insight – shows what's inside a directory – ls
          10. How to do it…
          11. Device and system insight – find out what USB devices are connected – lsusb
          12. How to do it…
          13. Device and system insight – get information about connected devices – cat/proc/bus/input/devices
          14. How to do it…
          15. There's more…
          16. Device and system insight – get your version of Linux
          17. How to do it…
          18. Device and system insight – find out running processes – ps
          19. How to do it…
          20. Device and system insight – find out the resources used by running processes – top and htop
          21. How to do it…
          22. Device and system insight – quitting processes – kill
          23. How to do it…
          24. Device and system insight – message reports – dmesg
          25. How to do it…
          26. Device and system insight – shows disk space – df -h
          27. How to do it…
          28. Device and system insight – explore network – Ifconfig
          29. How to do it…
          30. Modify content / data commands – make a new directory – mkdir
          31. How to do it…
          32. Modify content/data commands – remove a file or directory – rm
          33. How to do it…
          34. Modify content / data commands – download files – wget
          35. How to do it…
          36. There's more…
          37. Modify content / data commands – open a tar file – tar [options]
          38. How to do it…
          39. There's more…
          40. Modify content / data commands – clean up files – autoclean
          41. How to do it…
          42. Modify content / data commands – purge a package – apt-get purge, apt-get remove --purge
          43. How to do it…
          44. Modify content/data commands – shutdown the system – [options]
          45. How to do it…
          46. See also
        7. Edit a text file from the command shell
          1. How it works...
          2. How to do it...
          3. See also
        8. Connectivity
          1. Connectivity – Ethernet
          2. Getting ready
          3. How to do it...
          4. Connectivity – Wi-Fi
          5. Getting ready
          6. How to do it...
          7. There's more…
          8. See also
        9. Package management – Installing packages using apt-get
          1. Getting ready
          2. How to do it…
          3. See also
        10. SSH / Remote access
          1. Using SSH to control your BBB
          2. How to do it…
          3. Using VNC to control your BBB
          4. Getting ready…
          5. How to do it...
          6. There's more...
        11. System images
          1. OS image flashing – internal drive boot
          2. Getting ready
          3. How to do it...
          4. There's more…
            1. Expand your partition
            2. Backing up a code image to a file
          5. OS image flashing – the SD card boot
          6. Getting ready
          7. How to do it...
          8. Updating your current OS kernel
          9. See also
      9. 2. Basic Programming Recipes
        1. Introduction
        2. Introduction to BoneScript
        3. Toggle LED
          1. How to do it...
          2. See also
        4. Using the Cloud9 IDE
          1. How to do it…
          2. See also
        5. Node.js basic recipes
        6. Adding a new module to Node.js
          1. Getting ready
          2. How to do it...
          3. There's more…
          4. See also
        7. Using Node.js with Johnny-Five
          1. How to do it…
          2. There's more…
        8. Python basic recipes
          1. Getting ready
        9. Adding libraries
          1. How to do it…
        10. Running a Python script to control the LEDs
          1. How to do it…
          2. There's more…
      10. 3. Physical Computing Recipes Using JavaScript, the BoneScript Library, and Python
        1. Introduction
          1. The essentials of electronics
          2. Header pins and pinmuxing
            1. The process of pinmuxing
          3. There's more…
        2. Controlling external LEDs
          1. Getting ready
          2. How to do it...
            1. Writing an alternative script with Python
          3. There's more…
        3. Using buttons – button press function
          1. Pull-up, pull-down, and floating
          2. Getting ready
          3. How to do it...
          4. There's more…
        4. Using analog sensors
          1. Temperature sensors
          2. Getting ready
          3. How to do it...
          4. There's more…
          5. See also
        5. Variable resistance sensor – photocell
          1. Getting ready
          2. How to do it…
        6. Using motors
          1. DC motors
          2. Getting ready
          3. How to do it...
          4. How it works...

          5. Servo motors
          6. A crash course in pulse width modulation
          7. Getting ready
          8. How to do it...
          9. There's more…
      11. 4. Exploring GNU/Linux Recipes Using Bash, Autotools, Debugger, and systemd
        1. Introduction
        2. The basic shell script
          1. How to do it...
        3. Epoch Time shell script
          1. How to do it...
          2. There's more...
        4. Compile and install
          1. See also
        5. Compile and install Git from source
          1. How to do it...
        6. Debugging
          1. See also
        7. Debug a simple C-code application from the command line using GDB
          1. How to do it...
          2. See also
        8. Debug an application remotely from Eclipse and GDB server
          1. How to do it...
          2. There's more…
        9. systemd services
          1. There's more…
          2. See also
        10. Basic commands for systemd services
          1. How to do it...
          2. There's more…
        11. Optimize boot time
          1. How to do it...
        12. Create a systemd service to run at boot time
          1. How to do it...
      12. 5. Basic Programming Recipes with the Linux Kernel
        1. Introduction
          1. Kernel building basics
          2. See also
        2. Kernel application binary interface
          1. Getting ready
          2. How to do it...
          3. How it works…
        3. Installing the latest kernel image
          1. Getting ready
          2. How to do it...
        4. Installing and building a custom kernel
          1. Getting ready
          2. How to do it...
        5. Interactions with the kernel – sysfs entries and controlling the GPIOs
          1. Getting ready
          2. How to do it...
          3. There's more…
        6. Device Tree and its roots
          1. There's more…
        7. Device Tree / basic build
          1. Getting ready
          2. How to do it...
        8. Device Tree / advanced – adding DT overlay to run a custom cape
          1. Getting ready
          2. How to do it...
          3. There's more…
          4. See also
        9. Universal cape overlay
          1. Getting ready
          2. How to do it…
          3. There's more…
        10. Running a script to check DT usage on GPIO pins
          1. Getting ready
          2. How to do it…
      13. 6. Run Faster, Run Real Time
        1. Introduction
        2. Installing a test tool
          1. Getting ready
          2. How to do it...
          3. See also
        3. Modifying the kernel using RT-PREEMPT
          1. Getting ready
          2. How to do it…
          3. There's more…
        4. Modifying the kernel using Xenomai
          1. Getting ready
          2. How to do it...
          3. There's more…
          4. See also
        5. Programmable real-time units – an introduction
          1. Getting ready
          2. How to do it…
        6. A simple PRU test with an assembler
          1. Getting ready
          2. How to do it…
          3. See also
        7. Running an ultrasonic range sensor with the PRUs
          1. Getting ready
          2. How to do it…
        8. Using Python with the PRUs
          1. Getting ready
          2. How to do it…
          3. See also
      14. 7. Applied Recipes – Sound, Picture, and Video
        1. Introduction
        2. Wiring up a mini amp and speakers
          1. Getting ready
          2. How to do it…
        3. Creating a high-quality audio platform with Volumio
          1. Getting ready
          2. How to do it…
          3. There's more…
          4. See also
        4. Using videos and displays in projects
          1. Getting ready
          2. How to do it…
          3. There's more…
        5. Testing a mini LCD cape
          1. Getting ready
          2. How to do it…
        6. Making a video chat client prototype using Linphone
          1. Getting ready
          2. How to do it…
            1. Part I – compiling and installing a Linphone binary from the repository
            2. Part II – compiling and installing Linphone from source
          3. Getting ready
          4. How to do it…
      15. 8. The Internet of Things
        1. Introduction
        2. Location-based recipes – hooking up GPS
          1. Getting ready
          2. How to do it…
          3. There's more...
        3. Location-based recipes – Bluetooth LE and Beacons
          1. Getting ready
          2. How to do it…
          3. There's more...
        4. Using sensors and data with ThingSpeak
          1. Getting ready
          2. How to do it…
          3. See also
        5. Making things smarter – building a wireless digital picture frame
          1. Getting ready
          2. How to do it...
          3. See also
      16. 9. The Black in Outer Space
        1. Introduction
        2. Grabbing the International Space Station flyover data and visualizing it
          1. Getting ready
          2. How to do it…
          3. There's more…
        3. Tracking using RTL-SDR
          1. See also
        4. Airplane tracking with RTL-SDR
          1. Getting ready
          2. How to do it…
          3. There's more…
        5. Satellite tracking using GPredict and RTL-SDR
          1. Getting ready
          2. How to do it…
          3. There's more…
        6. Satellite tracking using the SatNogs Network client / ground station and RTL-SDR
          1. Getting ready
          2. How to do it…
        7. Adding other interfaces – ISS tracking and text to speech
          1. Getting ready
          2. How to do it…
          3. There's more…
      17. Index