The Arduino Yun has an embedded wireless network card. Unfortunately, that card doesn’t support an external antenna.
If you take a close look at the board, you may notice a connector similar to the U.FL one normally used to connect an antenna:
That connector, as someone explained on the official forum, is only used for testing purposes and it’s not suitable for a permanent use.
The easiest solution is to use a cheap USB->wifi adapter that supports external antennas, let’s see how to do that…
First you must be sure that the adapter you are buying is supported by the Linux distribution (OpenWrt) running on the Yun. My suggestion is to verify that the kernel modules (that are the “drivers”) needed for your adapter are included in the list of the available packages for the Yun.
I chose an adapter based on the Ralink RT5370 chipset (available on eBay for about 8 euros):
After having inserted the adapter in the Yun’s USB port, if you run dmesg command you can verify that Linux discovered the new peripheral:
To install the drivers, the Yun must be connected to the Internet. Run the following commands:
opkg update opkg install kmod-rt2800-lib kmod-rt2800-usb kmod-rt2x00-lib kmod-rt2x00-usb
If you run again dmesg, you can now notice that Linux registered the correct interface driver:
To proceed, reboot the Yun.
After the reboot, the /etc/config/wireless file should have been updated to include the configuration also for the radio1 device (radio0 is the onboard adapter):
Let’s configure the connection using the web interface. Open the homepage of your Yun and click on Configure, advanced configuration panel.
Choose the Network tab, then the Wifi one. The new adapter is listed with the status disabled or not associated:
To connect to an existing wifi network, click on Scan:
Choose the correct wifi network and click on Join Network:
Type the password for the network a name for the new connection (I used wlan1) and choose lan as the firewall zone:
Confirm with Submit, then with Save & Apply.
If you go back to the Network tab, the new connection is displayed and the Yun is online: