How can I interface BITalino with Matlab / Simulink?

Python, Java, Android OS, etc.
BITalino
Site Admin
Posts: 567
Joined: Tue Aug 27, 2013 3:47 pm

How can I interface BITalino with Matlab / Simulink?

Postby BITalino » Sun Sep 08, 2013 5:49 pm

Although there is no native support, you have multiple interfacing options that can be considered for real-time data acquisition and control of the device:

1) You can use the command set recognized by the device and data packets structure sent by the device in real time with the sampled data, to interact directly with a BITalino from the MathWorks tools via standard serial interface (requires that you setup a Virtual COM Port): http://www.mathworks.com/help/matlab/serial-port-devices.html

2) APIs in Java and C/C+ provide a high-level set of functions to interact with the device, and which perhaps could be called from within the MathWorks tools

3) We have a Python-powered server that can be interfaced with using socket connections, and which can serve as a proxy between the MathWorks tools and the device

Option 1) should be the most efficient and preferable method. Contact us (bitalino@plux.info) for additional information or support.

BITalino
Site Admin
Posts: 567
Joined: Tue Aug 27, 2013 3:47 pm

Re: How can I interface BITalino with Matlab / Simulink?

Postby BITalino » Sat Dec 07, 2013 7:01 pm

The BITalino crew has recently created a Matlab API, that can be downloaded from our website at:
http://www.bitalino.com/anatomy-bitalino/

BITalino
Site Admin
Posts: 567
Joined: Tue Aug 27, 2013 3:47 pm

Re: How can I interface BITalino with Matlab / Simulink?

Postby BITalino » Mon Mar 24, 2014 11:18 am

We would like to know how we should interpret the data output with the Matlab api. What is the value of each, of the six, columns?


The column mapping should be as follows:

Col. 1) 4-bit sequence number (starts in 0 and overflows at 15), that can be used to detect sample gaps
Col. 2-5) 1-bit number corresponding to the state of digital inputs labeled I1-I4 on the device
Col. 6-) Analog inputs labeled A1-A6 on the device

Best regards,
The BITalino Team

chaka
Posts: 2
Joined: Tue Mar 25, 2014 7:42 pm

Re: How can I interface BITalino with Matlab / Simulink?

Postby chaka » Thu Apr 17, 2014 8:55 am

Hi all,

I use the Matlab API by Bluetooth to connect bitalino with my pc.
But i have a matrix and i don't what elements correspond to ECG, EDA, EMG ....
and is it possible to put just ECG in a différent matrix ? ?
Best regards

BITalino
Site Admin
Posts: 567
Joined: Tue Aug 27, 2013 3:47 pm

Re: How can I interface BITalino with Matlab / Simulink?

Postby BITalino » Thu Apr 17, 2014 1:13 pm

chaka wrote:Hi all,

I use the Matlab API by Bluetooth to connect bitalino with my pc.
But i have a matrix and i don't what elements correspond to ECG, EDA, EMG ....
and is it possible to put just ECG in a différent matrix ? ?
Best regards


Hi Chaka,

You can use the Matlab slicing operators to extract a vector corresponding to each of the channels.

If you acquire just the ECG channel (call to start([x]), in which x is the ECG channel), it should correspond to Col. 6 on your data matrix.

If you acquire all the channels (simple call to start() with no arguments), it should be Col. 8.

Best regards,
The BITalino Team

mpaulin
Posts: 3
Joined: Sat Apr 19, 2014 2:28 am

Re: How can I interface BITalino with Matlab / Simulink?

Postby mpaulin » Sat Apr 19, 2014 9:59 pm

Hi:
The MATLAB testAPI script returns "not connected".

My Bitalino is on and I can acquire signals OK using OpenSignals, so the problem is not in the hardware.

The Bitalino.m class constructor gets to this line,

self.socket = Connector.open(strcat('btspp://',self.macAddress,':1'), Connector.READ_WRITE);

which is evidently trying to open a connection to the BT module, but then skips to the 'catch' and prints "not connected".
My guess is that it has the wrong MAC address passed from testAPI.m.

How do I specify the MAC address? I have tried

mac = '98:d3:31:b2:14:18'

which is my Bitalino's hex MAC address, and the decimal equivalent

mac = '168032839275544';

and (obviously) the default MAC address in the script:

mac = '001301040216';

I get the same result every time.

Please advise. How do I connect & receive signals in MATLAB??

Thanks.

mpaulin
Posts: 3
Joined: Sat Apr 19, 2014 2:28 am

Re: How can I interface BITalino with Matlab / Simulink?

Postby mpaulin » Sat Apr 19, 2014 10:45 pm

OK got it. The MAC address is specified as a string in hex without the colons. A tiny bit of documentation (like a comment or two in the MATLAB code) would help a lot :D

BITalino
Site Admin
Posts: 567
Joined: Tue Aug 27, 2013 3:47 pm

Re: How can I interface BITalino with Matlab / Simulink?

Postby BITalino » Sun Apr 20, 2014 7:20 am

mpaulin wrote:OK got it. The MAC address is specified as a string in hex without the colons. A tiny bit of documentation (like a comment or two in the MATLAB code) would help a lot :D


Hi,

Please accept our apologies for the missing comments and documentation.

In fact any contribution you could make on that front would be very welcome ;)

Best regards,
Hugo Silva

edgarledezma
Posts: 1
Joined: Wed Oct 15, 2014 5:42 pm

Re: How can I interface BITalino with Matlab / Simulink?

Postby edgarledezma » Wed Oct 15, 2014 5:45 pm

mpaulin wrote:OK got it. The MAC address is specified as a string in hex without the colons. A tiny bit of documentation (like a comment or two in the MATLAB code) would help a lot :D


How did you solve it? I've tried it for hours and it doesn't work

anaritam
Posts: 5
Joined: Fri Nov 07, 2014 8:21 pm

Re: How can I interface BITalino with Matlab / Simulink?

Postby anaritam » Fri Nov 07, 2014 8:27 pm

Hi,

I'm trying to display in real time the data acquired from the bitalino (and analyze it also in real time) in Matlab but I'm a little confused with all the channels and where should I put the code for ploting (if in the end of the start function or in the write function). Could you help me?

Thanks for you time


Return to “Programming APIs”