Why am I not able to connect to LEGO MINDSTORMS EV3 from MATLAB/Simulink?

22 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 2 Sep 2019
Edited: MathWorks Support Team on 2 Sep 2019
The MATLAB and Simulink Support Packages for LEGO MINDSTORMS EV3 allow you to connect, control and program your LEGO MINDSTORMS EV3 robot connected to your host computer.
The connection between the host computer running MATLAB and the EV3 robot can be established by USB, Bluetooth and WiFi connections. No extra hardware is required except for WiFi connection which is done using WiFi dongle.
Here are a few tips to ensure working connections between the host computer and the EV3 robot:
USB connection
USB is a simple connection and the robot connects to host as UID device, the same way keyboard and mouse connect. If a connection attempt fails, consider below steps:
1. Use a good USB cable for connection which is intact at both ends, and ensure 3rd party software like LEGO MINDSTORMS software is not running on your host alongside MATLAB.
2. When deploying your Simulink Model, ensure EV3 brick is not showing device info screen as it prevents launching the Simulink generated binary on robot.
3. Make sure the USB connection is not impacted by the firmware version used. USB connection is not supported on Linux machines.
Bluetooth connection
Bluetooth the most difficult and least reliable connection, although no additional hardware is needed. We recommend to avoid this connection, but in case of connection failure, consider below steps:
1. Make sure there is no mismatch in the Bluetooth stack between Host and EV3, which would result in a pairing error.
The command to verify this is:
l = legoev3('Bluetooth', <COMport>);
When the Bluetooth dongle is plugged in, it creates two COM ports. Ensure to provide both COM ports in case one fails. If connection on both COM port fails, then try command:
l = legoev3('bt', deviceID,1024);
This command requires an "Instrument Control Toolbox" license to be available. If both the commands fail, it is an indication that the Bluetooth communication software stack on the host and the EV3 brick are not compatible. You should look for an alternate mode of connection.
2. For a reliable connection, ensure no other EV3 target is nearby with Bluetooth turned ON.
3. When deploying your Simulink Model, ensure EV3 brick is not showing the device info screen as it prevents launching the Simulink generated binary on robot.
WiFi connection
You need an additional WiFi dongle to enable WiFi for the EV3 robot. It is a reliable connection, hence recommend for use. In case of connection failure, consider below steps:
1. Make sure to use a LEGO EV3 supported WiFi dongle along with latest version of the firmware (1.08). Most of the WiFi dongles are supported and this can be easily be tested if the EV3 robot is able to connect to your network.
2. MATLAB needs TELNET access to establish the WiFi connection. For TELNET access, make sure you are running LEGO EV3 firmware of version 1.09D or 1.08 E/H and lower. 1.09D needs a password for enabling TELNET. The firmware on the EV3 robot can be re-flashed using the official LEGO MINDSTORMS software.
3. Ensure EV3 robot and the host computer are on the same network. A ping test of IP address to your EV3 hardware from your host computer will help confirm this.
4. When deploying your Simulink Model, ensure EV3 brick is not showing device info screen as it prevents launching of the Simulink generated binary on robot.
For any further question, please refer Troubleshooting in MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware or MathWorks Technical support.

More Answers (0)

Tags

No tags entered yet.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!