Software apps and online services
The original BeagleBone Black doesn’t have integrated Wi-Fi capability included. There are a couple of options to provide the board with wireless internet capability. One is to connect it to a bridge repeater (which is a device with the same construct as a wireless network router), as show in Figure 1, that is battery powered to let the BBB be mobile for projects were mobility is required. The downside of this solution is that that it is very bulky, expensive and consumes significant amounts of power. Another method is to purchase a USB Wi-Fi Card that works out of the box with Debian in the BBB. This option is excellent when internet speed and bandwidth is not a priority, it also a low cost. The downside with this solution is that the signal reception and transmission is very weak and, in my experience, not very reliable, it also takes up a USB port, which can be solved by adding an externally powered USB Hub. The last option is using a USB Wi-Fi adapter meant to have good transmission and reception power (with a high-gain antenna) as shown in Figure 2, the advantage on this device is that it gets a stable connection and is relatively low priced. One of the major disadvantages is that there are no drivers on the BeagleBone’s Debian version right out of the box (and many other Linux distributions), therefore, they need to be downloaded and compiled (if you can find open-sourced drivers).
To follow this guide successfully it’s assumed that the following list have been gathered/followed prior to starting.
- BeagleBone Black board (original with no Wi-Fi) powered through the barrel connector, 5V and at least 1 amp
- tp-link – Archer T2U Plus – AC600 High Gain Wireless Dual Band USB Adapter
- Follow the instructions in the following link that I have posted in hackster.io: https://www.hackster.io/ederfernandotorres3/setup-beaglebone-black-with-device-tree-overlays-9e0ded
For all the commands that will be run on the BBB terminal, a quick explanation of what the command does or a side note can be given before or after the command. For example:
sudo apt update
Fetches the updated catalog for current installed programs.
Don’t expect to be commanded to “type” or “enter” before the command.Keywords and Glossary
- Build: in C, the build process is the complete process of converting the high-level source code representation of your embedded software into an executable binary image
- Compile: is one of the steps of the building process, it converts high level language file into an object file, but it still needs to be linked or “glued” to libraries that the C code might have used. Since in this tutorial we don’t deal with object files, if the words “compile the code” are used, it’ means “build the code”
- Ethernet: is a type of communication protocol that connects computers within what’s called a “local area network (LAN)” or “wire area network (WAN)”. The connector used for this type of network is an RJ45 connector. The cables used for this network is called an “ethernet cable”
- GitHub: is a distributed version-control platform where users can collaborate on or adopt open-source code projects, fork code, share ideas and more
- IP Address: is a unique string of characters (set of numbers) that identifies each computer using the Internet Protocol to communicate over a network. Example of IP Address: 192.168.1.23
- Kernel: is a computer program at the core of a computer’s operating system and generally has complete control over everything in the system, it facilitates interactions between hardware and software components.
- Linux-Headers: is a package that provides the Linux kernel headers which are installed separately from Linux. They define function declarations contained in the kernel to be used on userspace programs. Programs that require kernel or hardware functionality need to be compile with these Linux-Headers
- Make: is a Linux command used to build and maintain groups of programs and files from the source code
- Makefile: it’s a special file that contains the shell commands needed to maintain the project. It defines targets and contains flags that will determine the specific configuration of the building process
- Single Board Computer: is a complete computer built on a single circuit board, with microprocessor, memory, input/output and other features required of a functional computer.
The following listed commands are needed to update the kernel in the BeagleBone
1. Update the app catalog
sudo apt update
2. Install the updated apps
sudo apt upgrade
3. Go to the folder where BBB scripts are located
4. Run git pull
git pull || true
This command will use git to make sure that this folder is up to date
5. Update the kernel
This command will run the script to update the kernel. Enter the password if you are asked to
6. Reboot the system
2. --------Install Linux-Headers and other apps---------
These are the steps needed to be done before compiling and installing the adapter’s drivers in the BBB. In this section we make sure that the BBB has all the required software installed such as the kernel’s header files, compiler, framework and a version control system need to download the source code from its repository.
1. Install linux-headers
sudo apt install linux-headers-$(uname -r) <- $(uname -r)
This command will install the current Linux-headers. These headers will be needed if you are compiling software that use functions that the Linux kernel provides.
2. Install bc
sudo apt install bc
This command installs a basic calculator needed by the source code.
3. Install build-essential
sudo apt install build-essential
Build-essential is a “meta-package” that will install programs needed to compile C/C++ programs such as GNU C compiler, etc.
4. Install dkms
sudo apt install dkms
dkms is a framework that enables generating Linux kernel modules
5. Install git
sudo apt install git
Git is a version control system, it lets you download files from GitHub in this document (and other functions that we won’t be using in this guide).
Optional: Install all packages using one command.
sudo apt install bc build-essential dkms git
Note: It excludes the Linux-Headers
In this step we will be downloading the source files of the Wi-Fi adapter driver. Instructions to compile the drivers for different systems are included in a file named README, this guide is based on that file. There is a file named “Makefile” that contains the instructions for the compiler on how to build the code. The maintainers of this source code in GitHub have included flags in the Makefile to choose the target machine that it’s being built for, for example, you can change the flag of “CONFIG_PLATFORM_I386_PC” from “n” to “y” to tell the compiler to build executable code for an Intel x86 compatible processor. The BBB is not in the list of platforms, but there is one for the 32-bit Raspberry Pi, which runs in an ARM processor just like the BBB, and the endianness and other settings are the same, so we can select the “CONFIG_PLATFORM_ARM_RPI” as the flag for the BBB and it will work.
1. Create a new directory
Command creates a directory to hold the downloaded driver, I will call mine “wifi_driver”.
2. Go the new directory
3. Get the source code using git
git clone https://github.com/morrownr/8821au-20210708.git
The git command above will copy the source code found in GitHub into the directory was just created
4. Go into 8821au-20210708
This will change the current directory to the one that was just created
5. Modify the Makefile in order to build for the BBB
5a. Open and modify Makefile
sudo nano Makefile
Look for the section labeled “Platform Related”
5b. Disable CONFIG_PLATFORM_I386_PC:
Change: “CONFIG_PLATFORM_I386_PC = y” to “CONFIG_PLATFORM_I386_PC = n”
5c. Enable CONFIG_PLATFORM_ARM_RPI:
Change: “CONFIG_PLATFORM_ARM_RPI = n” to “CONFIG_PLATFORM_ARM_RPI= y”
5d. Press on your keyboard: “ctrl” + “x” then “y” and then “enter” to exit and save changes.
6. Run the install script
6a. Run install-driver.sh.
The above installation will take a few minutes (around 25). This file automatically runs the “make” command and prints messages to the console to make the installation more “human interactive”
6b. After it finishes compiling and installing, it will ask if you want to edit the driver options, you may click “n” for no.
6c. You will be asked if you want to reboot, type “y” and then “enter” if you are not prompted. Type: “sudo reboot”
7. Now you may connect the Wi-Fi card to the USB port, make sure your BBB is connected to the 5V barrel connector with at least 1A of current4. ------Configure the Wi-Fi Connection------
1. Run connmanctrl
Connmanctl is a utility that facilitates the connection to a wireless network in an easy manner.
2. Enable the Wi-Fi function on the beaglebone
You might get an error that the Wi-Fi is already enabled, this is fine.
3. Scan for Wi-Fi to see whatconnections are available
Wait until Connmanctl it says that it has completed.
4. List all networks that were found by the previous command
The "services" command shows the list of the scanned networks.
5. Turn on the agent to enable the wireless agent to enter the wireless network passphrases
6. Connect to your network
connect <id of the network>
The “id of the network” is the string of letters after the SSID (name of the Wi-Fi connection), it starts with “wifi_”. For example, to connect to jinjed2022, I would have to type: “connect wifi_984827ebd889_6a696e6a656432303232_managed_psk”
7. You will be asked for a passphrase, type it
8. To verify that the previous steps worked, the command "services" is needed
You should see “*A0” or “*AR” next to the desired Wi-Fi connection.
9. Exit Connmanctl
10. Check the information about network connections by using "ifconfig"
Ifconfig command is used to view network connections on Linux (and can be used to change the configuration of the network interfaces)
11. Find the wlan0 connection. Write down the IP address (inet), in my case its private IP address is 192.168.1.151
12. Shut down the BBB
sudo shutdown now
Shut down the BBB and disconnect the Ethernet cable if that’s how you are connecting into the board.
13. Turn on the BBB with the USB Wi-Fi card connected
It might take longer than before to boot up. Remote in with the IP address gathered in Step 11. If it doesn’t connect, go to this guide: https://www.hackster.io/ederfernandotorres3/setup-beaglebone-black-with-device-tree-overlays-9e0ded. And go to section where it explains how to use IP Scanner to find the new IP address of the BBB
14. Test the internet connection
The above command tests if the BBB can connect to the internet by sending/receiving packages to/from google.com.
15. Press “CTRL” and “c” on your keyboard to stop pinging google.com-----------------Conclusion-----------------
This guide can be used to give the BBB Wi-Fi capabilities. This can facilitate in projects where a wired connection does not work, and the bulky solution of a bridge repeater is not an option, or it might be too expensive. This solution can be used on mobile robots or sensor nodes that are apart from the router. The bandwidth of this solution is good to send video feed in HD (or smaller resolution for a more resilient connection).--References and Additional Information--