Thursday, January 3, 2013

Beaglebone: Using an USB WiFi dongle to connect to wireless networks at boot.

I'll cover how I configured my BeagleBone so it now (automagically) connects to wireless networks at boot.

Note: I assume you are running Ubuntu 12.10 in your Beaglebone.

Manual connection

First, let's check whether the Beaglebone can use the WiFi dongle by setting up a manual connection.

Before starting the test, let's install some software with the ethernet cable plugged in:
#On the beaglebone
sudo apt-get install lshw
sudo apt-get install wpasupplicant
Now unplug the Ethernet cable from the Beaglebone. And start a connection using the USB emulated Serial connection.
# On the PC
screen /dev/<ttyUSBx> 115200
Now let's check if the Beaglebone has recognized the WiFi dongle.
# On the beaglebone
lshw -C network
I got this:
*-network:1 DISABLED
description: Wireless interface
physical id: 2
bus info: usb@1:1
logical name: wlan0
serial: d8:eb:97:12:e4:c0
capabilities: ethernet physical wireless
configuration: broadcast=yes driver=rtl8192cu driverversion=3.2.33-psp26 firmware=N/A multicast=yes wireless=IEEE 802.11bgn
If you see something similar, it means your device has been detected by the Linux kernel and an appropriate driver has been loaded.

Remember the logical name, in this case is wlan0.

Now, turn on the WiFi dongle. (Use the logical name obtained from the last command)
# On the beaglebone
sudo ifconfig wlan0 up

Blue LED indicates that the WiFi dongle has been turned ON.

Scan for visible WiFi networks.
# On the beaglebone
sudo iwlist wlan0 scanning
You should see your network in the list:
wlan0     Scan completed :
          Cell 01 - Address: 00:13:49:CA:F5:10
                    Frequency:2.427 GHz (Channel 4)
                    Quality=56/70  Signal level=-54 dBm
                    Encryption key:on
Now, let's connect to your network.
# On the beaglebone
sudo nano /etc/network/interfaces
Append or modify the file to include the following text (I'm assuming your network it's WEP protected):
auto wlan0
iface wlan0 inet dhcp
    wireless-essid <ssid>
    wireless-key s:<ascii key>
Next, start the connection
# On the beaglebone
sudo ifup wlan0
And finally, test the connection
# On the beaglebone

Congratulations, you have connected to a wireless network.

Going automatic

We'll use wpa_supplicant to automate the connections to wireless networks.

wpa_supplicant is a daemon that manages unsecure, WEP and WPA wireless connections.

wpa_supplicant stores the information about the wireless networks that it can connect to in a .conf file, usually named wpa_supplicant.conf.

You can create/edit it, using:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
This is how it should look like:

# Unsecure Network

# WEP Network

# WPA Network

For more examples about the .conf file, check this website.

Let's reconfigure the network interface to add support for wpa_supplicant.
sudo nano /etc/network/interfaces
Change the wlan0 part to match the following text:
auto wlan0
iface wlan0 inet dhcp
    wpa-driver wext
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Finally reboot the BeagleBone to see the changes.
sudo reboot


  1. This comment has been removed by a blog administrator.

  2. Excellent tutorial, thanks! I used a Edimax EW-7811Un with no problems at all.

  3. Which wireless dongle have you used?

    1. Hello Hyon,

      For this tutorial I used a Trendnet dongle, the model is TEW-648UBM, a.k.a. N150 Micro Wireless USB Adapter.

      It's based on the rtl8192cu chipset.

  4. can this tutorial be followed for beagle board xm rev C as well?

  5. and one more thing is that 12.10 version is important to setup wireless connection?? cuz i have ubuntu 11.10 running on my beagle board,12.10 was quite slow so i had to change it

  6. hi can i use a wifi data stick on an Ångström image? and can u help me setup my bone on a lan network?

  7. how can i do the same if i hav an angstrom image on my beagle bone black.. Guess al the commands above wont wrk! please let me know

  8. forget the rtl8192cu chipset with Angstrom, it will not work reliably. Using Ubuntu is the right choice

  9. Thanks for this tutorial - information is spot-on and it helped me a lot.

  10. So informative things are provided here, I really happy to read this post, I was just imagine about it and you provided me the correct information I really bookmark it, for further reading, So thanks for sharing the information. cell phone detector

  11. Thank you for posting the great content…I was looking for something like this…I found it quiet interesting, hopefully you will keep posting such blogs… cell phone detection

  12. Excellent tutorial. I have a LB-Link running on a BBB rev. B w/ Ubuntu 3.10 now with no issues. Cheers for posting!

  13. Misi gan, izin share ya...

    ONE 14-Z1401-C2H9 (320GB)
    Price Rp 3.499.000

    Learn more about

    Brief Specs :
    Intel 2840, 2 GB DDR3, 320 GB HDD,NIC, Intel HD Graphics, 14" WXGA, Non OS

    Pusat Belanja Komputer

    Terimakasih :)