Connecting Bela to wifi - BelaPlatform/Bela GitHub Wiki
This material has been superseded. Visit learn.bela.io for the maintained version.
We tested Bela with a few wifi dongles. Many more dongles which are compatible with Linux will work out of the box if their drivers are included in the 4.4.113 kernel. Newer devices may require to compile the drivers for this kernel. Tested devices:
- Ralink RT5370
- Ralink MT7601U 148f:7601
Here are some steps to follow to setup your network connection with a wifi dongle.
First of all, run
$ lsusb
on the board to make sure it shows up correctly. If it does not, reboot your device. If you have an old Bela image (before v0.1) and want to use the NETGEAR A6100-100PES AC600, then first follow the steps below for driver installation. Otherwise, just go through the Network setup.
Network setup
- Get the name of your wifi device:
ip a
One of the devices should be called wlanX
, where X is a number, that is the name of your network device. If no wlan
device shows up, then maybe you need to install drivers for it.
In the following we use wlan1
as the name of the interface. You should replace it with the device name you found in this step.
-
You now need to edit the
/etc/network/interfaces
file following the instructions in there:- You can edit the file with the following command
nano /etc/network/interfaces
. At the bottom of the file make sure the interface name is the same as your device. Save the file and exit.
- You can edit the file with the following command
-
Run the following making sure to enter your network name and password in place of the YourNetworkName and YourNetworkPassword:
$ wpa_passphrase YourNetworkName YourNetworkPassword >>/etc/wpa_supplicant/wpa_supplicant.conf
- Then run:
$ ifdown wlan1; ifup wlan1;
- Verify your settings are correct by running:
$ ip a
and check that your device is working and has an IP address.
Driver setup
Note: These steps are only required for a Bela image v0.3.x if you are using the following dongle:
- NETGEAR A6100-100PES AC600 802.11AC (more expensive, but better performing)
Clone this repo on the board: https://github.com/abperiasamy/rtl8812AU_8821AU_linux,
cd
into it and run make ARCH=arm && make ARCH=arm install
.
Router
If you are searching for a battery-friendly wireless router, try the USB-powered TPlink tl-wr902ac. Among other things, it allows to reserve IP addresses for specific MAC addresses, which ensures your BELA to always show up at a pre-defined IP.
Sharing wifi over USB with Bela
This is a way of connecting your board to the internet via USB to the connection of your laptop.
On Mac go to OSX internet sharing (System Preferences > Sharing) which creates a network 192.168.2.0/24 with DHCP server. Enable Internet Sharing on the OSX computer. Enabling internet sharing will interrupt the existing IPv4 configuration and so you will no longer be able to reach the Bela over 192.168.7.2
Even though there is no IPv4 network connection, bela.local is advertising it's IPv6 address. We can still SSH to the PB using bela.local:
ssh [email protected]
Now to disable the static IP and enable DHCP. Edit /etc/network/interfaces
pico /etc/network/interfaces
Comment out the usb0 static config IP from /etc/network/interfaces, and add the line iface usb0 inet dhcp
and iface usb1 inet dhcp
saving and exiting Pico once you're done (control -X). It should look like this:
auto usb0
iface usb0 inet dhcp
#iface usb0 inet static
# address 192.168.6.2
# netmask 255.255.255.0
# network 192.168.6.0
# USB ECM gadget (macOS / Linux compatible)
auto usb1
iface usb1 inet dhcp
#iface usb1 inet static
# address 192.168.7.2
# netmask 255.255.255.0
# network 192.168.7.0
Last step, restart the networking service:
systemctl restart networking.service