Reader small image

You're reading from  BeagleBone Robotic Projects

Product typeBook
Published inDec 2013
PublisherPackt
ISBN-139781783559329
Edition1st Edition
Right arrow
Author (1)
Richard Grimmett
Richard Grimmett
author image
Richard Grimmett

Richard Grimmett has more fun that should be allowed working on robotics projects while teaching Computer Science and Electrical Engineering at Brigham Young University Idaho. He has a Bachelors and Masters degree in Electrical Engineering and a PhD in Leadership Studies. He also has 26 years of experience in the Radar and Telecommunications industries, and even has one of the original brick phones. He has written books on the basics of using the BeagleBone Black for robotics projects, and another for the Raspberry PI and yet another for the Arduino.
Read more about Richard Grimmett

Right arrow

Chapter 3. Providing Speech Input and Output

Now that your BeagleBone Black is up and operating, you can give your project many different basics of functionality that are really cool. We're going to start with speech; it is a good basic project and offers several examples of adding capability in both HW and SW. So buckle up and get ready to learn the basics of interfacing with your board by facilitating speech.

Mission briefing


You'll be adding a microphone and speaker to our basic board, and you'll add functionality so the robot can recognize voice commands and respond via the speaker. Additionally, you'll be able to issue voice commands and have the robot respond with an action. When you're freed from typing in commands, you can interact with your projects in an impressive way. This project will require adding both HW and SW.

Why is it awesome?

Interfacing with your projects via speech is more fun than typing in commands, and it allows interaction with our project without using a keyboard or mouse. Besides, what self-respecting robot wants to carry around a keyboard? No, you want to interact in natural ways with your projects, and this project will teach you how. Interfacing via speech also helps you find your way around the board, learn the available free functionality, and become familiar with the community of functionality developers.

Your objectives

Your objectives are as follows:

  • Hooking up the...

Hooking up the HW to make and input sound


For this task, you are going to hook up your HW so that you can record and play sound.

Prepare for lift off

Reassemble your BeagleBone Black. Plug in the LAN cable. Connect the powered USB hub and plug in the microphone/speaker USB device. Also plug in your speakers and the microphone.

Plug in the power. You can execute all of the following instructions in one of the several ways.

If you are still connected to the display, keyboard, and mouse, log in to the board, use startx to start Xfce (your windowing system), and then open a terminal window.

If you are only connected via LAN, you can do all of this using an SSH terminal window, so as soon as your board flashes that it has power (look for the heartbeat LED), open up an SSH terminal window using PuTTY or some similar terminal emulator. Once the terminal window comes up, log in with your username and password. Now type in cat /proc/asound/cards. You should see the following response:

Notice that the system...

Using eSpeak to allow your projects to respond in a robotic voice


Sound is an important tool in your robotic toolkit, but you will want to do more than just play music. Let's allow your robot to speak.

Prepare for lift off

Now that you can both get sound in and out of your BeagleBone Black, let's do something useful with this capability. You're going to start by enabling eSpeak, an open source application that provides you with a computer voice.

Engage thrusters

eSpeak is an open source voice generation application. To get this free functionality, you'll need to do the following.

Download the eSpeak library by typing sudo apt-get install espeak. You'll probably have to accept the additional size space that the application requires, but this is fine based on your SD card size. The download may take a while, but the prompt will reappear when it is complete.

Now, let's see if the BeagleBoard Black has a voice. Type the following command: espeak "hello". The speaker should emit a computer voiced ...

Using PocketSphinx to interpret your commands


Sound is cool, and speech is even cooler, but you also want to be able to communicate with your projects through voice commands. This section will show you how to add speech recognition to your robotic projects.

Prepare for lift off

Now that your project can speak, you want it to listen as well. This isn't nearly as simple as the speaking part, but thankfully you have some significant help from the development community. You are going to download a set of capabilities called PocketSphinx, which will allow your project to listen to your commands.

Engage thrusters

The first step is downloading the PocketSphinx capability. Unfortunately, this is not quite as user friendly as the eSpeak process, so follow along carefully.

Go to the Sphinx website, hosted by Carnegie Mellon University at http://cmusphinx.sourceforge.net/. This is an open source project that provides you with the speech recognition SW. With your smaller embedded system, you will be using...

Providing the capability to interpret your commands and have your robot initiate an action


Now that your robot can both speak and listen, let's see if you can make it respond to your commands.

Prepare for lift off

Now that the system can both hear and speak, you want to provide the capability to respond to your speech and execute some commands based on the speech input. Now you're going to configure the system to respond to simple commands.

Engage thrusters

In order to respond, you're going to edit the continuous.c code in the /home/ubuntu/src/programs directory. You could create your own C file, but this file is already set up in the makefile system and is an excellent starting spot. I like to make a copy of the current file into continuous.c.old, so I can always get back to the starting program if it is required. Then you will need to edit the continuous.c file. It is very long and a bit complicated, but you are specifically looking for the following section in the code:

In this section of...

Mission accomplished


Now your project can both hear and speak. You can use this later when you want to interface with your project without typing commands or using a display. You should also feel more comfortable installing new hardware and software onto your system. You'll be using that skill throughout the book as you look at more complex projects.

A challenge


You'll use this capability to allow your robot to respond to your commands in several of your projects. I've used one example with the system C command. You should try others. You could also start programs and keep them going, interfacing with them without invoking them over and over again at the command line. If you are familiar with Linux, think about the messaging protocols that you could use to interface two running programs.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
BeagleBone Robotic Projects
Published in: Dec 2013Publisher: PacktISBN-13: 9781783559329
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Richard Grimmett

Richard Grimmett has more fun that should be allowed working on robotics projects while teaching Computer Science and Electrical Engineering at Brigham Young University Idaho. He has a Bachelors and Masters degree in Electrical Engineering and a PhD in Leadership Studies. He also has 26 years of experience in the Radar and Telecommunications industries, and even has one of the original brick phones. He has written books on the basics of using the BeagleBone Black for robotics projects, and another for the Raspberry PI and yet another for the Arduino.
Read more about Richard Grimmett