# Setting up WiFi with BeagleBone Black

## Overview

Warning: This guide has been deprecated and is now for reference only. See other sources for modern methods.

![](https://cdn-learn.adafruit.com/assets/assets/000/019/248/medium800/beaglebone_photo_2_%285%29.jpg?1409172887)

Have you been pulling your hair out trying to get WiFi working consistantly on a BeagleBone Black? &nbsp;Don't worry there are some easily solved problems&nbsp;that could be causing your WiFi grief! &nbsp;For example did you know the HDMI port can interfere with small WiFI adapter antennas? &nbsp;Or that you can upgrade the Linux kernel to improve WiFi driver stability? &nbsp;Follow this guide to learn how to avoid common&nbsp;pitfalls and configure your BeagleBone Black to work with a USB WiFi adapter!

Before you get started&nbsp;make sure you're running the [latest official Debian image](http://beagleboard.org/latest-images)&nbsp;on your BeagleBone Black. &nbsp; **It's very important to use&nbsp;the Debian operating system on your BeagleBone Black to follow this guide!** &nbsp; If you aren't familiar with how to install an operating system on the device, check out this handy [BeagleBone Black operating system install guide](../../../beaglebone-black-installing-operating-systems).

Also if you are new to the BeagleBone Black you will want to familiarize yourself with how to connect to it and interact with the command shell using SSH. &nbsp;[This guide will show you the basics of accessing the BeagleBone Black with SSH](../../../ssh-to-beaglebone-black-over-usb/overview).

# Setting up WiFi with BeagleBone Black

## Hardware

![](https://cdn-learn.adafruit.com/assets/assets/000/019/250/medium800/beaglebone_1012-00.jpg?1409175303)

To setup WiFi with your BeagleBone Black you'll need a&nbsp;USB WiFi adapter that&nbsp;is compatible with the BeagleBone Black's Debian operating system. &nbsp;Be sure to read the [BeagleBone Black wiki's list of known working WiFi adapters](http://www.elinux.org/Beagleboard:BeagleBoneBlack#WIFI_Adapters)&nbsp;and consider using&nbsp;a device from that list.

Unfortunately the choice of WiFi adapter for the BeagleBone Black is a little more&nbsp;complicated compared to other Linux boards like the Raspberry Pi. &nbsp;The BeagleBone Black's official&nbsp;Debian image&nbsp;uses an old version 3.8 of the Linux kernel compared to more recent versions like&nbsp;3.15+. &nbsp;Since WiFi drivers are typically included in the Linux kernel source, running an old kernel means running old and potentially buggy WiFi adapter drivers.

Out of the box&nbsp;the 3.8 kernel seems to have problems with popular WiFi adapters, like the Realtek-based adapters in the Adafruit store. &nbsp;In particular you might experience problems like the WiFi adapter randomly not connecting to a wireless network on boot. &nbsp;I'll show later in the guide that a simple script to reset the wireless adapter on boot greatly improves reliability of Realtek and other adapters on the BeagleBone Black.

If you're a more experienced Linux user you might be wondering if you can &nbsp;upgrade the Linux kernel to a later version like 3.14 or 3.15&nbsp;to get&nbsp;more reliable WiFi drivers. &nbsp;You can, but you need to be careful because later kernels right now don't support the same functionality, like [device tree overlays](../../../../introduction-to-the-beaglebone-black-device-tree/device-tree-overlays), as the 3.8 kernel. &nbsp;Kernel support beyond 3.8 is improving every day so you should search and consult the [BeagleBone Black support group](https://groups.google.com/forum/#!categories/beagleboard/beaglebone-black)&nbsp;for the latest&nbsp;information on kernel stability and feature support if you want to use a newer kernel. &nbsp;I'll show later in the guide how to make sure you're using the latest 3.8 version kernel so you're getting the most up to date drivers.

# HDMI Port&nbsp;Interference

One common issue&nbsp;with&nbsp;WiFi on the BeagleBone Black is poor performance from WiFi adapters with&nbsp;small internal antennas. &nbsp;The problem is that [the ground and power planes of the HDMI port are right below the USB port and dampen the WiFi signal](https://groups.google.com/forum/#%21topic/beaglebone/X7dXq4iSKvI). &nbsp;This will manifest as poor signal quality and reliability with small USB WiFi adapters that are very close to the USB port.

There are two ways to deal with this interference issue, one is to use a small [USB extension cable / adapter](https://www.adafruit.com/products/974)&nbsp;or [small USB hub](https://www.adafruit.com/products/961)&nbsp;(even an unpowered hub would work fine)&nbsp;to move the WiFi adapter farther away from the BeagleBone Black. &nbsp;For example the photo below shows a small hub&nbsp;that moves a tiny WiFi adapter away from the BeagleBone Black:

![](https://cdn-learn.adafruit.com/assets/assets/000/019/232/medium800/beaglebone_photo_1_%285%29.jpg?1409167532)

A second option is to completely disable the HDMI port by [manipulating the device tree](../../../../introduction-to-the-beaglebone-black-device-tree/overview). &nbsp; **This option is only possible if you do not need to output any video or audio signal over the HDMI port!** &nbsp;

Of the two options I would stick with the first, moving the adapter away from the board, since it's simpler and will still let you use the HDMI port. &nbsp;However if you can't move the WiFi adapter away you can follow the steps below to disable HDMI.

First&nbsp;connect your BeagleBone Black's USB port to your computer and [connect to it with SSH](../../../../ssh-to-beaglebone-black-over-usb/overview). &nbsp;Then mount and edit the uEnv.txt file that controls boot configuration by executing:

```
mkdir /mnt/boot
mount /dev/mmcblk0p1 /mnt/boot
nano /mnt/boot/uEnv.txt
```

You should see the nano text editor appear with the contents of the uEnv.txt file like this:

![](https://cdn-learn.adafruit.com/assets/assets/000/019/098/medium800/beaglebone_Screenshot_from_2014-08-25_00_29_11.png?1408951778)

Notice the lines in the middle that mention disabling HDMI:

```
##Disable HDMI
#cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
```

Remove the # in front of the cape\_disable command so it looks like:

```
##Disable HDMI
cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

```

 **Be careful to edit the correct line! &nbsp;If you disable the HDMI/eMMC line you might disable booting from the internal flash memory of the BeagleBone Black.**

Save the file by pressing **Ctrl-O** and then **Enter**. &nbsp;Finally quit nano by pressing **Ctrl-X**. &nbsp;Reboot your BeagleBone Black and it should have the HDMI port disabled.

If you need to enable the HDMI port again just edit the uEnv.txt file with the same procedure above and add the # comment back in front of the disable HDMI line.

# Power

Finally make sure you are powering your BeagleBone Black with a sufficient power supply to support your WiFi adapter. &nbsp; **Most computer or laptop USB ports do not supply enough power to support a BeagleBone Black and WiFi adapter!** &nbsp;

Make sure you're using a 5 volt power supply with at least 1 amp or more of current. &nbsp;You can plug a simple [external 5V power supply](https://www.adafruit.com/products/276)&nbsp;right into the BeagleBone Black's barrel jack. &nbsp;

Don't skimp on powering your device properly or else you will have instability and&nbsp;poor WiFi performance!

# Setting up WiFi with BeagleBone Black

## Configuration

Once you have the hardware setup you're ready to configure the BeagleBone Black to use your WiFi adapter.

# Kernel Upgrade

First you will want to make sure you're running the very latest version of the 3.8 series kernel. &nbsp;Like mentioned in the previous page,&nbsp;you want to use the most recent Linux kernel to get the most recent and stable WiFi drivers. &nbsp;Luckily you don't need to be a Linux expert to upgrade the kernel because a script is included with your BeagleBone Black's Debian installation&nbsp;to automatically upgrade to the latest stable 3.8 version kernel.

**In my testing I found upgrading the BeagleBone Black's kernel was mandatory to get reliable WiFi performance. &nbsp;Don't skip this step, be sure to upgrade the kernel!**

Make sure your device is connected to the internet (through the ethernet port for example), power it on, and connect to the terminal with SSH. &nbsp;Run the following commands to start the kernel upgrade:

```
cd /opt/scripts/tools/
./update_kernel.sh
```

You should see the script download a kernel image and perform the installation automatically. &nbsp;After a few&nbsp;minutes the uprade will complete and tell you to reboot your device. &nbsp;Follow the instructions and reboot by executing the command:

```
reboot
```

After the device reboots the kernel upgrade is complete!

# WiFi Reset Service

The next step is to install a small script that will reset&nbsp;the WiFi interface by bringing it down and back up again automatically on boot. &nbsp; **With the latest 3.8 kernel&nbsp;I found this reset script was necessary to get reliable performance with Realtek and some Atheros WiFi adapters, so don't skip installing it! &nbsp;** Later kernels or more stable adapters might not require the reset service, but it can't hurt to install it for them too.

To install the service connect again to the device in a terminal with SSH and execute these commands:

```
cd ~
ntpdate -b -s -u pool.ntp.org
apt-get update &amp;&amp; apt-get install git
git clone https://github.com/adafruit/wifi-reset.git
cd wifi-reset
chmod +x install.sh
./install.sh
```

After executing the install.sh script you should see a response like the following:

```
Installing wifi reset service to /opt/wifi-reset.
Installing systemd service to run at boot.
Enabling systemd service.
```

If you see an error message, go back and carefully check the commands above were executed.

That's all you need to do to install the wifi reset service!

Note that if you'd ever like to disable the WiFi reset service you can execute this command to do so:

```
systemctl disable wifi-reset.service
```

# WiFi Configuration

Finally it's time to configure the wireless connection for your BeagleBone Black. &nbsp;To start, power down the device completely and insert the WiFi adapter into the USB port. &nbsp;Remember the HDMI port can cause interference so you might need to use a small extension or hub to move your adapter away from the board!

Power up your BeagleBone Black and connect to it in a terminal with SSH, then run the following command to list any wireless interfaces available:

```
iwconfig
```

You should see a response with a wlan0 name and some details about the wireless adapter's capabilities. &nbsp;For example I see the following&nbsp;response for my adapter:

```
wlan0     IEEE 802.11bgn  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm   
          Retry  long limit:7   RTS thr=2347 B   Fragment thr:off
          Encryption key:off
          Power Management:on
          
lo        no wireless extensions.

eth0      no wireless extensions.

usb0      no wireless extensions.

```

 **Note that if you see a different name than wlan0, like&nbsp;ra0, take note of that name as it will be used in the configuration later.**

Now you'll edit the **/etc/network/interfaces** file to specify WiFi network connection details. &nbsp;Run the following command to open the nano text editor:

```
nano /etc/network/interfaces
```

You should see a file like the following appear:

![](https://cdn-learn.adafruit.com/assets/assets/000/019/099/medium800/beaglebone_Screenshot_from_2014-08-25_01_22_57.png?1408979345)

Notice there's a commented block showing a WiFi configuration example:

```
# WiFi Example
#auto wlan0
#iface wlan0 inet dhcp
#    wpa-ssid "essid"
#    wpa-psk  "password"

```

Configuring most WiFi networks is as easy as uncommenting the lines and filling in the details for your network. &nbsp;For example if I were connecting to a WiFi network with name "adafruit" and password "mypassword" I would edit the configuration to look like:

```
# WiFi Example
auto wlan0
iface wlan0 inet dhcp
    wpa-ssid "adafruit"
    wpa-psk  "mypassword"

```

If you're connecting to&nbsp;a more complex WiFi network, such as one with a 'hidden' SSID or that needs a static IP address, you might need to add more to the configuration. &nbsp;Check out the guide on [setting up WiFi with a Raspberry Pi](../../../../adafruits-raspberry-pi-lesson-3-network-setup/setting-up-wifi-with-occidentalis)&nbsp;as the configuration in **/etc/network/interfaces** is the same&nbsp;on the BeagleBone Black as the Raspberry Pi.

Also be aware that if you found the iwconfig command returned a different interface name, like ra0, you should change all references from wlan0 to the appropriate interface name.

Once you've modified the file, save it by pressing **Ctrl-O** and **Enter** , then press **Ctrl-X** to quit nano.

Now test the connection by running the following to bring up the WiFi connection manually:

```
ifup wlan0
```

Again change wlan0 to the name of your WiFi interface if you found it differed with the iwconfig command.

If the WiFi connection is made with your network you should see&nbsp;an IP address acquired with DHCP:

```
Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/e8:de:27:11:62:7c
Sending on   LPF/wlan0/e8:de:27:11:62:7c
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.1.1
DHCPACK from 192.168.1.1
bound to 192.168.1.127 -- renewal in 36491 seconds.

```

The exact response might differ, but the important thing is that you&nbsp;receive a DHCPOFFER response and are&nbsp;assigned an IP address. &nbsp;

You can also confirm the BeagleBone Black is connected to the&nbsp;network&nbsp;by running the following command to list network details:

```
ifconfig wlan0
```

If your device is connected to the network&nbsp;it should show connection details with an IP address (192.168.1.127 in my case)&nbsp;like:

```
wlan0     Link encap:Ethernet  HWaddr e8:de:27:11:62:7c  
          inet addr:192.168.1.127  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::eade:27ff:fe11:627c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15413 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3301 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:21575587 (20.5 MiB)  TX bytes:323282 (315.7 KiB)

```

Finally you can test&nbsp;internet access by trying to ping a website such as adafruit.com by executing:

```
ping adafruit.com
```

You should see successful ping responses such as:

```
PING adafruit.com (207.58.139.247) 56(84) bytes of data.
64 bytes from vps3.ladyada.net (207.58.139.247): icmp_req=1 ttl=52 time=86.1 ms
64 bytes from vps3.ladyada.net (207.58.139.247): icmp_req=2 ttl=52 time=85.8 ms
64 bytes from vps3.ladyada.net (207.58.139.247): icmp_req=3 ttl=52 time=87.0 ms
64 bytes from vps3.ladyada.net (207.58.139.247): icmp_req=4 ttl=52 time=87.8 ms
64 bytes from vps3.ladyada.net (207.58.139.247): icmp_req=5 ttl=52 time=86.1 ms
64 bytes from vps3.ladyada.net (207.58.139.247): icmp_req=6 ttl=52 time=86.7 ms
64 bytes from vps3.ladyada.net (207.58.139.247): icmp_req=7 ttl=52 time=86.5 ms

```

Press **Ctrl-C** to quit the ping application.

If any of the checks above fail or indicate no network access, carefully check the details in the **/etc/network/interfaces** file are correct for your wireless network and try again.

Now the final test is to reboot your BeagleBone Black&nbsp;to verify the wireless connection is made automatically. &nbsp;Execute the following to reboot the device:

```
reboot
```

Once the device has rebooted, connect to it in an SSH session and&nbsp;run the network connection tests above again. &nbsp;If they show you're connected to the network, congratulations you've successfully configured your BeagleBone Black to work with WiFi!

If the device fails to connect on boot, try running the following to manually reset the WiFi connection:

```
ifdown wlan0
ifup wlan0
```

Again changing wlan0 to match the name of the interface you found earlier.

If the ifup command fails to get an IP address, go back and check the WiFi network details in **/etc/network/interfaces** are correct for your network and try again. &nbsp;If you still can't get a connection to work, try posting details about the WiFi adapter you're using and the error or issue you're hitting on the [BeagleBone Black support group](https://groups.google.com/forum/#!categories/beagleboard/beaglebone-black)&nbsp;or the [Adafruit forums](http://forums.adafruit.com/).


## Featured Products

### Miniature WiFi (802.11b/g/n) Module: For Raspberry Pi and more

[Miniature WiFi (802.11b/g/n) Module: For Raspberry Pi and more](https://www.adafruit.com/product/814)
Make your Internet of Things device cable-free by adding WiFi. Take advantage of the Raspberry Pi and Beagle Bone's USB port to add a low cost, but high-reliability wireless link. We tried half a dozen modules to find one that works well with the Pi and Bone without the need of recompiling...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/814)
[Related Guides to the Product](https://learn.adafruit.com/products/814/guides)
### USB WiFi (802.11b/g/n) Module with Antenna for Raspberry Pi

[USB WiFi (802.11b/g/n) Module with Antenna for Raspberry Pi](https://www.adafruit.com/product/1030)
Discontinued - [**you can grab** USB WiFi (802.11b/g/n) Module: For Raspberry Pi and more **instead!&nbsp;**](https://www.adafruit.com/product/1012)

Make your Internet of Things device cable-free by adding super WiFi. Take advantage of the Raspberry Pi and Beagle...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1030)
[Related Guides to the Product](https://learn.adafruit.com/products/1030/guides)
### USB WiFi (802.11b/g/n) Module: For Raspberry Pi and more

[USB WiFi (802.11b/g/n) Module: For Raspberry Pi and more](https://www.adafruit.com/product/1012)
Make your Internet of Things device cable-free by adding WiFi. Take advantage of the Raspberry Pi and Beagle Bone's USB port to add a low cost, but high-reliability wireless link. We tried half a dozen modules to find one that works well with the Pi and Bone without the need of recompiling...

In Stock
[Buy Now](https://www.adafruit.com/product/1012)
[Related Guides to the Product](https://learn.adafruit.com/products/1012/guides)
### BeagleBone Black Rev C - 4GB Flash - Pre-installed Debian

[BeagleBone Black Rev C - 4GB Flash - Pre-installed Debian](https://www.adafruit.com/product/1876)
Note: As of May 12, 2014 Adafruit is shipping Rev C. We have discontinued selling Rev B. There are no exchanges or "upgrades" for Rev B to Rev C.  
  
If you liked the BeagleBone Black Rev B, you will love the Rev C! The Rev C still has a blistering 1GHz processor and 512MB...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1876)
[Related Guides to the Product](https://learn.adafruit.com/products/1876/guides)
### 5V 2A (2000mA) switching power supply - UL Listed

[5V 2A (2000mA) switching power supply - UL Listed](https://www.adafruit.com/product/276)
This is an FCC/CE certified and UL listed power supply. Need a lot of 5V power? This switching supply gives a clean regulated 5V output at up to 2000mA. 110 or 240 input, so it works in any country. The plugs are "US 2-prong" style so you may need a plug adapter, but you can pick one...

In Stock
[Buy Now](https://www.adafruit.com/product/276)
[Related Guides to the Product](https://learn.adafruit.com/products/276/guides)
### Flexible USB Swivel Adapter

[Flexible USB Swivel Adapter](https://www.adafruit.com/product/974)
This flexible USB swivel adapter will extend your USB port out of the way. Useful when you want to attach a 'bulky' USB device without blocking a secondary port. We thought this would be handy for BeagleBone or Raspberry Pi users. Rotates 180 degrees in two axes, with a very nice solid...

In Stock
[Buy Now](https://www.adafruit.com/product/974)
[Related Guides to the Product](https://learn.adafruit.com/products/974/guides)
### USB 2.0 Powered Hub - 7 Ports with 5V 2A Power Supply

[USB 2.0 Powered Hub - 7 Ports with 5V 2A Power Supply](https://www.adafruit.com/product/961)
Add lots more USB capability to your Raspberry Pi or computer using this powered USB 2.0 hub. It adds a full **seven powered ports** , all at USB 2.0 speeds so you can use video cameras and other high speed devices (cheaper hubs are v1.1 and not as fast!)  
  
The extra sauce...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/961)
[Related Guides to the Product](https://learn.adafruit.com/products/961/guides)
### BeagleBone Black Rev C - 4GB - Pre-installed Debian

[BeagleBone Black Rev C - 4GB - Pre-installed Debian](https://www.adafruit.com/product/1996)
If you liked the BeagleBone Black Rev B, you will love the Rev C! The Rev C has a blistering 1GHz AM3358 processor and 512MB onboard DDR3 RAM, two 46-pin headers, micro HDMI for audio/video output, USB ports, 10/100 Ethernet and other I/O features. The Rev C is an ultra-powered embedded...

In Stock
[Buy Now](https://www.adafruit.com/product/1996)
[Related Guides to the Product](https://learn.adafruit.com/products/1996/guides)

## Related Guides

- [Controlling a Servo with a BeagleBone Black](https://learn.adafruit.com/controlling-a-servo-with-a-beaglebone-black.md)
- [Nokia 5110/3310 LCD Python Library](https://learn.adafruit.com/nokia-5110-3310-lcd-python-library.md)
- [Bone Box](https://learn.adafruit.com/bone-box.md)
- [Blinking an LED with BeagleBone Black](https://learn.adafruit.com/blinking-an-led-with-beaglebone-black.md)
- [Running Programs Automatically on Your Tiny Computer](https://learn.adafruit.com/running-programs-automatically-on-your-tiny-computer.md)
- [User-space SPI TFT Python Library - ILI9341](https://learn.adafruit.com/user-space-spi-tft-python-library-ili9341-2-8.md)
- [BeagleBone](https://learn.adafruit.com/beaglebone.md)
- [BeagleBone Black: Installing Operating Systems](https://learn.adafruit.com/beaglebone-black-installing-operating-systems.md)
- [Measuring Light with a BeagleBone Black](https://learn.adafruit.com/measuring-light-with-a-beaglebone-black.md)
- [Adding a Real Time Clock to BeagleBone Black](https://learn.adafruit.com/adding-a-real-time-clock-to-beaglebone-black.md)
- [MPR121 Capacitive Touch Sensor on Raspberry Pi & BeagleBone Black](https://learn.adafruit.com/mpr121-capacitive-touch-sensor-on-raspberry-pi-and-beaglebone-black.md)
- [Measuring Temperature with a BeagleBone Black](https://learn.adafruit.com/measuring-temperature-with-a-beaglebone-black.md)
- [MCP9808 Temperature Sensor Python Library](https://learn.adafruit.com/mcp9808-temperature-sensor-python-library.md)
- [Bonjour (Zeroconf) Networking for Windows and Linux](https://learn.adafruit.com/bonjour-zeroconf-networking-for-windows-and-linux.md)
- [Fading a RGB LED on BeagleBone Black](https://learn.adafruit.com/fading-a-rgb-led-on-beaglebone-black.md)
