Azzera filtri
Azzera filtri

Solved - Connecting LEGO EV3 to MATLAB

9 visualizzazioni (ultimi 30 giorni)
Theodore il 25 Gen 2014
Commentato: Stephen Gulo il 13 Apr 2021
Hi there - I am a beginner and got tons of problems just finding the right buttons and sequence to get MATLAB to recognize my LEGO EV3 brick. Somehow everybody assumes the first steps and beginners get stuck at very simple things.
If you are a beginner like me these steps will spare you days of poking around!
1. Bluetooth
Install blue tooth if you do not already have it. Buying LEGO’s recommended Bluetooth adapter maybe an option if you have to go out and buy one. In my case I just bought a generic Bluetooth adapter from Amazon (Medialink USB Bluetooth Adapter - Version 4.0 Class 2).
2. LegoMindsorms LabView project environment
2.1. Just install the default EV3 environment from the Lego Mindsorms website.
2.2. Find your EV3 brick
Connect your brick using the USB cable that came with it. Power it on. Open the LabView software – looks like that:
Open one of the default Mindsorms projects – looks like that:
2.3. Name your Brick
Bottom right corner there is a window like that – name your brick there. In my case the name is MAXAI2000 (look for it in the samples below). Then Press the download button under the EV3 logo in the same window. Once you hear your brick make a sound you will see that name appear on the LCD of the brick.
Connection from MATLAB:
1. Start MATLAB
2. At the command prompt run this:
EDU>> Bluetooth('MAXAI2000', 1 )
Be patient!!! and wait. You will get something like this: From it, remember the RemoteID
Bluetooth Object : Bluetooth-MAXAI2000:1
Communication SettingsRemoteName: MAXAI2000
RemoteID: btspp://00165340B761
Channel: 1
Terminator: 'LF'
Communication State
Status: closed
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
3. On the top bar of MATLAB click: Apps Tab -> Instrument Control ->
Type in the Remote ID that you copied from running the Bluetooth command.
Run “Connect”.
Be patient!!! and wait. Expecting instant result and thinking that the process is hanging cost me a lot of failed attempts and frustration. 30 seconds or more response time seems to be quite normal.
You will see this.
You are connected!!
  2 Commenti
Stephen Gulo
Stephen Gulo il 13 Apr 2021
Hello @Theodore, I've already follow your instruction and it works. Now I want to verify the bluetooth connection by play beep sound like in this source:
could you tell how to do similar task since your making bluetooth connection method was different from link above. Thank you

Accedi per commentare.

Risposte (0)


Scopri di più su MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware in Help Center e File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by