Main Site Documentation

Matlab


#1

I have managed to create a basic Galvanic Skin response system, using Microsoft Visual Studio and deployed onto the FEZ. The FEZ domino is now looping and returning the output values I need. However, my next task is to try and read the data in MATLAB, which does have limited ,NET compatibility. Does anyone know of any examples of this, or perhaps what would be the best method to do this?

Thanks in advance

TC


#2

You can use a serial port to read in the data into Matlab.

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f38496.html


#3

Wow, Thanks, I did not expect it to be that easy!!! You might say it was Frikin EZ :slight_smile:

My next challenge is to draw the data off the device. I was using the Debug.Print statement but I can’t seem to get it to display anything as yet, in MATLAB. The COM3 port is open and it gives me the attributes of the device/port. Is Debug the best way?

Thanks again

TC


#4

‘Debug.Print’ prints to the console, i.e. the Output tab in Visual Studio, unless you redirect it elsewhere. I don’t think that is your best solution though. I would look at first sending simple ASCII text over the com port and try receiving it in Matlab. Take a look at some of the projects over at (link removed) for ideas. Also, don’t forget about the resources available here: http://www.tinyclr.com
The free beginners book on that page also has some example code on using the serial port.


#5

I think th easiest way is to use Com1 on the UEXT connector

Connect the com port via a USB2Serial converter to the host computer

A adapter can purchased here

Then you can open Com1 and send the data to MatLab B)

Another option is to use the RS232 Shield. But my computer hasn’t a Com-port , so I prefer the USB2Serial converter.


#6

Or you can use a USB serial cable :wink: Unlike any other device on the market, FEZ support many USB devices including USB serial cables :smiley:


#7

Isn’t there a simple way for the host (PC) to connect to the device (FEZ Domino) using the existing USB connection and have them communicate with a stream?

Just being able to connect to the USB device and grab the debug info would be enough. the MFDeploy program can do it, so is there a class one can use to connect to the device and access the debug information stream?


#8

You can use USB client (device) to transfer data but then you can’t use it fro debugging. If you debug using serial then you can stream the data over serial!


#9

I don’t have a serial port on my laptop, so I will need an alternative data transfer method :S

Thanks for the info guys

TC


#10

You might use usb-serial cable?


#11

I think, for such a connection, the FEZ goes from USB (4pin) to serial. So on the FEZ side its a 4 pin USB and on the PC side its a serial port. I don’t have a serial port on my laptop so even the USB to serial cable would be of no use. Is that what you meant? Please, please correct me if I’m wrong!

What I need is to consider what Mez suggested and try and pull information from the FEZ through the USB, perhaps through the debug channel; or any other suggestions?

My Laptop connections are thus: Firewire, USB, S-Video, LAN, Modem, WiFi and both digital and analogue monitor connections. There is blue-tooth too. Could that be used??? Perhaps if I attached a blue-tooth dongle to the FEZ???

Thanks again peeps

TC


#12

As I mentioned before :smiley:

[quote]I think th easiest way is to use Com1 on the UEXT connector

Connect the com port via a USB2Serial converter to the host computer

A adapter can purchased here

Then you can open Com1 and send the data to MatLab

Another option is to use the RS232 Shield. But my computer hasn’t a Com-port , so I prefer the USB2Serial converter.

[/quote]

Or easier here

I have also a PC with 9-pin serial connector.


#13

Thank you Cypher, do you know if it is possible to butcher a USB cable to create the adapter? Do you know the pin configurations, USB side and FEZ?

Also, does the serial port then show up on the PC or are there additional steps needed for this?

Thanks again.

TC


#14

No you can’t use a “normal” USB cable. The cable from Sparkfun has a built-in FTDI USB2Serial chip.

When you use this cable you have to wire in the following way

FEZ Domino -------------> FTDI

UEXT Ground -------------> Pin1 / Black / GND
UEXT4 Com2 RX (IN) -------------> Pin4 / Orange / TXD
UEXT3 Com2 TX (OUT) -------------> Pin5 / Yellow / RXD

After plugging in the cable , you have to install the FTDI driver(from Sparkfun or FTDI website)

After installing you can use the new Com-port like any other Com-port.

BTW: In which country do you live? I think there were also a distributor of Sparkfun


#15

Thanks again :slight_smile:

I’m from the UK. I’m looking at…
http://www.coolcomponents.co.uk/catalog/product_info.php?products_id=356

…as I speak.

Awesome, thanks :wink:

TC


#16

Hello, with extreme caution and a happy smile :slight_smile: I was wandering how much experience one needs to have access to the Beta SDK referred to in “Topic: Domino as a USB device”.

Thanks in advance

TC


#17

http://www.tinyclr.com/forum/12/411/


#18

Hey guys,

Just a heads up… After setting the baud rate to be the same on both the output port on the FEZ and the input serial port on MATLAB, I am now able to read the data flawlessly inside MATLAB.

Thanks for all your help on this… I will add this on my other post too so it ties both problems together.

This FEZ really is Frickin EZ :smiley:

TC