Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
BeagleBone Robotic Projects

You're reading from   BeagleBone Robotic Projects Build and control robots that walk, swim, roll, and fly

Arrow left icon
Product type Paperback
Published in Jun 2017
Publisher Packt
ISBN-13 9781788293136
Length 230 pages
Edition 2nd Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Richard Grimmett Richard Grimmett
Author Profile Icon Richard Grimmett
Richard Grimmett
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started with the BeagleBone Blue FREE CHAPTER 2. Programming the BeagleBone Blue 3. Making the Unit Mobile - Controlling Wheeled Movement 4. Avoiding Obstacles Using Sensors 5. Allowing Our BeagleBone Blue to See 6. Providing Speech Input and Output 7. Making the Unit Very Mobile - Controlling Legged Movement 8. Using a GPS Receiver to Locate Your Robot 9. By Land, By Sea, By Air 10. System Dynamics

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 192.168.7.2. 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 10.35.164.187. 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 8.8.8.8. 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 255.255.255.0, 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:10.35.164.187. 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 [email protected] -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 https://arazblog.wordpress.com/2014/06/22/how-to-setup-vnc-server-on-beagle-bone-black-debian/.

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 http://www.tightvnc.com/. 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.

You have been reading a chapter from
BeagleBone Robotic Projects - Second Edition
Published in: Jun 2017
Publisher: Packt
ISBN-13: 9781788293136
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.
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 $19.99/month. Cancel anytime
Banner background image