Beaglebone: Robotics Using the Beaglebone Black

Andrew B. Wright, Ph. D., SM ’88


Next Post: Beaglebone: remoteproc “Hello, world!”

UALR’s Vmware client

This is a blog about my experiences getting a Beaglebone Black up and running.  I am retrofitting my CASSY robotics project from the Vex PIC Microcontroller to something else.

The Beaglebone Black (rev. C) is an extension of the work that Traig Born did on the J5 robotics platform.  It is an embedded linux platform, so I’m more comfortable with maneuvering on it than on the Cortex.  It has lots of user community support.

The work that I did in programming the ABWComm GUI for the Vex is directly translatable to the Beaglebone.  For instance, all the bluetooth work can be ported directly.  So, that learning curve ought to be a bit flatter than trying to get the serial Bluesmirf ported over to the Cortex.

In this blog, there are a total of four processors/systems in play:

the host computer (in my case a mac mini running osx)

the beaglebone arm processor running debian linux

programmable real time unit 0 (pru0) on the beablebone

programmable real time unit 1 (pru1) on the beablebone

Hardware to purchase to get started:

microSD card and adapter (example: sandisk extreme plus, 64 Gb) various
HDMI cable
wifi-dongle (Realtek RTL8188CUS)
host computer running osx for what I’m doing
cat5 cross-over cable
beaglebone power adapter
usb keyboard/mouse combo
beaglebone black rev. C
usb ethernet port
wireless access point various
  1. Update the Beaglebone to the latest debian!  The Beaglebones that I received had an older version on them, and many things don’t work the same as the newer version.  Things like pwms and internet, especially wi-fi.

Steps to install debian:

a. Download the latest image onto the host computer (

b. Unpack the file.  On osx, you will need to get “The Unarchiver” from the app store.

c. Copy the img file to a micro-sd drive.  The easiest way is to use “pi filler.”  Even though “pi filler” was designed for the Raspberry Pi, it works for Beaglebone.

I’ve found that pi filler doesn’t work on every OSX.  Another way to get the image onto the SD card is to use a low level write command.

First, you need to locate the SD card.  Open a terminal on the OSX machine, and look for the disk devices on the machine.  Type

ls /dev/disk*

Plug in the SD card, wait a bit, and then repeat the above command.  The new disk is your SD disk.

In my case, it was located at /dev/disk2 with a partition /dev/disk2s1.

The next command is a very, very dangerous command to run.  If you pick an incorrect disk (e.g., your hard drive), you will wipe the contents.  Make sure you back up your data before running the command.  Make absolutely sure you have the right disk.  Make sure you enter the command correctly before hitting enter.

In order to get the dd command to work, you will first have to unmount the file system partition (not eject which will remove the /dev entry).

diskutil unmount /dev/diskNsM

where N = your disk number (2 in my case) and M is the partition number (1 in my case).

The command to write the img to your disk is:

sudo dd if=<path to your img> of = /dev/diskN bs=1000

 where <path to your img> is the location of your image file. The parameter bs is the block-size. This can be a lot of different numbers (e.g. 1, 1000, 1M).  This will affect the time of the write.

d. Connect the Beaglebone to a monitor (through the HDMI cable) and keyboard/mouse.

e. Insert the micro-sd into a beaglebone and start it up.  You have to hold down the “user boot” button to get the BBK to boot off the sd card.

You can get to a shell by typing ctrl-alt-F5.  Login to the shell using debian:temppwd.  Set up a root password by typing “sudo su”  at the command prompt, using temppwd as the password.  Type “passwd” to set the root password.  Type in your desired root password twice.

Once you’ve booted to the sd image, edit the file ‘/boot/uEnv.txt’ (sudo nano /boot/uEnv.txt) and uncomment the line ‘cmdline=init=/opt/scripts/tools/eMMC/’ at the bottom of the file.

e. Reboot the Beaglebone off the micro-sd card as before.  Now, after a little bit, the LEDs will start to flash in a sequence which has been described as similar to a cylon’s eye.  Wait some time (30 minutes?) until the Beaglebone shuts back down.

f. Remove the micro-sd drive and reboot normally.  You will now be live with the latest debian.

Any data and config files you had on the Beaglebone before this upgrade will be wiped clean.  Back up before you start this process.  Either manually replace the key files or set up a script to replace things after the update has completed.

2. Establish a basic wired network connection with host name access! Connect the beaglebone to a monitor and keyboard.  Boot up.  You will be logged in as the debian user.  

Type ctrl-alt-F5 to get to a terminal login (this is quicker).

You should see a full screen with a login prompt.  Use debian:temppwd to login.

Type uname -a to determine your OS version.  When you look for beaglebone tips on the internet, be aware that there are huge differences based on kernel.  This blog is based on 4.4.30-ti-r64 4.4.54-ti-r93 kernel.

Set the root password with sudo su (use temppwd as the password).  Type passwd and enter the desired root password twice.

Switch directories to /etc/ssh, and edit sshd_config with nano.  Change the line “PermitRootLogin without-password” to “PermitRootLogin yes” and restart sshd with “service ssh restart.”  This will allow you to ssh into the box as root using the new root password.

Connect a cat5 crossover cable between the beaglebone and the ethernet port on a host computer.  I’m going to use a mac in this example.  Linux and windows will have similar features.

On the host, open network preferences on the host computer.  Under Ethernet, set up preferences to Manually.  Enter IP Address  Enter Subnet Mask Leave Router blank.  Under Advanced, DNS, enter the IP of your dns server.  If this is on another network, like wifi, which is how I’ve configured my home network, leave network settings (remember to apply them!) and go to Sharing.

Share connection from Wi-Fi To computers using Ethernet.  Turn Internet Sharing on.  When you make changes on the Beaglebone, you may have to turn sharing off and back on to get things to work .  There are files on the host computer that store settings that need to get refreshed.

NOTE: I need to revisit this using my ethernet/usb port so that this can be consistent for all interfaces.  I need to update the purchase list to include this item.

On the Beaglebone, make yourself root by typing su and entering the root password set up above.

The first time, you will have to create a root password by typing sudo passwd root.  It will prompt you for a password.

Enter connman by typing


At the prompt, enter

connmanctl> technologies

Make sure you have ethernet.

At the prompt, enter

connmanctl> services
connmanctl> config ethernet_long.number_cable --ipv4 manual <ip> <nm> <gt>
connmanctl> config ethernet_long.number_cable ---nameservers
connmanctl> quit

The ip address (<ip>) might be something like Net mask (<nm>):, Router/DNS (<gt>):

The nameserver is the name of your name server on your host computer (e.g.

There are two users into the beaglebone initially


root:no password (unless you added a password above)

Open a terminal and log into the beaglebone via ssh using the ip addr set in step 2 in this example).

ssh -l root -Y

You should be prompted for your root password.

If this works smoothly, then you can disconnect the beaglebone from the monitor and keyboard and proceed from the mac host.

On the beaglebone, check for internet connectivity.  For instance, “ping” will let you know that your beaglebone is able to resolve names and connect to them if it executes successfully.

3. Update the system! Once you have internet connectivity, update the system. As root, type

apt-get update

apt-get upgrade

Once the system is upgraded, you should have the latest wifi drivers. This will make it much easier to get wifi connectivity.

I have occasionally run into trouble at this step.  I’ve had to ctrl-Z to stop a process and then do a dpkg –configure -a.

5. Get back to basics and free some disk space! Check your available disk space and clean out unneeded packages.

df -h

This will tell you how much (little) space you have in bytes.  At this point, I show 85% full on the beaglebone’s drive space.

Determine what packages are installed:

dpkg --get-selections | grep -v deinstall

Remove packages that you do not need and clean the cache:

apt-get remove info

apt-get remove chromium-browser

apt-get remove vim vim-common vim-runtime

apt-get remove qupzilla

apt-get remove doc-beaglebone-getting-started

apt-get remove doc-beaglebonegreen-getting-started

apt-get remove doc-seeed-bbgw-getting-started

apt-get remove gnuplot gnuplot-data gnuplot-tex gnuplot-x11

apt-get remove samba

Remove files the system knows it doesn’t need and clean the cache:

apt-get autoremove

apt-get clean

At this point, I’ve reduced to 83%.

Do you need all the development tools?  python, gcc, and ruby might be optional, depending on your usage.  If you’re playing around, you probably want to keep them.

I got rid of ruby

apt-get remove ruby

Follow with apt-get autoremove and apt-get clean.

Do you want to run a web server on your beaglebone?  If not, apache2 can go.

Will you use bluetooth?  If not, bluez can go.

There are a number of packages to support the old-style beaglebone … pruss and capes support.   There are some video drivers that shouldn’t be needed.

If you’re going to do any development, the nano text editor will drive you crazy.  It’s better to edit remotely and copy back to the beaglebone.  Two editors that give you more development power are gedit and emacs.  I haven’t used emacs in years and my memories of the beast are not fond.  But, if you can free the space, pick one of these to help in development.

I added emacs

apt-get install emacs

If you use any application that requires Xorg on the beaglebone, you need to install Xquartz on an osx system so that you can use the app over ssh.

Another place to go for space is under /usr/share/man.  There are man files in languages other than your preferred language.  You don’t need these.  They have to be manually deleted (rm -rf /usr/share/man/ko for example).

I would autoremove, clean, update, and upgrade at this point.

5. Get the beaglebone onto a wireless network! (see here for an early version of this stuff.  There may be some worthwhile stuff still there, but it’s not that relevant now.).

In the latest debian, connmanctl is the way to get the wireless network working.

Plug the wireless dongle into the usb port.  Probably use a cable to keep the interference between the beaglebone and the dongle at a minimum.

Make sure the adapter was detected:


Make sure the drivers were loaded:

lsmod | grep

You can find the linux driver name from the internet by searching for your card name (found in lsusb) and “linux lsmod.”

You can find details of the wifi using iwconfig.  This will tell you the name of your device.  I’m assuming wlan0.

Connman settings are located in /var/lib/connman/settings and /etc/connman/main.conf.

Restart connman with

systemctl restart connman.service

How it’s supposed to work:

connmanctl technologies

show what technologies are available.

Turn off tethering (now the default, so this may be redundant) with

connmanctl tether wifi off

Scan for available networks (now the default, so this may be redundant) with

connmanctl scan wifi

Wait until connman returns “Scan completed.”  Once the scan is complete,

connmanctl services

tells you which services are available.

Look for the service that represents your access point.  It will be something like:


Enter connman by typing “connmanctl” without arguments.  If your wireless network has a passkey, you will need to perform these steps to get onto the wireless network the first time:

connmanctl> agent on

connmanctl> connect wifi_<long.number>_managed_psk

You will be prompted for the network’s passkey.

If all goes well, then you will get a message indicating that you’re connected.  This persists through reboots.

Type ‘quit’ at the prompt to exit connmanctl.

Depending on the network, you may need to assign parameters manually, rather than through dhcp.

connmanctl> config wifi__managed_psk --ipv4 manual <ip> <nm> <gt>
connmanctl> config wifi__managed_psk --nameservers <ns>

For example: <ip> =, <nm> =, <gt> =, <ns> = ip of your access point.

These config commands allow things to be manually set.

To view what you’ve done, from the command prompt type:

connmanctl services wifi_<long.number>_managed_psk

and you will see all the settings for this service.

This does survive reboots.

6. Wifi can be droppy … fix it! Get wifi to restart when it drops using cron.

Create a file, and make it executable “chmod a+x”.  This file should contain the following code:

d=$(date +%H%M%S)
if [ $(connmanctl state | grep -c "online") = 0 ] && 
[$(connmanctl state | grep -c "ready") = 0] 
     echo "not good"$d >> /root/test.txt 
     connmanctl disconnect wifi_long.number_managed_psk 
     connmanctl connect wifi_long.number_managed_psk 
     echo "good"$d >> /root/test.txt 

At this point, the state “online” might be too strict and a state of “ready” might be acceptable. The state “online” indicates connectivity as determined by actual connection to (or if that’s how you’re rolling).

Get this code to execute every five minutes using cron.  Enter the editing mode by typing “crontab -e”.  When prompted (first time only) pick your editor (e.g. emacs).

Enter the following line:

*/5 * * * * sh /root/

Save and exit.  Cron will call every 5 minutes.  If connmanctl shows that wifi is down, it will automatically disconnect and then reconnect.  It will put an entry into test.txt regardless.  These lines aren’t necessary, so they can be commented out.

7. Test programming on the arm


#include <stdio.h>

printf("hello, world\n");


hello: hello.c
gcc hello.c -o hello

Compile by typing “make hello” at the command prompt.

8. Access an LED from the arm

#include <stdio.h>
#include <unistd.h>

int main(){

FILE *fp = NULL;
int i;
const char *LED = "/sys/class/leds/beaglebone:green:usr0/brightness";

for (i=0;i<5;i++){
	if((fp = fopen(LED, "w")) != NULL){
	if((fp = fopen(LED,"w")) != NULL){


	gcc LED.c -o LED

I was reminded in makefile editing that the indented line needs to use a tab character, rather than spaces.

9. The PRU c-compiler is installed by default in the latest debian.  It lurks in /usr/bin. The header files are located in /usr/share/ti/cgt-pru/.

A nifty command to issue from the command line:

tar -zcvf beaglebone-"$(date '+%y-%m-%d').tar.gz" code3

allows you to pack up your code into an archive with a date stamp in the file name.

From the host computer

scp root@<beagle-ip>:*.gz .

will bring the file onto the host computer (where beagle-ip for this example is


After installing debian, the OS will be continually tinkered with.  You will need to update (and update and update …).  It is not practical to reinstall with each update.

apt-get update

apt-get upgrade

apt-get autoremove

apt-get dist-upgrade

apt-get install linux-image-armmp (reboot?)

uname -a


I’m still fooling around with the wireless internet connectivity on my beaglebone.  There are continued quirks.  I’ve had issues with the system connecting on the initial boot.  If it misses, then it’s silent.

I pulled out an old linksys wireless-g access point which I had lying around and connected it to my mac using a usb-ethernet adapter.

With this topology, I’ve been able to connect my beaglebone wirelessly from ‘bone to linksys and thence from linksys to ethernet.  This topology allows me to replicate on whatever connection the mac makes to the world.  At my house, the connection is wireless.  At my office, the connection is wired.



This blog is going to be the starting point for the information to participate in that class.

7/11/2015 (this is pretty obsolete now)

For now, I’m working on my mac mini as the host.  Rather than connecting the Beaglebone to peripherals, I started using the USB connection.  The first problem I encountered was that the usb didn’t want to use my mac’s dns.  I’m pretty sure I have to bridge the beaglebone connection to the mac’s wifi, but this proved difficult.  I used a crossover cable to attach the BBB’s ethernet to the mac’s ethernet and bridged that connection. (NOTE:  in a later blog, I talk about how to change the beaglebone’s ip settings to use, the only ip that osx seems to want to allow to bridge by default.)

The way into the BBB is to ssh -Y -l root 192.168.x.y where x is either 2 or 7, depending on the connection (2=eth0, 7 = usb)  and y is usually 2.  The -Y switch allows me to use X and pop up graphical editing tools. It’s a little weird to command line as root anymore since my time in ubuntu.  However, unless I’m going to put the beaglebone on-line, it’s fine for an embedded application.  Actually, I discovered that accessing hardware requires root permissions (although it should be possible to play with groups and get other access).  Still, I’m in learning mode, so I might as well acquiesce and use root for now.

Posted in: Robotics
Read more about:

Comments are closed.