First Steps

Take a look at the leJOS Wiki page on navigating the OS. Play around until you feel you have a good grasp of what’s going on. You also may wish to set the Volume and Key Volume to mute, as the constant beeping can get quite annoying after a while.

Filesystem Structure

leJOS is based on Linux, and in fact boots a more-or-less complete Linux installation to run the EV3 brick. After the leJOS installer runs it repartitions the SD card for its own use, creating a 500 MB FAT32 partition and an ext2 partition on the remaining space. The underlying Linux installation is on this ext2 partition, and it is this partition also that you access when you SSH into the EV3 (using any of the methods below).

If you plug the card into a computer with an adapter, and depending on the host OS, you may get only some, none, or all of the partitions to mount automatically. In that case, you may have to manually mount the ext2 partition before being able to access it. The Local Host section below explains this approach.

Communicating With leJOS

It is important to be able to access the EV3 brick easily in order to upload your programs and manage the filesystem. Furthermore, it is an excellent idea to have a reasonable level of understanding of the internals. This page will get you started, but you are strongly encouraged to continue exploring on your own.

There are a few ways to access the EV3. Wireless connectivity is very convenient, and the EV3 comes with a built-in Bluetooth adapter, so you may want to try that first. For WiFi you will need one of two supported USB WiFi adapters, and then there are the options of connecting directly with a USB cable, or mounting the SD card on a local host. The different methods are described in more detail below.

Note: you may want to change the name (hostname) of the EV3 brick. You can do so from System -> Change name. The default hostname is EV3.

About SSH

Note: the login user name for the EV3 is root and the password is blank—just press the ENTER key to log in.

In any of the steps below, you might get an error such as this (your IP address may be different if you changed the default configuration):

Unable to negotiate with 10.0.1.1 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

You can read the full write-up on the OpenSSH site, but the following steps should fix the problem.

  1. On your Mac, go to the directory ~/.ssh/. That is, directory named .ssh under your home directory. The dot in front of it means it’s hidden, so you won’t see it in the Finder. But you’re working on the command-line anyway, right? Right?!
  2. In this directory, open (or create if not present) a plain-text file named config.
  3. Put the following lines in the file.
Host 10.0.1.1
        KexAlgorithms +diffie-hellman-group1-sha1

 


The indents are tabs, not spaces. Save the file and try connecting again.

Note: you will have to add any different hosts or IP addresses that the EV3 has on different networks when you establish new connections. You can add them with to the first line, separated by space: Host 10.0.1.1 10.130.127.122, etc. You  may want to access it by hostname if possible, such as a university network where you can register your device, or configure your home router to always issue it the same IP address.

Bluetooth

This is probably the most convenient way of accessing the EV3 wirelessly, as it has a built-in Bluetooth adapter. The default PIN is 1234.

  1. Open the Bluetooth preferences on your Mac.
    1. You should see the EV3 listed, with a different hostname than the default if you changed it.
  2. (Optional) If you get an error about the passkey, click on the button to change it (in the Bluetooth dialog on the Mac) and enter 1234, or whatever key you may have set on the EV3.
  3. After it’s paired, right-click on the device and select Connect to Network.
  4. Under the Network preference pane, you should see Bluetooth PAN active.
  5. You can access the EV3 using SSH at its default IP address, which is 10.0.1.1.

WiFi

According to the official leJOS wiki page on the subject (which you are reading, right?) there are two tested, compatible WiFi adapters—namely the NETGEAR WNA1100 and the Edimax EW-7811Un. As of this writing, both are available on Amazon. I am using the Edimax one, as it is much smaller than the NETGEAR, but the process should be the same for both.

  1. Plug the network adapter into the EV3 host USB port (the full-size one).
  2. From the WiFi menu, select your network, then enter the network key.
  3. When the EV3 connects, you will see its IP address on the screen, below the IP address for the local network connection.
  4. You can now SSH into the brick as described above.

You may have a more complicated network setup, such as a hidden network or an altogether open network (without a password), or something else. If leJOS trips up over connecting to it, please continue reading.

Being an actual-factual Linux OS, leJOS can use a file called wpa_supplicant.conf, which tells it how to connect to various WiFi networks. It is highly recommended you use this file rather than make any changes to the interfaces file, as some other places on the Web advise you. In the supplicant file you can specify a number of different networks with their respective settings.

Note: even though you should be able to simply restart the supplicant daemon with the wpa_supplicant command, this doesn’t always work and you may fail to connect. Rebooting leJOS is recommended in order to let things start up in their proper order as part of further troubleshooting.

Note: for the steps below, you will need to be able to access the ext2 partition on the SD card. You can use any of the other methods outlined here to do so.

  1. Go to the directory /home/root/lejos/config on the SD card.
  2. If there is not a file named wpa_supplicant.conf, create one and open it.
    1. vi wpa_supplicant.conf or any other way you want.
    2. Note: this is different from the base_wpa_supplicant.conf file!
  3. Create a network block for each different network that needs configuration. You can look at an example supplicant file as well, but you’ll only need a few of the fields.

Example 1: An open network (without a password).

network={
        ssid="YOUR_NETWORK_SSID"
        scan_ssid=1
        mode=0
        key_mgmt=NONE
}

 


Example 2: A hidden network with WPA2 authentication.

network={
        ssid="YOUR_NETWORK_SSID"
        scan_ssid=1
        mode=0
        proto=WPA2
        key_mgmt=WPA-PSK
        psk=YOUR_PSK
}

 


The indents are tabs, not spaces in my examples, although I’m not sure it matters.

If the wpa_supplicant.conf file already exists, it will have another line in it as the first line, specifying the interface for the control program. If you had to create the file, then you need to put this line as the first one in the file.

ctrl_interface=/var/run/wpa_supplicant

You can generate a PSK for your network based on the network SSID and your plain-text key using an online service, such as the one provided by Wireshark, or using the Linux command wpa_passphrase (part of the wpasupplicant package on Ubuntu). For the utility, make sure you surround your password in single quotes if you have any special character that the shell will interpret differently.

Ethernet Over USB (RNDIS)

You can use a USB to Mini USB (Mini-B type) cable to connect the EV3 to your Mac. The EV3 communicates through its Mini USB port, not the full-size one.

  1. Note the IP address on top of the screen, under the hostname. It should be 10.0.1.1 by default.
  2. Connect the EV3 to your Mac with a USB cable.
  3. If you open System Preferences -> Network, you should see it listed as a new network connection named RNDIS/Ethernet Gadget. Your Mac should have an IP address on this connection, perhaps 10.0.1.2 or similar.

Now you can log into the brick using SSH. The username is root and there is no password—just press ENTER at the password prompt.

Local Host

You can also plug the microSD card directly into a computer, using an SD card adapter on a computer with an SD card reader or using a USB adapter. I use the IOGEAR GFR204SD for this purpose.

Connecting this way requires you to power down leJOS and physically move the SD card around, but it has the advantage of being independent of the EV3 brick.