BeagleBone: Creative Projects for Hobbyists

Book description

Learn to build amazing robotic projects using the powerful BeagleBone Black.

About This Book

  • Push your creativity to the limit through complex, diverse, and fascinating projects

  • Develop applications with the BeagleBone Black and open source Linux software

  • Sharpen your expertise in making sophisticated electronic devices

  • Who This Book Is For

    This Learning Path is aimed at hobbyists who want to do creative projects that make their life easier and also push the boundaries of what can be done with the BeagleBone Black. This Learning Path’s projects are for the aspiring maker, casual programmer, and budding engineer or tinkerer. You'll need some programming knowledge, and experience of working with mechanical systems to get the complete experience from this Learning Path.

    What You Will Learn

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

  • Get to know the basics of microcomputing and Linux using the command line and easy kernel mods

  • Develop a simple web interface with a LAMP platform

  • Prepare complex web interfaces in JavaScript and get to know how to stream video data from a webcam

  • Find out how to use a GPS to determine where your sailboat is, and then get the bearing and distance to a new waypoint

  • Use a wind sensor to sail your boat effectively both with and against the wind

  • Build an underwater ROV to explore the underwater world

  • See how to build an autonomous Quadcopter

  • In Detail

    BeagleBone is a microboard PC that runs Linux. It can connect to the Internet and run OSes such as Android and Ubuntu. You can transform this tiny device into a brain for an embedded application or an endless variety of electronic inventions and prototypes.

    This Learning Path starts off by teaching you how to program the BeagleBone. You will create introductory projects to get yourselves acquainted with all the nitty gritty. Then we’ll focus on a series of projects that are aimed at hobbyists like you and encompass the areas of home automation and robotics. With each project, we’ll teach you how to connect several sensors and an actuator to the BeagleBone Black. We’ll also create robots for land, sea, and water. Yes, really!

    The books used in this Learning Path are:

    1. BeagleBone Black Cookbook

    2. BeagleBone Home Automation Blueprints

    3. Mastering BeagleBone Robotics

    Style and approach

    This practical guide transforms complex and confusing pieces of technology to become accessible with easy- to-succeed instructions. Through clear, concise examples, you will quickly get to grips with the core concepts needed to develop home automation applications with the BeagleBone Black.

    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: Creative Projects for Hobbyists
      1. Table of Contents
      2. BeagleBone: Creative Projects for Hobbyists
      3. Credits
      4. Preface
        1. What this learning path covers
        2. What you need for this learning path
        3. Who this learning path is for
          1. Reader feedback
        4. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      5. 1. Module 1
        1. 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
        2. 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…
        3. 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…
        4. 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...
        5. 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…
        6. 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
        7. 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…
        8. 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
        9. 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…
      6. 2. Module 2
        1. 1. Dangerous Gas Sensors
          1. The basic of functioning
          2. Setting up the hardware
            1. Connecting the gas sensors
            2. Connecting the alarm actuators
              1. LED and buzzer
              2. GSM module
            3. The final picture
          3. Setting up the software
            1. Managing the ADCs
            2. Managing the actuators
            3. Controlling the environment
          4. Final test
          5. Summary
        2. 2. Ultrasonic Parking Assistant
          1. The basic of functioning
          2. Setting up the hardware
            1. First setup – all devices near the BeagleBone Black
              1. Using the analog output of the distance sensor
              2. Connecting the LEDs in the first setup
            2. Second setup – the distance sensor is remotized
              1. Using the serial output of the distance sensor
              2. Connecting the LEDs in the second setup
            3. The final picture
          3. Setting up the software
            1. Managing the LEDs
          4. The distance monitor
          5. Final test
          6. Summary
        3. 3. Aquarium Monitor
          1. The basics of functioning
          2. Setting up the hardware
            1. Setting up the 12V devices
            2. Setting up the webcam
            3. Connecting the temperature sensor
            4. Connecting the feeder
            5. The water sensor
            6. The final picture
          3. Setting up the software
            1. Managing the system status and configuration
            2. Building up the web control panel
            3. Handling the control panel
            4. Knowing the internal state-machine
          4. Final test
          5. Summary
        4. 4. Google Docs Weather Station
          1. The basics of functioning
          2. Setting up the hardware
            1. Setting up the temperature/humidity sensor
            2. Setting up the barometric sensor
            3. The final picture
          3. Setting up the software
            1. Installing a new kernel
            2. Running the weather station software
            3. Adding the Google Docs API
          4. Final test
          5. Summary
        5. 5. WhatsApp Laundry Room Monitor
          1. The basics of functioning
          2. Setting up the hardware
            1. Setting up the sound detector
            2. Setting up the light sensor
            3. Connecting the LEDs
            4. The final picture
          3. Setting up the software
            1. The sound detector manager
            2. The light sensor manager
            3. Controlling the LEDs
            4. Setting up the WhatsApp API
            5. The state-machine
          4. Final test
          5. Summary
        6. 6. Baby Room Sentinel
          1. The basics of functioning
          2. Setting up the hardware
            1. Setting up the contactless temperature sensor
            2. Setting up the pressure sensor
            3. Setting up the sound detector
            4. Connecting the tiny LCD
            5. The final picture
          3. Setting up the software
            1. The ADC manager
            2. The LCD manager
          4. Final test
          5. Summary
        7. 7. Facebook Plant Monitor
          1. The basics of functioning
          2. Setting up the hardware
            1. Connecting the moisture sensor
            2. Connecting the light sensor
            3. Setting up the contactless temperature sensor
            4. Setting up the waterproof temperature sensor
            5. Setting up the webcam
            6. Adding a water pump
            7. The final picture
          3. Setting up the software
            1. The Facebook API
              1. Downloading the code
              2. Creating a new Facebook app
              3. Getting access to the Facebook account
            2. The monitoring loop
            3. The web interface
          4. Final test
          5. Summary
        8. 8. Intrusion Detection System
          1. The basics of functioning
          2. Setting up the hardware
            1. Setting up the webcams
            2. The final picture
          3. Setting up the software
            1. Setting up the mailer
            2. Using motion
              1. Downloading the code
              2. Configuring the daemon
            3. The web interface
            4. Managing events
          4. Final test
          5. Summary
        9. 9. Twitter Access Control System with Smart Card and RFID
          1. The basics of functioning
          2. Setting up the hardware
            1. Setting up the smart card reader
            2. Setting up the RFID LF reader
            3. Setting up the RFID UHF reader
            4. The final picture
          3. Setting up the software
            1. Setting up the Twitter utility
            2. The smart card implementation
            3. The RFID LF implementation
            4. The RFID UHF implementation
          4. Final test
          5. Summary
        10. 10. A Lights Manager with a TV Remote Controller
          1. The basics of functioning
          2. Setting up the hardware
            1. Setting up the infrared detector
            2. Setting up the relays array
            3. The final picture
          3. Setting up the software
            1. Setting up the kernel driver
            2. The LIRC tools
            3. The input events manager
          4. The final test
          5. Summary
        11. 11. A Wireless Home Controller with Z-Wave
          1. The basics of functioning
          2. Setting up the hardware
            1. Setting up the Z-Wave controller
            2. Setting up the Z-Wave wall plug
            3. Setting up the Z-Wave multisensor
            4. The final picture
          3. Setting up the software
            1. Setting up the Python bindings
            2. The Z-Wave manager
          4. The final test
          5. Summary
      7. 3. Module 3
        1. 1. Preparing the BeagleBone Black
          1. Unpacking and powering up
            1. Installing an operating system
            2. Connecting to an external computer
            3. Installing a Windows manager
          2. Installing additional core software packages
            1. Installing a vision library
            2. Installing sound capability
            3. Creating and recording sound
          3. Making your BeagleBone Black speak
            1. Installing speech recognition
            2. Improving speech recognition accuracy
            3. Responding to voice commands
          4. Adding additional hardware and software for a fully functional core system
          5. Summary
        2. 2. Building a Basic Tracked Vehicle
          1. Choosing the tracked platform
          2. Connecting a motor controller to control the speed of your tracked platform
            1. Choosing the battery
            2. Connecting the motor controller
            3. Connecting the motor controller system
          3. Controlling your mobile platform programmatically using the BeagleBone Black and Python
            1. Adding program arguments to control your platform
            2. Accessing motor control via voice commands
          4. Summary
        3. 3. Adding Sensors to Your Tracked Vehicle
          1. Basics of sensors
          2. Adding distance sensors
            1. Sonar sensors
              1. Adding an array of inexpensive sonar sensors to the project
            2. IR sensors
          3. Dynamic path planning for your robot
            1. Basic path planning
            2. Avoiding obstacles
          4. Summary
        4. 4. Vision and Image Processing
          1. Connecting a webcam to the BeagleBone Black
          2. Using OpenCV
          3. Finding colored objects in your vision system
          4. Following colored objects with your vision system
          5. Finding movement in your vision system
          6. Following movement with your robot
          7. Summary
        5. 5. Building a Robot that Can Walk
          1. Building robots that can walk
          2. Working of servomotors
          3. Building the quadruped platform
          4. Using a servo controller to control the servos
          5. Communicating with the servo controller via a PC
          6. Connecting the servo controller to the BeagleBone Black
          7. Creating a program on Linux to control your quadruped
          8. Issuing voice commands to your quadruped
          9. Summary
        6. 6. A Robot that Can Sail
          1. The BeagleBone Black and robots that can sail
            1. Building the sailboat platform
            2. Controlling servos with the BeagleBone Black
            3. Controlling the servos on the sailboat from a program
          2. Remote control of the sailboat
            1. A ZigBee tutorial
          3. Summary
        7. 7. Using GPS for Navigation
          1. Beginning with a GPS tutorial
          2. Connecting GPS to the BeagleBone Black
            1. Communicating with the GPS
          3. Parsing the GPS information
          4. Calculating distance and bearing
          5. Summary
        8. 8. Measuring Wind Speed – Integrating Analog Sensors
          1. Connecting an analog wind speed sensor
          2. Getting sensor data from the wind speed sensor
          3. Some basics of sailing
          4. Summary
        9. 9. An Underwater Remotely Operated Vehicle
          1. Building the hardware for the ROV
          2. Controlling brushless DC motors using the BeagleBone Black
          3. Program to control DC motors using the BeagleBone Black
          4. Connecting to the BeagleBone Black via a long LAN
          5. Accessing a camera for your project
          6. Summary
        10. 10. A Quadcopter
          1. Basics of quadcopter flight
          2. Building the quadcopter
          3. Connecting the BeagleBone Black to the quadcopter
          4. Controlling the quadcopter using the BeagleBone Black
          5. Summary
        11. 11. An Autonomous Quadcopter
          1. Controlling quadcopter flight wirelessly
          2. Adding a game controller to your system
          3. Adding a webcam for autonomous flight
          4. Adding GPS for autonomous flight
          5. Summary
      8. Bibliography
      9. Index

    Product information

    • Title: BeagleBone: Creative Projects for Hobbyists
    • Author(s): Charles Hamilton, Rodolfo Giometti, Richard Grimmett
    • Release date: July 2017
    • Publisher(s): Packt Publishing
    • ISBN: 9781788395656