Host computer Bluetooth connection to Mindstorm EV3

4 views (last 30 days)
Error using legoev3 (line 196)
Failed to connect to EV3 through Bluetooth. Please check your Bluetooth connection.

Answers (1)

Chidvi Modala
Chidvi Modala on 23 Jan 2020
The following are few errors, their corresponding reasons and workarounds to connect to legoev3
Case 1:
Error:
>> myev3=legoev3(‘Bluetooth’,’<COMPort>’)
Error using legoev3 (line 192)
Failed to connect to EV3 through Bluetooth. Please check your Bluetooth connection.
Reason:
The main reason why this might not work is because of an incompatibility between the Bluetooth stacks on the host machine and the lego ev3 brick.
Workaround:
>> myev3=legoev3(‘bt’,’<HardwareID>’)
where the second input is the remote ID without the 'btspp://' prefix
This requires ICT toolbox
Case 2:
Error:
>> myev3=legoev3(‘bt’,’<HardwareID>’)
Error using legoev3 (line 192)
Failed to connect to EV3 through Bluetooth. Please check your Bluetooth connection.
Reason:
There might be incompatibility issues with Bluetooth dongles and the EV3 brick. MATLAB can connect to the EV3 hardware only when it pairs with the host machine. If the pairing is not successful, the connection from MATLAB cannot go through.
Workaround:
Check if they you are using the official Bluetooth dongle provided by LEGO
Case 3:
Error:
>>myev3=legoev3(‘bt’,’<HardwareID>’)
But ended up with the following error:
Error using legoev3 (line 143)
Instrument Control Toolbox is required for this functionality.
Reason:
The issue that is generally observed is that the Bluetooth stack of EV3 has issues connecting to Windows.
Workaround:
The general recommendation is to use the ICT API to connect as it works in most of the cases.
The Bluetooth adapter on Windows creates two com ports. You can check connecting with the second com port. Once you have plugged in the Bluetooth adapter to the Host machine, you can open the hardware manager.
The Bluetooth adapter shows up as a COM port device.
Here you can see that there are two entries. One will match the number you would have found using the procedure mentioned in 'https://www.mathworks.com/help/supportpkg/legomindstormsev3io/ug/connect-to-an-ev3-brick-over-bluetooth-using-windows-1.html', the other COM port is what we are referring to.
Case 4:
Error:
>>myev3=legoev3(‘Bluetooth’,’<COMPort>’)
Error using error Unable to load a message catalog 'legoev3io:build'. Please check the file location and format.
Error in legoev3 (line 206) error(message('legoev3io:build:Legoev3BluetoothFailed'));
Workaround:
There are a couple of potential options here:
  • Try replacing the Bluetooth stack. Sometimes the (default) Generic Microsoft Bluetooth radio stack does not work with Virtual Serial Ports. Some users have reported success using serial over Bluetooth with vendor specific Bluetooth stacks, with the vendor in question being the vendor of the Bluetooth radio (Broadcom, Cambridge Silicon Radio (CSR), Toshiba, etc.). Look in Control Panel and search for the vendor specific driver based on the device's VID & PID.
  • Use the 'Bluetooth' functionality from Instrument Control Toolbox as the transport.
  1 Comment
Bavantha Lakshan Udugama Udugama Vithanage
Thank you so much for the detailed explanation. I was struggling to find a answer for this issue for almost 4 hours. Finally, ...
myev3 = legoev3('bluetooth','COM3')
Error using legoev3 (line 196)
Failed to connect to EV3 through Bluetooth. Please check your Bluetooth connection.
>> Bluetooth('LEGO',1)
Bluetooth Object : Bluetooth-LEGO:1
Communication Settings
RemoteName: lego
RemoteID: btspp://0016534DD7DB
Channel: 1
Terminator: 'LF'
Communication State
Status: closed
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
>> myev3 = legoev3('bt','0016534DD7DB')
myev3 =
legoev3 with properties:
FirmwareVersion: 'V1.09H'
HardwareID: '0016534DD7DB'
IPAddress: []
CommunicationType: 'Bluetooth'
BatteryLevel: 100
ConnectedSensors: {'' '' '' ''}

Sign in to comment.

Categories

Find more on MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!