2

I would like to connect to my EV3 from PC (and then Android) via Bluetooth. I was able to connect to NXT with LEGO-MINDSTORMS-MINDdroid which uses direct LCP commands but as far as I know the communication language for EV3 is different from that of NXT.

I have installed lejos 0.9.1-beta on my EV3 and I could communicate with it via USB and WiFi using lejos' HelloWorld example containing BrickFinder.getDefault() for connecting.

I have followed Abid's tutorial for connecting from Linux. It did not work with Ubuntu 16.04 but it did with Ubuntu 14.04. I could ssh to the brick (I guess because 16.04 uses Bluez 5 while 14.04 and lejos uses Bluez 4). Bluez 4 and 5 seems incompatible.). However BrickFinder.getDefault() still does not find the brick. (It is not clear whether this function checks Bluetooth at all.)

What should I do to create a Bluetooth connection from Linux (preferably Ubuntu 16.04) and Android?

I would like to avoid low-level bluetooth programming/direct commands as I have no experience with it and I prefer a java solution. Lejos on the brick's side is not a priority.

  • 3
    Does this help? bricks.stackexchange.com/a/5930/3498 – David Lechner Dec 12 '16 at 16:41
  • @David Lechner I have seen this page but there was no mention of Bluetooth in the source of Peter Mitrano's project. I will check it more thoroughly. – rics Dec 13 '16 at 7:40
  • 2
    The BrickFinder source code is at sourceforge.net/p/lejos/ev3/code/ci/master/tree/ev3classes/src/…. It seems the .getDefault() method iterates over all interfaces returned by the Java call NetworkInterface.getNetworkInterfaces(). Once bnep0 is created I would think it would be listed here and the EV3 should consequently become discoverable. Would need to hack this code to test what the problem is. – Abid H. Mujtaba Dec 14 '16 at 18:38
  • I have found out that socket.receive in BrickFinder.find throws a SocketTimeoutException even if I raise setSoTimeout to MAX_DISCOVERY_TIME from MAX_DISCOVERY_TIME/4. Ping to EV3 from Ubuntu is working. Bluetooth communication from Android to EV3 is also working. – rics Dec 31 '16 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.