MATLAB Answers

Matlab and arduino bluetooth H-05

조회 수: 4(최근 30일)
Itziar Uzqueda
Itziar Uzqueda 2017년 3월 6일
편집: Jose Lara 2017년 3월 8일
I'm new in reading data in Matlab from a bluetooth dongle I have in my PC. I have a H-05 blueetooth module connected to an Arduino Uno Board. I want the data coming from the Arduino to be sent to my PC and read data using Matlab. Is it possible? I think I have problems with the ports because an error appears saying that the PORT (COM8) is busy but is the one I want for reading data.
To sum up, I want to take data from a sensor, send it over Bluetooth and reading with Matlab


Jose Lara
Jose Lara 2017년 3월 8일
편집: Jose Lara 2017년 3월 8일
Hi Itziar,
Assuming you have implemented the H-05 Bluetooth module onto the Arduino Correctly and the Bluetooth dongle is receive signals from the module, reading the data is a simple process. However, you should use Simulink in order to retrieve information at real time. Just note that a license for both the Instrument Control Toolbox and Simulink is required.
First, you need a Serial Receive block. This block configures and opens an interface to a specified remote address using the Serial protocol. You also need a Serial Configuration block on your model which configures the parameters for serial port.
Change the parameters for these blocks accordingly. The Baud rate, data bits and Byte order may vary in hardware. In order to find the correct COM Port, you can navigate to the Device Manager (PC) in your computer and under "Ports", your Bluetooth dongle should appear. Double click on the device and look at the Port Settings. These settings must match the settings in the Serial Configuration block.
The data received from this block will not be easy to read and it is up to you to unpack the data correctly. If you have the Embedded Coder product, you can use the Byte Unpack block to convert the signal to the correct data type.
Below is an image of what your model may look like the image below:
Note that the output of the Byte Unpack block could be different depending on how you decide to implement the unpack algorithm. Also, use the Status outport of the Serial Receive block to know when data is actually being transmitted correctly.


Community Treasure Hunt

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

Start Hunting!

Translated by