Pretty much from the first release of leJOS you have been able to connect to the EV3 using WiFi, Bluetooth and USB connections. What has not been so easy is using Bluetooth and USB to connect two or more EV3s together. Some recent work on leJOS (post the 0.9.0 release) aims to make this much easier. This is the first of a series of articles on these new features. In this first post I’ll take a look at the existing connection mechanisms and describe the new modes. In the second post I’ll give some details of how to configure them using the enhanced menu. In the final posts I intend to take a look at the performance of the various modes, and show some examples of them in use.
Let’s start off by taking a look at what is probably the most familiar mode WiFi.
Each PC/EV3 has a WiFi adapter/dongle and they all connect via your home router/access point. The current version of leJOS has pretty good support for this allowing you to easily configure the router, passwords etc. Our class libraries and menu combine to make it possible to discover other EV3s without having to know the IP address (though this may not always work, see later). Performance is pretty good, you can easily talk to multiple EV3s from the same PC or from EV3 to EV3. The downside is that you need a dongle and in some situations (like schools) it may not be possible to get access to the installed router.
What about Bluetooth and USB:
USB and Bluetooth use a similar connection mechanism. Each EV3 is connected directly to the PC (by either a USB cable or a Bluetooth connection). The EV3 hands out a network address to the PC. It is not easy to have more than one EV3 connected at the same time (as this requires changing the EV3 IP address), nor is it easy to have a program on one EV3 talk to a program running on a second EV3. The discovery mechanism is the same as that used for WiFi. However in practice this often does not work because the PC’s local firewall blocks the messages used. The big advantage of this way of connecting is that no extra hardware is needed. Bluetooth also has the advantage of not having any extra cables or dongles sticking out of the brick. This mode of operation is also ideal in a environment where WiFi is not available.
So now let’s take a look at what is new:
The new features are all about making USB and Bluetooth more usable, particularly when using multiple EV3s. The key difference is that we have introduced the notion of an EV3 Access Point. This is simply one of the EV3s that is nominated as the controller for a small sub network called a PAN (Personal Area Network). This network can have up to 16 members (if using Bluetooth only then this limit is 8), these devices can be EV3s, PC even mobile phones. Once connected to the PAN the devices use standard TCP/IP to talk to each other. The access point handles assigning IP addresses, typically the Access Point is 10.0.1.1, the other devices 10.0.1.2, 10.0.1.3 etc. As you can see you can connect devices to the Access Point using either Bluetooth or USB. You can even connect multiple EV3s via USB by connecting them one to another in a chain. The PAN is very easy to configure using the new menu, it allows the EV3s in the PAN to easily talk to each other, you don’t need to have a PC connected – a pure EV3 PAN works fine, a new discovery mechanism makes it easy for one EV3 to identify another (just use the name), this mechanism also works fine with the Windows firewall.
Finally there is an enhanced version of the Access Point, Access Point+
This mode extends the access point a little further by allowing the access point to also connect to your local WiFi network. Once connected all of the members of the PAN can also be contacted by other devices on your WiFi network. This mode offers the ability to use USB/Bluetooth within a LEGO model to connect your EV3s, while allowing WiFi to be used to talk to PCs for development or to obtain longer range etc. It needs a single WiFi dongle for the access point and requires a more complex configuration, but offers a lot of flexibility once setup.
In the next article we will take a look at the new menu items that can be used to configure these new modes.