Yún – USB wifi adapter

by luca
47 comments

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:

yun-p1

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…

Compatible adapters

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):

yun-p2

Configuration

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:

yun-wlan1

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:

yun-wlan2

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):

yun-wlan3

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:

yun-wlan4

To connect to an existing wifi network, click on Scan:

yun-wlan5

Choose the correct wifi network and click on Join Network:

yun-wlan6

Type the password for the network a name for the new connection (I used wlan1) and choose lan as the firewall zone:

yun-wlan7

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:

yun-wlan8

Photos

yun-p3 yun-p4

Related Posts

47 comments

paolo Thursday December 4th, 2014 - 04:00 PM

FANTASTICO!!!!! grazie mille per la tua guida!

Reply
Mauro Thursday January 8th, 2015 - 05:15 PM

Ciao Luca, scusa ma ho un’altra domanda.
Quindi se installo la Yun all’interno di una macchina carenata in metallo sono obbligato ad installare una antenna esterna per riuscire a captare il wifi ? se si…..
Se l’USB l’ho impegnata per la famosa interfaccia seriale per collegare il modulo HC-06 Bluetooth …. come faccio a metterci anche l’antenna ?
Grazie infinite.

Reply
luca Friday January 9th, 2015 - 08:28 AM

Sì: un contenitore metallico blocca il segnale quindi sei obbligato a installare una antenna esterna. Il vantaggio dell’USB è che puoi tranquillamente collegare allo Yun un hub (meglio se alimentato!) e moltiplicare con quello le porte USB disponibili.

Reply
Mauro Tuesday January 27th, 2015 - 10:35 AM

Ciao Luca,
ho eseguito alcune prove abbastanza massacranti sulla mia Yun. Richiusa nella famigerata carenatura metallica, con mio sommo piacere e soprattutto solievo, ho potuto testare la potenza del suo wi-fi. Effettivamente nei pressi della macchina segnale PIENO e sito installato sulla SD eseguibile in continuo refresh anche da più di 10 metri all’interno della stessa stanza. La temperatura di esercizio dentro la carena è di circa 45-50 °C ed è pure raggiunda da umidità prodotta da vapore che può trafilare verso l’interno della carena stessa.
La macchina presenta solo delle aperture nella parte bassa. Probabilmente funziona così bene grazie a queste.
Ci tenevo a comunicare questo perché chi ha condizioni simili alle mie, non si scoraggia ancora prima di iniziare.

Reply
luca Saturday January 31st, 2015 - 10:06 AM

grazie mille Mauro per aver condiviso la tua esperienza con la Yun, sarà sicuramente utile ad altri amici del blog!

Reply
Andy Thursday February 5th, 2015 - 12:36 PM

Does it work also as a hotspot like the basic Yun’s wifi?
thanks

Reply
luca Thursday February 5th, 2015 - 08:28 PM

Hi! Yes it works, you can configure it using Luci webinterface

Reply
Andy Monday February 23rd, 2015 - 05:05 PM

Thank you!

Reply
Marco Saturday February 28th, 2015 - 01:58 AM

Ciao Luca,
grazie innanzitutto del post, ne cercavo uno così da tempo.
Vorrei anch’io rendere in modalità hotspot la nuova interfaccia dongle ma non riesco.
Ho installato i pacchetti correttamente e openwrt mi vede il dongle.
Poi sono entrato in luci e nella sezione Wifi ho cliccato su “enable” nella corrispondente sezione della nuova interfaccia.
Quindi il vecchio wifi si è scollegato e dal pc ho potuto vedere il nuovo “OpenWrt” . Purtroppo non riesco a connettermi poichè sul simbilo del Wifi mi compare il punto escalmativo di connessione limitata.
[…]
Sbaglio qualcosa? Sai darmi una mano?
Ti ringrazio per la disponibilità

Reply
luca Saturday February 28th, 2015 - 11:46 AM

Ciao Marco, connessione limitata potrebbe indicare che non funziona il DHCP server sullo Yun e quindi il PC non prende un indirizzo… hai provato a riavviare lo Yun?

Reply
Marco Saturday February 28th, 2015 - 12:19 PM

Grazie per la risposta, sì credo sia questo il problema.
La yun si riavvia automaticamente di continuo. Tral’altro non so più come fare fare il factory reset perché nessuno dei 2 wifi funziona .

Reply
Marco Saturday February 28th, 2015 - 01:29 PM

PS: sono riuscito con YunSerialTerminal e poi con putty a ripristinare il wifi interno, hai idee per il DHCP di linino? grazie

Reply
osman Saturday February 28th, 2015 - 10:41 AM

I bought mentioned antenna and I use ubuntu for setup the driver of device. it says opkg is not found did you mean dpkg. So i could not do that. Please help.

Reply
luca Saturday February 28th, 2015 - 11:45 AM

Hi! opkg is the packet manager for the Arduino Yun (http://arduino.cc/en/Tutorial/YunPackageManager), how could it be missing on your Yun?

Reply
Dwindra Sunday March 15th, 2015 - 04:08 PM

I want to use USB Wifi Adapter too for my Yun, and I am excited when seeing this post, so I try to buy an USB dongle which look the same with yours.
But, when I plug it to the Yun, it detects that it is actually MT7601.
Can I use it? I am still new to OpenWRT so I don’t know how to install it (since I can’t install it with the way you do with “opkg install kmod ….”)

thanks

Reply
luca Sunday March 15th, 2015 - 10:48 PM

Hi, unfortunately it’s not easy to use your USB wifi dongle with OpenWRT… I found this project but it requires a bit of work (compiling…)

Reply
Dwindra Monday March 16th, 2015 - 06:10 AM

yeah, I’ve been reading about using MT7601 on openwrt, and from that link it’s said that we have to build our own package.

I will try it first, but if it fails I will just look for another USB wifi dongle and make sure it is using RT5370

thank you!

Reply
fab03 Sunday March 29th, 2015 - 10:21 PM

Ciao Luca, ti ringrazio perché questo è proprio il post che stavo cercando, in quanto ho abbandonato per sfinimento la ricerca di un adattatore dallo strano connettore onboard al classico SMA per l’estensione dell’antenna wifi (anche nel mio caso ho tutto in un case metallico). Volevo chiederti se i driver degli adattatori wifi USB compatibili con Linux possono essere scaricati e installati anche tramite l’interfaccia web dello Yùn o solo tramite riga di comando (o se alcuni modelli addirittura si autoinstallano). Grazie mille

Reply
dave Monday March 30th, 2015 - 01:29 PM

Doesn’t seem to work anymore as it has been removed from the package list. I have tried downloading it directly(wget) and install the files manually only to find an endless dependency errors. Could you share a backup image of your Yun(after removing your credentials of course)?

Reply
luca Tuesday March 31st, 2015 - 06:54 PM

Hi Dave! Are you sure? I can’t try now (my Yun is running a project) but I found recent posts in the Yun forum about the use of those kernel modules with the latest YunOS image…

Reply
John Wednesday April 22nd, 2015 - 11:12 PM

Hi! Very interesting post.
But once I know the chipset of my wifi dongle how do I choose the correct driver package from the list of your link to the arduino website?
How did you know that for the Ralink chipset you needed right that specific driver?
Btw I have a Digicom wave 54.
Thank you

Reply
luca Thursday April 23rd, 2015 - 03:46 PM

Hi John, unfortunately there’s no a generic answer to your question… google may help (searching for “USB WAVE 54 linux” brought me to the zd1211b chipset) but it may be a pain to find and install a suitable module (sometimes you must compile it!). It’s very easier to buy a supported dongle, from the official OpenWRT list.

Reply
Arsene Thursday April 30th, 2015 - 02:28 AM

Hi Luca,

I’m also trying to connect the wifi usb adapter to my arduino yun.
but when I try to install the drivers it tells me

Unknown package ‘kmod-rt2800-lib’.
Unknown package ‘kmod-rt2800-usb’.
Unknown package ‘kmod-rt2x00-lib’.
Unknown package ‘kmod-rt2x00-usb’.
Collected errors:
* opkg_install_cmd: Cannot install package kmod-rt2800-lib.
* opkg_install_cmd: Cannot install package kmod-rt2800-usb.
* opkg_install_cmd: Cannot install package kmod-rt2x00-lib.
* opkg_install_cmd: Cannot install package kmod-rt2x00-usb.

Reply
luca Thursday April 30th, 2015 - 10:36 PM

Hi! Is your Yun connected to the Internet? Did you enter the “opkg update” command before trying to install the modules?

Reply
Arsene Friday May 1st, 2015 - 06:18 PM

yes I did
I finally got it to work. I had to update my yun linux to the latest version.

Reply
Arsene Friday May 1st, 2015 - 09:20 PM

But I’m having a hard time connecting another device the MOD-WIFI-R5370-ANT wifi as it say “Failed to obtain IP”

Reply
Paolo Thursday May 28th, 2015 - 08:54 AM

Ciao Luca,
bellissima spiegazione. Una volta funzionante l’adattatore, posso disabilitare il wifi onborad?

Reply
luca Thursday May 28th, 2015 - 09:13 AM

assolutamente sì!

Reply
jay97430 Monday June 1st, 2015 - 09:18 AM

Hello,

My Yun doesn’t display the description of my antenna.

Do you have some ideas?

Reply
luca Monday June 1st, 2015 - 01:46 PM

Take a look at the dmesg output… the Yun probably didn’t recognize the dongle…

Reply
Jeff Friday July 31st, 2015 - 03:39 AM

Hi Luca,

Everything went well and i’ve got the message”new interface driver process rt2800usb”, but when i reboot yun and check for config-wifi device it’s still in radio0 🙁 Do you have idea what could be?

Thanks so much!

Reply
Graziano Thursday October 15th, 2015 - 08:36 PM

Salve,
a me il wifi non serve, è possibile disattivarlo senza problemi? ho sentito parlare di continui riavvii. A me serve solo la connessione via lan per la programmazione, il restante tempo sarà indipendente da wifi e lan.

Reply
luca Friday October 16th, 2015 - 07:44 AM

Ciao Graziano: assolutamente sì, se non ti serve puoi spegnere direttamente l’interfaccia wifi.

Reply
angelo Thursday October 22nd, 2015 - 11:40 AM

Ciao Luca, complimenti per la guida.
Ho eseguito le istruzioni di installazione delle librerie, ma quando lancio il comando dmesg ho una serie di errori di questo tipo:

[ 39.400000] rt2800usb: Unknown symbol rt2x00mac_sw_scan_complete (err 0)
[ 39.410000] rt2800usb: Unknown symbol rt2800_config_shared_key (err 0)
[ 39.410000] rt2800usb: Unknown symbol rt2x00mac_add_interface (err 0)
[ 39.410000] rt2800usb: Unknown symbol rt2800_enable_radio (err 0)
[ 39.420000] rt2800usb: Unknown symbol rt2800_reset_tuner (err 0)
[ 39.420000] rt2800usb: Unknown symbol rt2x00mac_get_stats (err 0)
[ 39.420000] rt2800usb: Unknown symbol rt2x00mac_sta_remove (err 0)
[ 39.420000] rt2800usb: Unknown symbol rt2x00lib_txdone_noinfo (err 0)
[ 39.430000] rt2800usb: Unknown symbol rt2800_link_stats (err 0)

……..

Reply
luca Saturday October 24th, 2015 - 01:48 PM

Ciao Angelo, davvero strano… stai usando l’ultima versione del firmware per Yun? Quell’errore sembra indicare un problema nella compilazione del kernel 😮

Reply
dinu Thursday February 25th, 2016 - 05:55 PM

Thanks a lot for this article. You really saved my project. Let me contribute that this method works as well with the arduino yun mini but a little more work is required:

Download the latest arduino yun image at https://www.arduino.cc/en/Main/Software#toc8

Update your Yun with this firmware (so you have the Arduino Yun control panel instead of the Linino stock image)

Connect the USB adapter to the USB+, USB-, 5V and GND of the Yun mini headers

Follow the steps described on this site.

Reply
luca Thursday February 25th, 2016 - 08:10 PM

Hi Dinu, thanks for your feedback!

Reply
Marco Monday February 29th, 2016 - 06:53 PM

Ciao Luca,
ho un dongle TP-LINK modello TL-WN722N
quando lancio il comando dmesg ho questa risposta:

[ 3109.820000] usb 1-1.1: USB disconnect, device number 6
[ 3121.830000] usb 1-1.1: new high-speed USB device number 7 using ehci-platform
[ 3121.980000] usb 1-1.1: New USB device found, idVendor=0cf3, idProduct=9271
[ 3121.980000] usb 1-1.1: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[ 3121.980000] usb 1-1.1: Product: USB2.0 WLAN
[ 3121.980000] usb 1-1.1: Manufacturer: ATHEROS
[ 3121.990000] usb 1-1.1: SerialNumber: 12345
pensi che il sistema possa riconoscerla??
Grazie !!

Reply
luca Saturday March 5th, 2016 - 02:18 PM

Ciao Marco, tutti quegli “unknown symbol” erano apparsi anche a me ad una certa versione di Linino: c’era stato un errore nella compilazione dei moduli. Prova a scaricare l’ultima versione dal sito di Arduino e vedi se così funziona…

Reply
Alessandro Wednesday September 14th, 2016 - 11:06 AM

Ciao Luca,

Sto seguendo la tua guida per installare un adattatore D-Link (idProduct=3308).
Non sono al 100% sicuro che i pacchetti “kmod-rt2800-lib kmod-rt2800-usb kmod-rt2x00-lib kmod-rt2x00-usb” facciano al caso mio, nonostante il fatto che dopo l’installazione abbia comunque ricevuto il risultato della tua guida eseguendo il dmesg.
Il problema è che comunque dopo il riavvio, facendo un nano /etc/config/wireless non compare niente relativamente alla radio1, ma solo le impostazioni della radio0. Sai per caso indirizzarmi verso la soluzione? Questo adattatore di rete “dovrebbe” funzionare in quanto lo avevo già usato in passato con raspberrypi.

Reply
luca Thursday September 15th, 2016 - 03:27 PM

ciao, per capire qual è il modulo corretto da utilizzare dovresti collegarlo, lanciare dmesg e copiarmi le ultime righe dove viene stampato l’ID del device.

Reply
Daron Saturday September 24th, 2016 - 02:28 PM

Luca

I bought the IDENTICAL package on Amazon in the US only to find the device is now sourced from RealTek and needs RTL8188 drivers which aren’t in the Yun modules.

🙁

Daron

Reply
luca Friday September 30th, 2016 - 03:58 PM

Daron, thanks for sharing your experience. I found this forum post that may help, let me know if it works for you!

Reply
Jacques Tuesday October 4th, 2016 - 06:30 PM

Hi Luca,

I follow the tuto step by step.
every thing went well until the configuration with the web interface.
The new adapter is listed with the status disabled or not associated.
but nothing went on when i click the scan button.
(with the embedded wireless network i can see all the existing network on scan click).
Do you have idea what could be?

Thanks so much!

Reply
luca Thursday October 6th, 2016 - 01:05 PM

Hi Jacuqes: is the adapter detected by the OS (dmesg…)? Did you reboot the Yun? Sometimes it may help.

Reply
Jacques Thursday October 6th, 2016 - 06:31 PM

Hi Lucas,

Thanks for your answer.

I guess the adaptater is detected dmesg give me the following answer:

usb 1-1.1: new high-speed USB device number 8 using ehci-platform
[170876.700000] usb 1-1.1: New USB device found, idVendor=148f, idProduct=5370
[170876.700000] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[170876.710000] usb 1-1.1: Product: 802.11 n WLAN
[170876.710000] usb 1-1.1: Manufacturer: Ralink
[170876.710000] usb 1-1.1: SerialNumber: 1.0
[170876.810000] usb 1-1.1: reset high-speed USB device number 8 using ehci-platform

and i try several reboot.

Any other idea ?
Thanks so much!

Reply
Jacques Friday October 7th, 2016 - 06:10 PM

Hi Lucas,
I checked everything once again and noticed a difference with the tuto:

In the web interface Network / Wifi i have:

Generic 802.11 Wireless Controller (radio1)
SSID: OpenWrt | Mode: Client
Wireless is disabled or not associated

an not

Generic MAC80211802.11bgn(radio1)

May i help to find an issue
Thanks

Reply

Leave a Reply to Marco Cancel Reply

seventeen − two =