Thursday, January 9, 2014

Setting up Wifi on an EV3 running LeJOS

What is the point of having an awesome robotics kit running Linux if you cannot access the shell? That is a question I found myself facing once I had installed LeJOS on the EV3. Although I could place programs (Java .jar files) on the sd card directly) and execute them on the EV3 this became quite tedious quite fast. Fortunately, of the few Wifi dongles supported by LeJOS is the Edimax EW-7811Un which sells for $10 at Amazon. This amazingly small wifi dongle is an excellent add-on for the EV3 and works on the Raspberry Pi as well.



Once again the internet is full off conflicting advice on how to get the EV3 running LeJOS to automatically detect the Wifi dongle (Note: The stock Lego EV3 firmware never did detect it). The advice that worked for me came from this source.

The common pitfalls to avoid are: do NOT edit /etc/network/interfaces (no matter how many tutorials tell you to), you only need to modify /etc/wpa_supplicant.conf. And you can generate the psk in hex form by running the wpa_passphrase command as follows:
    wpa_passphrase <SSID>
and simply enter the passphrase when prompted to get the psk in hex format.

In summary load the microSD card (with the LeJOS partitions for EV3) in to your computer, mount the non-boot partition and edit /etc/wpa_supplicant.conf to enter your wireless network credentials. Once done, unmount the microSD card and load it in to the EV3. Start it up (it should boot in to LeJOS) and the EV3 should connect automatically to your specified wireless network.

Note: Once wifi is set up you can ssh in to the EV3 using the IP Address displayed by LeJOS on the EV3's screen. The username is root and the password is blank/empty. To allow scripts to ssh in to the EV3 I placed my public key in the /home/root/.ssh/authorized_keys file (which I had to create) and then simply added an entry for EV3 in my computers ~/.ssh/config file. Now I can access my EV3 over wifi effortlessly.

2 comments:

  1. Will this procedure work for 5Ghz wifi dongle also. As netgear 2.4Ghz and edimax 2.4Ghz works fine for me but the data is delayed in receiving.

    ReplyDelete
  2. I don't have any personal experience with using a 5 GHz Wifi Dongle with the EV3, sorry. From all accounts it doesn't support all or even a majority of wifi dongles.

    ReplyDelete