OpenViBE MATLAB Filter to Arduino

Concerning processing components: filters, file load/save, visualizations, communication ...
Post Reply
sumitsoman
Posts: 16
Joined: Thu Oct 11, 2012 11:24 am

OpenViBE MATLAB Filter to Arduino

Post by sumitsoman »

We want to send the classification output computed from EEG signals in the bci_Process function of the MATLAB filter to an Arduino board.

We are unable to receive the output (a single value +1/-1) on the Arduino COM port on which we created the connection.

Here is the code we are using:

Code: Select all

function [matrix_out,stim_out]=bci_Process(bci_context,matrix_in,stim_in)

 result = svmfxn(matrix_in, model2); % Our classifier output
 s1=serial('COM11', 'BaudRate', 9600); % Opening the Arduino connection on COM11
 fopen(s1);
 fwrite(s1, result)
 fclose(s1)
end
Is this the correct way to do this?
We are able to see the LED blink for opening the connection. But the write statement does not seem to work, which we verified from the Serial Monitor.

The OpenViBE scenario being used is attached.
ContinuousClassification.xml
OpenViBE Scenario
(18.34 KiB) Downloaded 285 times

jtlindgren
Posts: 775
Joined: Tue Dec 04, 2012 3:53 pm
Location: INRIA Rennes, FRANCE

Re: OpenViBE MATLAB Filter to Arduino

Post by jtlindgren »

Hi Sumitsoman,

the Matlab filter box is deprecated and will be removed in the next openvibe release. I suggest trying the scripting box instead.

Also, process() is called for each block, its probably not a good idea to use the port open/close all the time? How about opening it in initialize() instead, and closing it in uninitialize() ?

Does the connection and write work when you do it in a regular matlab function? No openvibe?


Happy hacking,
Jussi

Post Reply