Home IoT & Hardware BeagleBone Robotic Projects

BeagleBone Robotic Projects

By Richard Grimmett
books-svg-icon Book
eBook $28.99 $19.99
Print $48.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $28.99 $19.99
Print $48.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Getting Started with the BeagleBone Black
About this book
Thanks to new, inexpensive microcontrollers, robotics has become far more accessible than it was in the past. These microcontrollers provide a whole new set of capabilities to allow even the most inexperienced users to make amazingly complicated projects. Beaglebone 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 to allow 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 will include guidance on what to purchase and how to connect it all successfully–and a primer on programming the BeagleBone Black. Chapter by chapter, we will add additional software functionality available from the open source community, including how to make the system see using a webcam, how to hear using a microphone, and how to speak using a speaker. We then add hardware to make your robots move–including wheeled and legged examples–as well as covering how to add sonar sensors to avoid or find objects, plus wireless control to make your robot truly autonomous. Adding GPS allows the robot to find itself. Finally the book covers how to integrate all of this functionality so that it can all work together, before developing the most impressive robotics projects: those that can sail, fly, and explore underwater.
Publication date:
December 2013
Publisher
Packt
Pages
244
ISBN
9781783559329

 

Chapter 1. Getting Started with the BeagleBone Black

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 can end up on the shelf, gathering dust next to the pet rock and cassette tape recorder.

 

Mission briefing


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, the accolades you'll receive from family, friends, and colleagues. However, reality rarely fulfills your fantasies. This project will hopefully help you avoid the pitfalls that normally accompany unboxing and configuring your BeagleBone Black. You'll step through the process, answer all kinds of clarifying questions, and help you understand what is going on. If you don't get through this project, 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, some have limited experience, others will know significantly more than I in some of these areas. I'll try to 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 to point out some of the different ways you can get help if you are encountering problems. So for this project, here are your objectives.

Your objectives

Your objectives are as follows:

  • Hooking up a keyboard, mouse, and display

  • Changing the operating system

  • Adding a graphical user interface

  • Accessing the board remotely

Tip

Downloading the example code and colored images

You can download the example code and colored images for this book 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 files e-mailed directly to you.

Mission checklist

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

  • A BeagleBoard Black

  • The USB cable provided with the board

  • A display with the proper video input

  • A keyboard, mouse, and powered USB hub

  • A micro SD card of at least 4 GB

  • A micro SD card reader/writer that fits your computer

  • Another computer that is connected to the Internet

  • An Internet connection for the board

 

The unveiling!


The board has finally arrived. Here is what should come with the standard package:

Prepare for lift off

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 they are, labeled for your information:

Engage thrusters

So let's get started. You need to power the board, but you also need to hook up a way to interact with the board and see the results of your interaction. The first thing you'll notice is that there is no cable that fits the 5V DC connector. What's with that? Am I already hung up without ever powering on the board? Well, fortunately no, but you do need to talk about power for a moment. There are two ways to power the board. The first is through the USB client connection. This is done by:

  • Connecting the micro-USB connector end of the cable to the board

  • Connecting the standard sized USB connector to either a PC or a compatible DC power source that has such a connection

If you are going to use a DC power source, make sure the unit can supply at least one ampere. This is not optional. Although the board might not always draw this much current, if it senses that the unit cannot supply the required current, it will shut down.

There is another option to power the board: simply supply 5V DC to the connector. Make sure that the plug is 5.5 x 2.1 mm (centre positive) and that the unit can supply at least one ampere. As mentioned earlier, this is not optional.

Even if you are going to choose a DC power source for your board, initially let's connect the board via the provided USB cable. Almost all of the different projects you work on here will need to supply power from a battery pack anyway, and if you supply the board through the USB port and micro-USB connector, you can use your external computer to communicate with the board and ensure that it is up and working.

Objective complete – mini debriefing

When you plug the board in, the PWR LED, located by the 5V input, should light blue on the board. Here is a close up of the LED locations, just so that you're certain which one to look for:

The other four indicators on the right-hand side of the LAN connection will eventually begin to flash blue. The one on the far right will eventually flash as a heartbeat indicator, letting you know that your processor is working by flashing twice quickly, approximately once per second.

Now you can use some computer software (SW) to make sure your board is operating correctly. When you first plug the board into a Windows PC, you'll see the indicator at the lower-right indicating that new HW is being installed. Eventually—and this may take a bit—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 this:

If you see this and the farthest right LED flashing in a heartbeat fashion, you've successfully connected your board. If you can't reach this point, see the following Classified intel section.

Once you've connected, you can actually communicate with your board via the USB connection. Open a Firefox or Chrome browser and type in the address 192.168.7.2. You should see the following in your browser:

If you've reached this point, congratulations! You are now communicating with your BeagleBone Black as the web pages are being served by the on-board web server. You're ready for the next step. Don't continue with directions on this page; you're going to take a different route in updating your BeagleBone Black. If you're having problems, the folks at beagleboard.org have a rich set of forums that can help you work through any of the problems you might be having unpacking the board.

Classified intel

Powering the board can be a bit challenging, since the board requires at least 500 mA of current, and many USB cables and ports are limited by design to less than 500 mA. When attempting to power up with these cables on a power supply that cannot supply enough current, the unit will begin to power on, the blue LEDs will begin to flash, and then everything will turn off. This was a more significant problem with early units than the units that are currently shipping.

Also, if you are struggling to connect to the board, you may need to download drivers. These are available on the beagleboard.org site.

 

Hooking up a keyboard, mouse, and display


The board is now powered on, and you have blinking LEDs. You have been able to access the basic functionality via the USB port. However, you want to do much more. This task will help you accomplish your goals.

Prepare for lift off

Now that you know that your board works and you've verified the connection via the provided USB cable to your computer, you're going to add the peripherals so that it can operate as a standalone computer system. This step is a bit optional, as in the future your projects will be in systems where you won't connect directly to the board with a keyboard, mouse, and display. However, this can be a great learning step and in the off chance, you need to do some debugging on the system. It is good to know how to connect directly to the board. You'll also use this configuration to verify the basic SW installation before you start your projects.

You'll need:

  • A USB mouse.

  • A keyboard.

  • A display device.

  • You may also need a USB hub, and if you don't have one, get a powered USB hub. This will be important later in your project work.

Many of you will have most of this stuff already, but if you don't, there are some things to consider before buying additional equipment. Let's start with the keyboard and mouse. Most mice and keyboards have separate USB connectors. You'll notice, however, that on your BeagleBone Black there is only one USB port; thus, there is a need for the USB hub.

Before deciding on the hub to connect to your board, you need to understand the difference between a powered USB hub, and one that gets its power from the USB port itself. Almost all USB hubs are not powered; that is, you don't plug in the USB hub separately. The reason for this is, almost all of these hubs are hooked up to computers with very large power supplies, and so powering USB devices from the computer is not a problem. This is not the case for your board. The USB port on your board has very limited power capabilities, so if you are going to hook up devices that require significant power—for instance, a WLAN adapter or Kinect sensor—you're going to need a powered USB hub, one that provides power to the devices through a separate power source.

If you already have a hub that is not powered and want to use it to connect your keyboard and mouse, feel free, it should work fine as these do not draw too much power. If you don't already have a keyboard and mouse, or are looking for a keyboard and mouse that you can dedicate to your board, I suggest choosing a keyboard with a mousepad. That way you only have one USB connection to the two devices.

To complete this step you'll also need a display. You need to investigate which display types can be used with the BeagleBone Black. The only video output on the board is a micro-HDMI connector. The easiest connection to create is to connect the board directly to a monitor or TV that has an HDMI input; however, you'll probably need to buy either a cable that has micro-HDMI on one end and regular HDMI on the other, or an adapter from micro-HDMI to regular HDMI. HDMI monitors are relatively new, but if you have a monitor that has a DVI input, you can buy adapters or HDMI to DVI cables relatively inexpensively that provide an interface between DVI and HDMI. The display I use has a DVI input.

Don't be fooled, however, by adapters that claim that they go from HDMI to VGA, or HDMI to s-video. These are two different kinds of signals: HDMI and DVI are digital standards, and VGA and s-video are analog standards. There are adapters that can do this, but they must contain circuitry and require power, so are significantly more expensive than any simple adapter, and they result in a lower quality output.

Engage thrusters

Now that you have your parts, connect the USB hub to the standard USB port, the keyboard and mouse to the USB hub, and the display to the micro-HDMI connector as shown here:

Once these are all connected, plug in the USB hub, the display, and finally the BeagleBone Black board. Since I am no longer going to use the USB connection to the computer, I am using a standard USB 5 volt power supply. Make sure you connect all your devices before you power on the unit. Most operating systems support hot-swap of devices, which means you are able to connect a device after the system has been powered, but this is a bit shaky in the embedded environment. You'll always cycle power when you connect a new HW.

Objective complete – mini debriefing

Once this is complete, the unit should power on; it will boot its default operating system from the internal eMMC space, which is a sort of internal memory card and the display will look like this:

So you should now be able to interact with your BeagleBone Black directly. This is an important step, although for most of your projects you'll use a remote computer to program and control your device. Keep the components you have gathered around for debug purposes, you may need them later, as there is at least a possibility that things might go wrong and you'll need to find out how to fix them.

Classified intel

Just a couple of notes about this task. First, if you have problems powering the system, check to make sure your power supply can supply enough current. Don't even consider powering the system with less than 1 amp. Also, if you are using a power supply with a USB connector, make sure you use the cable that came with the unit to connect between the USB and the unit. Some cables also limit the current, and the unit will sense this and not power on correctly.

Also, a note on connecting to the display: the board's HDMI connector is micro-HDMI, which almost begs for an adapter. The display I chose to use is an inexpensive monitor with DVI input, so I purchased a cable that went from standard HDMI to DVI. Then I purchased a micro-HDMI to standard HDMI adapter. For some reason, I had problems with this configuration, and chalked it up to a bad HDMI adapter. I now prefer a cable that has a micro-HDMI connector on one end, and a standard HDMI connector on the other, and then a standard HDMI to DVI adapter. This seems to be the most reliable and, if I choose, I can quickly change and use my HDTV as the display. One of the challenges in choosing the components for your system is trying to anticipate how it might be used in the future.

 

Changing the operating system


Now that you have your system all up and working, you're going to do something that seems a bit counterintuitive; instead of using the system you've got, you're going to install a new operating system on card so your board will boot and run this different operating system. The reason will become clear in the next section.

Prepare for lift off

The default operating system on the internal memory is a version of Linux called Ångström. Now Linux, unlike Windows, Android or iOS, is not tightly controlled by a single company. It is a group effort, mostly open source, and while it is available for free, it 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. Ångström is one of these versions; Ubuntu is another. There are others as well, but these are the two main choices for the distribution that you will put on your card.

I choose to use the Ubuntu distribution of Linux on my BeagleBone Black for a couple of reasons. First, Ubuntu is arguably the most popular distribution of Linux, which makes it a good choice because of the community support it offers. Also, I personally like this distribution of Linux when I need to run Linux on my own personal computer. It provides a complete set of features, is well organized, and generally supports the latest sets of HW and SW. Having the same version on both my personal computer and my BeagleBone Black makes it easier for me to use both as they operate, at least to a certain degree, the same way. I can also try some things on my computer before trying them on the BeagleBone Black. I've also found that Ubuntu has excellent support for new HW, and this can be very important for your projects.

Others tend to favor the Ångström distribution, the support for this distribution is growing and it can sometimes be a bit simpler to access and work with. There are also other choices, such as Arch and there are some who are working on a distribution of Android for the BeagleBone Black. But for this book we are going to install and run a version of Ubuntu on your BeagleBone Black.

Engage thrusters

There are two approaches to getting Ubuntu onto your board. The board is getting popular enough that you can buy an SD card that already has Ubuntu installed, or you can download it onto your personal computer and then install it on the card. I'll assume you don't need any directions if you want to purchase a card—simply do an Internet search for companies selling such a product.

If you are going to download a distribution, you need to decide if you are going to use a Windows computer to download and create an SD card, or a Linux machine. I'll give brief directions for both here.

First, you'll need to download an image. This part of the process is similar for either Windows or Linux. Open a browser window. You can go to one of the several sites that have an image you can put on your card. My personal favorite is http://elinux.org/Beagleboard:Ubuntu_On_BeagleBone_Black. They keep pointers to a number of different images and directions on how to install them. My personal favorite is the 12.04 version of Ubuntu. It is new enough to support everything you need, but old enough to be stable. Select the image and download the file.

If you're using Windows, you'll need to unzip the file using an archiving program like 7-Zip. If you don't have this on your computer, follow the directions on the beaglebone.org Getting Started web page. This will leave you with a file that has the .img extension, a file that can be imaged on your card.

Now that you have the image, you need a program that can write the image to the card. I use the Image Writer for Windows program. Again, if you don't have this program, follow the directions on the beaglebone.org Getting Started web page. Plug your card into the PC, run this program, select the correct card and image, then select Write. This will take some time, but when completed eject the card from the PC.

If you are using Linux, you'll need to un-archive the file and then write it to the card. You can do this all with one command. However, you do need to find the /dev device label for your card. You can do this with the ls -la /dev/sd* command. If you run this before you plug in your card, you might see something like this:

After plugging in your card, you might see something like this:

Notice your card is at sdb. Now go to the directory where you downloaded the archived image file and issue the following command:

xz -cd ubuntu-precise-12.04.2-armhf-3.8.13-bone20.img.xz > /dev/sdX

where ubuntu-precise-12.04.2-armhf-3.8.13-bone20.img.xz will be replaced with the image file that you downloaded, and /dev/sdX will be replaced with your card ID, in this example /dev/sdb. Eject the card and you are ready to plug it into the board and boot.

Objective complete – mini debriefing

Make sure your BeagleBone Black is unplugged and install the micro SD card into the slot. Then apply power. After the boot, you should get a screen that looks like this:

You can now log in to the system. You'll need to use the username and password of the image you downloaded (unfortunately, they are not the same for all images, but you should be able to easily find these in the same place you found your image). For my distribution the default username is ubuntu and the password is also ubuntu. Note that the password will not show up while you type it in. Remember this username and password, you'll need to use it throughout the examples in this book. Entering those will bring you to this state:

You should now be logged in and ready to start issuing commands.

Classified intel

Now, two questions arise: do you need an external computer during the creation of your projects? and what sort of computer do you need? The answer to the first question is a resounding yes. Most of your projects are going to be self-contained robots with very limited communication capabilities. You will be using an external computer to issue commands and see what is going on inside your BeagleBone Black. The answer to the second is a bit more difficult. Because you are working in Linux, most notably Ubuntu on your BeagleBone Black, there are some advantages to having an Ubuntu system available as your remote system. You'll be able to try some things on your computer before trying them in your embedded system. You'll also be working with similar commands for both, which will help your learning curve.

However, bulk of the personal computers today run some sort of Windows operating system, so that is what will be normally available. You can do almost all that you need to do as far as issuing commands and displaying information with a Windows machine, so either way will work. I'll try to give examples for both, as long as it is practical.

There is one more choice, the choice I actually prefer. I have access to both systems on my PC. Previously this was done by a process called dual booting, where both systems were installed on the computer and the user chose which system they wanted to run during boot-up. Changing systems in this kind of configuration was time consuming, however, and it used up a lot of disk space. There is a better way.

On my Windows machine, I have a virtual Ubuntu machine running under a free program from Oracle called VirtualBox. This program lets me run a virtual Ubuntu machine hosted by my Windows operating system. That way I can try things in Ubuntu, yet keep all the functionality of my Windows machine. I'm not going to explain how to install this; there is plenty of help on the Web. Just search for Ubuntu and VirtualBox. There are several websites that offer easy, step-by-step instructions. One of my favorites is http://www.psychocats.net/ubuntu/.

 

Adding a graphical user interface


You now have your Ubuntu system up and working, and you can type in commands and see their result in the terminal window. However, you need to add some additional basic functionality before adding all the cool capabilities that will make your robots walk, talk, and interact. First, you need to connect to the Internet so that you can update your system and add additional functionality. Second, in many of your projects, you will be working with graphical programs, most notably when you connect webcams or other image sensors.

Prepare for lift off

You're going to need a graphical user interface (GUI), so let's tackle that problem.

Simply run a LAN cable from a router or switch to the BeagleBone board, plug it in the LAN connector, and restart the BeagleBone.

Now type ifconfig at the prompt. You should get a display like the following:

This tells you that you are connected to the Internet and have a valid Internet address. In this case the valid address is 157.201.194.187. This address has been assigned by your Internet router.

Tip

Generally there are two types of IP addresses that your board can be assigned: one is called static and the other dynamic. In the static case you will always be assigned the same address. In the dynamic case, the address may change each time the system boots, as it asks the system for an address, which it then uses for that session. 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. To learn more about DHCP, try http://www.teracomtraining.com/tutorials/teracom-tutorial-dynamic-IP-addresses-and-DHCP.htm.

Once you get here, you'll want to update your operating system. Type in sudo apt-get update. The system will prompt you for the [sudo] password, which is the same as the password you have already been using. Once you enter this, the system will automatically go out and find all the updates 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.

Engage thrusters

Now that you are connected to the Internet and have updated your Ubuntu system, you need to install a graphical user interface. Ubuntu generally comes with a very full-featured windowing system. However, it uses a good deal of memory and can interfere with the performance you may need later. So you are going to install a "light" Windows system on top of your Ubuntu distribution. There are several choices; I like to use Xfce. It is stable, seems to work well, and offers a fairly complete set of capabilities while not overwhelming your system resources. To install this, type sudo apt-get install xfce4 in the command prompt. Again, the system will prompt you for your password and then start the install. This install will take a significant amount of time as it is installing not only the windowing system, but a number of packages the windowing system depends on.

Just a brief note about installing SW. You will be using apt-get to install SW throughout this book. This is the command that Ubuntu 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 search 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 will find times when the SW you have installed will not function because of a dependency that the system does not know about.

Objective complete – mini debriefing

Once the Xfce Windows system is installed, reboot your system by typing sudo reboot. The system will go down and then should come back to the log-in screen. Log in, then type startx at the prompt. After some time the Windows system will come alive. The first time you run the system you will get Welcome to the first start of the panel and a prompt, which will ask you which setup you want for the first setup. Choose the User default config selection.

Then you will see the following screen:

If you see the mouse, then you are successful!

Classified intel

You're probably asking yourself why you didn't copy your image to the internal eMMC memory card instead of just leaving your card in the system. There are two reasons, really. The first is space. The 2 GB that are available in the eMMC is not sufficient to build many, if not most, of the projects you're going to be working on, so you'll need a card anyway. Second, you will find occasions where you want to start over from scratch. Using a card makes this very easy; the eMMC process is a bit more permanent. There are several sites that can show you how to create your Ubuntu system on the eMMC internal memory space, but I'm not going to cover that here. Unfortunately, there are some downsides to not using the eMMC internal memory space, the system will boot slower and you have the additional cost of the external card, but in the long run it will be worth it.

 

Accessing the board remotely


You now have a very usable Ubuntu computer system. You can use it to access the Internet, write riveting novels, balance your accounts—just about anything you could do with a standard personal computer. However, that is not your purpose; you want to use your embedded system to power your delightfully inventive projects. In most cases you won't want to connect a keyboard, mouse, and display to your projects, as you will want to keep your robot sizes small and maneuverable. However, you still need to communicate with your device, program it, and have it tell you what is going on when things don't work right. You'll spend some time on this task establishing remote access to your device.

Prepare for lift off

To complete this task you'll need to have your external PC connected to the LAN, other than that, you are ready to go.

Engage thrusters

There are three ways you are going to access your system from your external PC:

  • The first is through a simple terminal interface using the SSH protocol.

  • The second way 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, if you are using Microsoft Windows on your remote computer, I'll show how you can transfer files via a program called WinScp, which is custom made for this purpose.

So, first, make sure your basic system is up and working. Open a terminal window and check the IP address of your unit. You're going to need this no matter how you want to communicate with the system. You do this by issuing the ifconfig command. You should get something that looks like this:

You'll need that "inet address" to contact your board via the LAN connection. First, let's configure an SSH terminal from your remote computer. 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 without the Windows system. In order to do this, you need to have an SSH type application on your remote computer. If you are running Microsoft Windows, you can download such an application. My personal favorite is PuTTY. It is free and does a very good job of allowing you to save your configuration so that you don't have to type it in each time. Type putty in a search window, and you'll soon come to a page that supports a download, or you can go to www.putty.org.

Download PuTTY to your Microsoft Windows machine. Then run PuTTY by going to the directory where it has been placed and double-clicking on the file putty.exe. You should see a configuration window. It will look something like this:

Type the inet address from the previous page in the Host Name space and make sure the SSH selection is highlighted. I save this configuration under BeagleBone so that I can load it each time.

When you press Open, the system will try to open a terminal window onto your BeagleBone Black via 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 login prompt.

Now you can log in and issue commands to your BeagleBone Black. If you'd like to do this from a Linux machine, the process is even simpler. Bring up a terminal window and then type ssh ubuntu@157.201.194.187 –p 22. This will then bring you to the login screen of your BeagleBone Black, which should look similar to the preceding screenshot.

SSH is a really useful tool to communicate with your BeagleBone Black, and I use it extensively. However, sometimes you need a graphical look at your system, and you don't necessarily want to connect a monitor or a small LCD display. You can get this by using an application called vncserver. First, let's install a version of this on your BeagleBone Black by typing sudo apt-get install tightvncserver in a terminal window on your BeagleBone Black. This is a perfect opportunity to use SSH, by the way.

Tightvncserver is an application that will allow you to remotely view your complete windows system. Once you have it installed, you'll need to start the server by typing vncserver in a terminal window on the BeagleBone black. You will then be prompted for a password as shown in the following screenshot:

This can, and should be a different password than your password to access your BeagleBone Black. 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 my Windows system I use an application called Real VNC. When I start it up it gives me the following screen:

Enter the VNC Server address, which is the IP address of your BeagleBone Black, with a :1 after it, and select Connect. You will get this pop up:

Type in the password you just entered while starting the vncserver, and you should then get a graphics view of your BeagleBone Black. Hopefully that looks like this:

You can now access all the capabilities of your system, albeit they may be slower if you are doing graphics-intensive data transfers. You'll see this as you work through your projects.

There are ways to make your vncserver on your BeagleBone Black start automatically on boot. I have not used them; I choose to type the command vncserver from an SSH application when I want the application running. This keeps your running applications to a minimum and, more importantly, provides for fewer security risks. If you'd like to start your vncserver each time you boot, there are several places on the Internet that will show you how to configure this. Try http://www.havetheknowhow.com/Configure-the-server/Run-VNC-on-boot.html. You will only have to type the password the very first time you start vncserver—it will remember it after that. You also do not need to start Xfce using the startx command on your BeagleBone Black for it to come up in the VNC viewer to start its view onto the graphical interface.

Tip

Vncserver is also available via Linux.

The final piece of SW I like to use with my 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 dialogue box:

Select New, and you will get the following screen:

Here you fill in the IP address in the host name, ubuntu in the user name, and the BeagleBone Black password (not the vncserver password) in the password space. Press log-in and you should then see the application displayed:

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

Objective complete – mini debriefing

Once you've completed this step, you can now access your system fully remotely without connecting a display, keyboard, and mouse. Now your system will look like this:

You only need to connect the power and LAN. If you need to issue simple commands, you'll 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 have the toolkit you need to build your first capabilities.

Classified intel

One of the challenges of accessing the system remotely is that you need to know the IP address of your board. If you have the board connected to a keyboard and display, you can always just run ifconfig to get this info. But you're going to use the board in many applications where you don't have this information. There is a way to discover this by using an ipscanner application. There are several available for free; simply download and use as they instruct. They can let you know what addresses are being used, and this should then let you find your BeagleBone Black address without typing ipconfig. From Linux you can use an application called nmap.

 

Mission accomplished


Congratulations! You've completed the first stage of your journey. You have your BeagleBone Black 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, and you're going to find yourselves coming back to this project from time to time to revive your board when it dies, because your SW has put it in some unrecoverable state.

Generally it is difficult to physically harm the board as long as you are only using the USB interface, so be brave, and remember, you often learn more from your failures than your successes.

 

A challenge


Your system has lots of capabilities. Feel free to play with the system—try to get an understanding of what is already there and what you'll want to add from a SW perspective. One advanced possibility is to connect the BeagleBone Black via a wireless LAN connection, so that you don't have to connect a HW connection when you want to communicate with it. There are several good tutorials on the Internet. Here is a place to start, http://elinux.org/Beagleboard:BeagleBoneBlack. If you have the desire, feel free to follow them to see if you can get a wireless LAN connection working.

Remember, there is limited power on your USB port, so make sure you have a powered USB hub before having a go. Usually you'll need a powered USB hub that can supply power greater than 1 amp.

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 (1 reviews total)
BeagleBone Robotic Projects
Unlock this book and the full library FREE for 7 days
Start now