Bluetooth Serial Connection Matlab Student

Posted on  by  admin

I have this bluetooth device powered by an arduino which I can connect via COM port in a serial monitor such as putty. However I cannot do this in matlab. However I cannot do this in matlab. I set this up as a normal com port as follows. Arduino Bluetooth Setup Tips. Try these tips to troubleshoot issues that you face while configuring Arduino ® Bluetooth ® setup. To connect to your Arduino hardware using an HC-05 or HC-06 Bluetooth module, make sure you have Instrument Control Toolbox installed.

Active4 years, 5 months ago

I am sending accelerometer data via bluetooth into Matlab where I will process it and build a GUI.

I am currently working on getting the bluetooth data into Matlab. I'm using a dongle which gets data into port COM18. This is the code I'm using:

When I start from scratch (disconnect and connect bluetooth and dongle, reopen matlab etc) The port successfully opens and allows me to read data. However, if I close and then try to open, it will give me an error:

Error using serial/fopen (Line 72) Open failed: Port COM 18 is not available. Available ports: COM6, COM7, COM19. use INSTRFIND to determine if other instrument objects are connected to the requested device.

I know that my device isn't connected to anything else. So I then have to disconnect my bluetooth, dongle, and restart matlab.

Is there a more efficient way to do this?

Also, I am able to get values from my accelerometer into Matlab, but I don't know how to make them continuous. Each time 512 bytes are sent and if my ValuesReceived exceeds 12000, I once again have to restart my bluetooth device to get more values. I've tried flushoutput, but it hasn't worked. Any ideas on how to get continuous data into Matlab so I can process it in my GUI?

Ben Reich
14.2k2 gold badges28 silver badges53 bronze badges
AzizelleAzizelle

Bluetooth Serial Connection Matlab Student Edition

1 Answer

I figured out the problem. In order to not get this error anymore I simply had to follow the sequence

and then when I do

Bluetooth Serial Connection Matlab Student

I am no longer getting the error. It was just the order of operation to close the serial.

AzizelleAzizelle
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Not the answer you're looking for? Browse other questions tagged matlabbluetoothaccelerometer or ask your own question.

Coments are closed
© 2019 - hublogoboss
Scroll to top