Main Content

Resolve Bluetooth Connection Errors

Issue

If you are unable to connect to a Bluetooth® device using the bluetooth interface, follow these troubleshooting steps.

Possible Solutions

MATLAB® supports the Bluetooth Serial Port Profile (SPP). You can identify any SPP Bluetooth device and establish a two-way connection with that device.

Configure Adapter

To connect to Bluetooth devices from MATLAB, your computer needs to have a built-in or external Bluetooth adapter. The adapter identifies Bluetooth devices within range when queried. After identifying nearby devices in the Bluetooth settings on your computer, you need to pair your device with your computer first before connecting to it from MATLAB. For more information about discovering and pairing your device, see Configure Bluetooth Communication Settings.

If a Bluetooth adapter is removed and a different one plugged in, all Bluetooth devices have to be paired again with your computer. If the same adapter is removed and plugged back in, then you do not need to pair the devices again.

If MATLAB does not detect your built-in or external adapter, restart Bluetooth services on your computer and update to the latest device drivers for your adapter. Then, restart your computer.

Check Device Status

Make sure that the Bluetooth device is turned on and that the Bluetooth service on the device is turned on. Bring the device within range of your computer.

View the status of your device in MATLAB by using the bluetoothlist function. You can connect to a device using bluetooth only if its status is "Ready to connect". Possible status values follow.

ValueDescription
"Ready to connect"Device supports SPP, is paired, and is not connected anywhere.
"Requires pairing"Device supports SPP and is not paired.
"Connected"Device supports SPP and is connected.
"Unsupported"Device does not support SPP.
"Unknown"Unknown if device supports SPP. Device is turned off or fails to respond to scanning request.

If your device status is "Unsupported", it does not support SPP. You cannot connect to it from MATLAB.

If your device status is "Unknown", it fails to respond to a scanning request. Make sure that it is within range, turned on, and not already connected outside MATLAB.

If your device does not appear in the bluetoothlist output, make sure that it is not connected to any other devices or applications. You can also try a larger value for the Timeout parameter in bluetoothlist. Using a larger value increases the amount of time MATLAB scans for nearby devices.

For more information about connecting to your device, see Configure Bluetooth Communication Settings.

Check Device Connection

Make sure you can connect to the device by creating a bluetooth object. You must provide two arguments to create the object, either the device name or address and a channel number. The specified channel number must match the channel number from the bluetoothlist output. For more information about creating a bluetooth object, see bluetooth.

After you connect to the device, you can communicate with it. For more information about communicating with your device, see Transmit Data Using Bluetooth Communication.

See Also

Related Topics