Book Image

BeagleBone Robotic Projects - Second Edition

By : Richard Grimmett
Book Image

BeagleBone Robotic Projects - Second Edition

By: Richard Grimmett

Overview of this book

BeagleBone Blue is effectively a small, light, cheap computer in a similar vein to Raspberry Pi and Arduino. It has all of the extensibility of today’s desktop machines, but without the bulk, expense, or noise. This project guide provides step-by-step instructions that enable anyone to use this new, low-cost platform in some fascinating robotics projects. By the time you are finished, your projects will be able to see, speak, listen, detect their surroundings, and move in a variety of amazing ways. The book begins with unpacking and powering up the components. This includes guidance on what to purchase and how to connect it all successfully, and a primer on programming the BeagleBone Blue. You will add additional software functionality available from the open source community, including making the system see using a webcam, hear using a microphone, and speak using a speaker. You will then learn to use the new hardware capability of the BeagleBone Blue to make your robots move, as well as discover how to add sonar sensors to avoid or find objects. Later, you will learn to remotely control your robot through iOS and Android devices. At the end of this book, you will see how to integrate all of these functionalities to work together, before developing the most impressive robotics projects: Drone and Submarine.
Table of Contents (18 chapters)
Title Page
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface

Creating an array of sensors


To do this, connect the additional pins, as follows:

Arduino pin

Sensor pin

5V

Sensor 1 VCC

GND

Sensor 1 GND

12

Sensor 1 Trig

11

Sensor 1 Echo

5V

Sensor 2 VCC

GND

Sensor 2 GND

10

Sensor 2 Trig

9

Sensor 2 Echo

5V

Sensor 3 VCC

GND

Sensor 3 GND

8

Sensor 3 Trig

7

Sensor 3 Echo

Here is a picture of the three sensors assembled:

Now that the sensors are connected, you'll need to add some functionality to the Arduino code to communicate with all three sensors. Here is that Arduino code:

    #include <NewPing.h>
    #define TRIGGER_PIN1 12
    #define ECHO_PIN1 11
    #define TRIGGER_PIN2 10#define ECHO_PIN2 9
    #define TRIGGER_PIN3 8
    #define ECHO_PIN3 7
    #define MAX_DISTANCE 200
    NewPing sonar1(TRIGGER_PIN1, ECHO_PIN1, MAX_DISTANCE);
    NewPing sonar2(TRIGGER_PIN2, ECHO_PIN2, MAX_DISTANCE);
    NewPing sonar3(TRIGGER_PIN3, ECHO_PIN3, MAX_DISTANCE);
    void setup() {
      Serial.begin(115200);
    }
    void loop() {
      delay(500);
      unsigned int uS1 = sonar1.ping();
...