BeagleBone Robotic Projects - Second Edition

By Richard Grimmett
    What do you get with a Packt Subscription?

  • Instant access to this title and 7,500+ eBooks & Videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Free Chapter
    Getting Started with the BeagleBone Blue
About 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.
Publication date:
June 2017


Chapter 1. Getting Started with the BeagleBone Blue

Welcome to the beginning of an exciting adventure! Hopefully, you've ordered and received your BeagleBone Blue, an exciting platform that combines some excellent computing resources with the capability of accessing a wide range of hardware power.

Ordering the hardware (HW) is the exciting part of any project. You have wonderful dreams of all that you might accomplish once this amazing piece of technology is delivered. Unfortunately, the frustration of the first few attempts at accessing the capabilities of the unit can leave many developers, especially those with little experience with this type of dedicated system, so discouraged that the board ends up on the shelf, gathering dust next to the pet rock and cassette tape recorder.

In this chapter, we will cover the following topics:

  • Powering up and connecting to the BeagleBone Blue
  • Accessing the operating system
  • Accessing the board remotely via WLAN
  • Downloading the example code and colored images

There is rarely anything as exciting as ordering the latest new technology and anticipating its arrival. You daydream of the projects you'll build, the amazing things you can do, and the accolades you'll receive from family, friends, and colleagues. However, reality rarely meets your fantasies. This chapter will hopefully help you avoid the pitfalls that normally accompany unboxing and configuring a dedicated processor system such as the BeagleBone Blue. You'll step through the process and get answers to all kinds of specific questions so that you can understand what is going on. If you don't get yourself through this chapter, then you'll not be successful at any of the others, so buckle up and get ready for an exciting ride.

The most challenging aspect of accomplishing this for me as your guide is trying to decide to what level I should describe each step. Some of you are beginners, others have some limited experience, while still others will know significantly more than I in some of these areas. I'll try and keep it brief, but also try to be thorough so that at least you'll know what steps to take in order to be successful. I'll also try and point out some of the different ways you can get help if you are encountering problems.


You can download the example code and colored images for this book from your account at If you purchased the book elsewhere, you can visit and register to have the files mailed directly to you.

Here are the items you'll need for this chapter's project:

  1. A BeagleBoard Blue.
  2. The USB cable provided with the board.
  3. An external power supply that can provide 7.4 to 18 volts or a standard 2S LiPo battery for the BeagleBone Blue.
  4. A wireless LAN connection for the BeagleBone Blue.
  5. A separate computer that is connected to the internet.

Powering up and connecting to the BeagleBone Blue

The board has finally arrived. The box should contain the board and a USB cable that can power the board. Let's just look at a few notes on the Beagle Bone Blue first:

This board is an evolved version of the BeagleBone Black, which was an evolved version of the BeagleBone. They are all the same size, but the BeagleBone Blue adds a lot of new capabilities that, in the past, you'd need to add using external hardware. Specifically, the Blue adds the ability to control servos and DC motors directly, has built-in wireless LAN and Bluetooth, and also a built-in IMU and barometer. But more about all of this impressive capability later.

Before plugging anything in, inspect the board for any issues that might have occurred during shipping. This is normally not a problem, but it is always good to do a quick visual inspection. You should also acquaint yourself with the different connections on the board. Here is the board, with some of the more important connections labelled for your information:

And here is the other side:

So, let's get started. First, you'll need to power the board.

There are several ways to power the BeagleBone Blue. There is a standard DC power connector on the board. This power connector accepts voltages from 8 to 18 VDC in a 5.5 x 2.1 mm connector. This is the connection you would use if you wanted to plug the unit into a wall adapter--one that can provide from 8 to 18 volts and at least 1 amp, such as this one:

There is also a LiPo battery connector that connects to a two-cell, 7.4V LiPo battery, such as the one pictured here:

You can also connect the BeagleBone Blue to a host computer using a USB cable, with a standard-sized USB connector to connect to the host computer on one end and a micro-USB connector to connect to the BeagleBone Blue. No matter which power source you use, you'll need to make sure the unit can supply the power to the BeagleBone Blue as well as to any additional hardware that is attached to the board. If you have nothing else attached, the board can draw up to 1 amp. You may need several amps more if you are connecting to servo or DC motors, but let's start with a simple connection for your host computer that not only will provide power but will also allow you to make your first contact with the board. So plug the standard USB cable end into the host USB port and the microUSB connector in the USB In connection on the back side of the BeagleBone Blue.

When you plug the board in, the PWR LED should glow blue on the board. There are two sets of LEDs that will give you additional indications of activity. Here is a microUSB-up of the board, just so you're certain which one to look for:

The LEDs labelled GR0123 are the indicators that are useful for indicating the state of the board. They will all flash on and then, eventually, the LED labelled 0 will flash on and off as a heartbeat indicator: this lets you know that your processor is working.

Now we can use some computer SW to make sure our board is operating correctly. When you first plug the board into a Windows PC, you'll see the indicator in the lower right indicating that new HW is being installed. Eventually--and this may take a while--you'll get the indication that your device is ready to use. If you are using Windows 7, you can view the device in your Devices and Printers display (select this from the Start menu).

You should see the following:

If you see this, and LED 0 is flashing in a heartbeat fashion, you've successfully connected your board. Once you've connected, you can actually talk with your board via the USB connection. To do this, you'll first connect via serial port, but you'll need to know which port. To discover this, click on the BeagleBoneBlack connection, and you should see this selection:

Now, click on the Hardware tab, and you should see this:

In this case, the unit is connected to serial port COM112. You'll need a terminal emulator program to connect to the board--PuTTY is one that is readily available and free. Go to, and download and install the latest version.

Now open the PuTTY application. You should see this:

You'll need to establish a serial connection to the BeagleBone Blue. To do this, fill out the following on PuTTY:

In this case, I've also saved these settings under the Default Settings label. That way, you won't need to re-enter these each time. Now select Open, and you should see the Terminal window open to the BeagleBone Blue. When the window opens, place your mouse in the window, select it, and then hit Enter; you should see this:

You can log in by typing the default username and password, debian and temppwd, respectively. Now you should see this:

If you've reached this point, congratulations! You are logged in and ready to interact with your BeagleBone Blue. By the way, you'll notice that the board does not echo the characters as you enter your password. It does not want someone to look over your shoulder and see your password as you type. Despite no characters appearing on the screen, your password is being entered.

If you're having problems, the folks at have a rich set of forums that can help you work through any of the problems you might be having unpacking and powering on the board.


Accessing the operating system

Now that you have your system all up and working, you can access the operating system. The default operating system on the board is Debian, fortunately just the version you're interested in using. Linux, unlike Windows, or Android or iOS, is not tightly controlled by a single company. It is a group effort, mostly open source; it is available for free and grows and develops a bit more chaotically.

Thus, a number of distributions have emerged, each built on a similar kernel, or core set of capabilities. These core capabilities are all based on the Linux specification. However, they are packaged slightly differently, and developed, supported, and packaged by different organizations. Debian is one of these versions. This particular distribution is a popular one among DIYers, and it will allow you to use a number of different freeware software packages. Debian also has excellent support for new HW, and this can be very important for our projects.


The BeagleBone Blue also supports using other operating systems by installing them on a micro SD card and inserting the card into the micro SD slot on the board. To find out more about this capability, refer to the details on

So, you are going to use a version of Linux called Debian on your BeagleBone Blue. Once you are logged in to your BeagleBone Blue, you can issue some simple commands. If you type ls, you should see something like this:

The ls command simply lists the files and directories in the current directory. In this case, there is only one: the bin directory. In the next chapter, you'll learn more about the commands you'll need to access the Linux capability of the BeagleBone Blue as well as how to program the unit.


Accessing the BeagleBone Blue remotely via WLAN

It is important that you can access the BeagleBone Blue through the serial connection. However, you're going to want a connection that is of higher bandwidth. Also, it will be very helpful to connect to the board without having a physical connection. Fortunately, the BeagleBone Blue has wireless LAN capability on board to make this easy. You now have access to the Debian Linux system and can type in commands and see their result in a terminal window. You'll use this capability to understand the WLAN connection on the BeagleBone Blue.

Type in ifconfig at the prompt. You should get a display like the following:

This information gives you an idea about how you can connect to the internet, and have a valid internet address. In this case, the eth0 connection, normally a cabled connection to the board, is not connected to the internet. That makes sense because the BeagleBone Blue doesn't have a cabled internet connection. The lo connection is a local loopback connection, you'll not need to use it. The usb0 connection is the connection that is available over the USB cable that you have plugged in from the host computer, and it has the address You can access this connection from your host computer, but your BeagleBone Blue can't access the internet from this connection.

The wlan0 connection is the connection for your WLAN device on board the BeagleBone Blue. This particular connection is not yet connected to the internet: as you can see, there is no inet addr value on the second line. Your WLAN is, however, broadcasting as a wireless access point. To know the specifics of the wireless access point, you can type cat/var/lib/connman/settings, and you should see something like this:

The specific part we are interested in is the [WiFi] set, which shows the broadcast SSID as the Tethering.Identifier and the password as the Tethering.Passphrase.

You will now want to access an available WLAN to update your system, and perhaps download additional software. To set up your connection, you'll use the connmanctl command. The Connmanctl application is set up to configure your device. Perhaps one of the first things you would like to do is to connect to an available WLAN connection. You can then use this to update your device, and also download other software. To do this, type connmanctl at the prompt. You should see this:

Now, follow these steps:

  1. Type enable wifi. It should indicate that the Wi-Fi is already enabled:
  1. Type scan wifi. This will scan for possible Wi-Fi connections. It will return when the scan is complete.
  2. The scan wifi command, however, does not return the scan data directly. You'll need to type services, and it will return a list of possible Wi-Fi connections, like this:
  1. Now type agent on. This will register these different Wi-Fi locations so that you can connect.
  2. Then type connect, followed by the identifier of the Wi-Fi connection you wish to connect to. In this case, the command will be connect wifi_ec1127bf876d_425955495f56697369746f72_managed_none. If the Wi-Fi connection requires a password, it will prompt you for that password.



  1. Now you should be connected to the network. Type quit, and then type ifconfig at the prompt, and you should see something like this:

The wlan0 connection now has a valid address at This address has been assigned by the system.


Generally, there are two types of IP addresses that our board can be assigned; one is called static and the other dynamic. In the static case, the same address will always be used. In the dynamic case, the address may change each time the system boots since it asks the system for an address, which it then uses for that session. This is called DHCP. Most systems are configured for the dynamic case; however, if your system isn't changing, you will most likely get the same address each time you power on and log in to the system. However, you may want to ensure you get the same address or to force a specific address if there is no WI-Fi connection. To do this, enter the following command inside the connmatctl application: confi [wifi_identifier] -ipv4 manual [desired address] [mask] [router address] -nameservers Here, [wifi_identifier] is your wifi identifier, [desired address] is the desired address of the device, [mask] is the mask associated with the address, which is almost always, and [router address] is the address of the router.

Now that you are connected to Wi-Fi, you'll want to update your system. Type in sudo apt-get update and then sudo apt-get upgrade. The system will prompt you for the sudo password, which is the same as the password you used to log in. Once you enter this, the system will automatically go out and find all the upgrades associated with the system and applications that you have installed. This may take a very long time, depending on how out-of-date your system has become.

Now that your BeagleBone Blue is connected to Wi-Fi and you have updated your Debian system, you can connect to the board via the Wi-Fi connection. You'll be installing some additional SW on your BeagleBone Blue. You will be using apt-get to install SW throughout this book. This is the command that Debian uses to go out and find SW and then install it on your machine. The nice thing about this is that it will also normally go out and find dependencies and download them as well; thus, not only the package you want, but the packages that are needed for that package are installed as well. However, a bit of caution: this is not fool-proof! You may find times when the SW you have installed will not function because of a dependency that the system does not know about.

There are four ways you can access your system from your external PC. The first is the one you have been using, a simple terminal interface using PuTTY through a serial connection. Now that you can connect to your BeagleBone Blue via Wi-Fi, you can access it through the PuTTY SSH protocol over the Wi-Fi connection.

The second way to access your board via Wi-Fi is using a program called vncserver, which will allow you to open a graphical window on your PC that will show you what the embedded system would be displaying on its display. Finally, there is a way to simply transfer files via a program called WinSCP, which is custom-made for this purpose.

The first step to enable any sort of Wi-Fi connection is to connect to your board from your host computer. On your host computer, you should be able to scan for available connections. If you are using a Windows host computer, you should see something that looks like this in your network settings indicator:

This is the Wi-Fi signal from your BeagleBone Blue. Connect to this Wi-Fi network by selecting it and entering the password which, if you haven't changed it, is BeagleBone. You should see that your host computer has now connected to this network. Now you can use this wireless connection with your device.

Let's first explore an SSH connection over your Wi-Fi connection. You'll need the IP address of your unit to connect. If you are still connected to the serial interface via PuTTY, you can get this by typing ifconfig. You've already done this and seen the inet address. Here is what that looked like:

In this example, under the wlan0 section, you can see inet addr: This is the address you'd use if you were connecting to this board.

If you aren't connected to the serial interface, you can still discover the address. If you are using a Windows PC, there are several IP scan utilities that are free and will allow you to find the IP addresses of all the devices attached to your computer. If you are using a Linux machine as a host computer, you can use a Linux application called nmap.

Once you know your address, you can connect to your device using the SSH protocol. An SSH terminal is a Secure Shell Hypterminal connection, which simply means you'll be able to access your board and type in commands at the prompt, just like you have done through the serial connection. Fortunately, PuTTY, the terminal application you downloaded earlier, also has this capability. When you start PuTTY, it actually defaults to SSH, so all you'll need to do is type in the inet address of your BeagleBone Blue, like so:

Type the inet address from the previous page in the Host Name space, and make sure the SSH selection is highlighted. You can also save your configuration so you won't have to type it each time.

When you press Open, the system will try and open a terminal window on your BeagleBone Blue through the LAN connection. The first time you do this, you will get a warning about an RSA key, as the two computers don't "know" about each other, so Windows is complaining that a computer that it doesn't know is about to be connected in a fairly intimate way. Simply select OK, and you should get a terminal with a log in prompt.

Now that you can issue commands to your BeagleBone Blue over Wi-Fi, you won't need the serial connection. You can power your BeagleBone either using a power supply or LiPo battery; you will no longer need the serial connection to your host computer. If you'd like to SSH from a Linux or iOS machine, the process is even simpler. Bring up a terminal window, and then type ssh debian@ -p 22. This will then bring you to the log in screen of your BeagleBone Blue, which should look similar to the log in screen you've been using over the serial connection.

SSH is a really useful tool for communicating with your BeagleBone Blue. However, sometimes, you need a graphical look at your system, particularly to debug vision systems. To do this, you'll need to install two sets of software. You'll need to install a graphical user interface package for Debian, and you'll need a way to connect to this graphical user interface remotely.

There are several graphical user interface systems available for Debian. One that is simple, lightweight (takes up little memory), and easy to use is Xfce. It is also easy to install. Simply type sudo apt-get install xfce4. Since the BeagleBone Blue does not have a display connection, now that you have a graphical user interface, you'll need a way to access it remotely.

To get this functionality, you'll install tightvncserver on your BeagleBone Blue by typing sudo apt-get install tightvncserver in a terminal window. Tightvncserver is an application that will allow you to remotely view your complete Windows system. Once you have it installed it on your BeagleBone Blue, you'll need to start the server each time you'd like to use it by typing vncserver in a terminal window on the BeagleBone Blue.


You can set up vncserver to start each time you power on your BeagleBone Blue; however, you'll only need it some of the time, mostly for debugging. If you'd like to set it to start each time, see the instructions at

The first time you type vncserver, you'll be prompted for a password. This can, and maybe should, be a different password to your password to access your BeagleBone Blue. This will be the password your remote system will send to access the vncserver running on the board. Select a password--you don't need to set the password for the view-only capability--and then your vncserver will be running.

You'll need a VNC viewer application for your remote computer. On a Windows system, or on a Linux System that supports it, you can use the same Tightvncserver application. It is available for free download at Download the file and follow the instructions to install it on your computer. After you install it, you can run it. You should see the following screen:

As shown, you'll enter the vncserver address, which is the IP address of your BeagleBone Blue, followed by a :1, and select Connect. The first time you connect, it may complain about connecting to an unknown computer, but let it know that this is OK. You will get this popup:

Type in the password you just entered while starting the vncserver, and you should then get a graphical view of your BeagleBone Blue, which hopefully looks like this:

Select the Use default config, and you should now see the full graphical display of your BeagleBone Blue:

You can now access all the capabilities of your system, albeit possibly slower.

The final piece of SW you may want to use if you are running a Microsoft Windows system is a free application called WinSCP. To download and install this piece of SW, simply search the web for WinSCP and follow the instructions. Once installed, run the program. It will open the following dialog box:

Fill in the host name with your inet address, as shown, and you should come to a dialog box that will ask you for your username and password. After you fill those in and hit Enter, you should see the following screen:

Now you can drag and drop files from one system to the other.

Once you've completed this step, you can access your system to the full extent remotely. You need to only connect the power and connect to the board via Wi-Fi. If you need to issue simple commands, connect via SSH. If you need a more complete set of graphical functionality, you can access this via vncserver. Finally, if you are using a Windows system and want to transfer files back and forth, you have access to WinScp. Now you are ready to start using the BeagleBone Blue.



Congratulations! You've completed the first stage of your journey. You have your BeagleBone Blue up and working--no gathering dust in the bin for this piece of HW. It is now ready to start connecting to all sorts of interesting devices in all sorts of interesting ways. One thing that is important to note: the system is not going to be nearly as stable as your PC or Mac. The HW and SW is new, but you'll be successful even though you might have to return and complete some steps again. In the next chapter you'll learn how to program the BeagleBone Blue, an excellent first step in your quest to create amazing projects.

About the Author
  • Richard Grimmett

    Dr. Richard Grimmett has been fascinated by computers and electronics from his very first programming project, which used Fortran on punch cards. He has bachelor's and master's degrees 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 now teaches computer science and electrical engineering at Brigham Young University, Idaho, where his office is filled with his many robotics projects.

    Browse publications by this author
Latest Reviews (3 reviews total)
UI/UX not intuitive. Website designed poorly
See my previous comments above
The e-book coding examples in python did not have the correct indentation
BeagleBone Robotic Projects - Second Edition
Unlock this book and the full library FREE for 7 days
Start now