Connecting a USB device to MATLAB to receive data

85 Ansichten (letzte 30 Tage)
Kevin
Kevin am 13 Jul. 2023
Beantwortet: Ralf Handrich am 25 Jun. 2024
Hello.
I am trying to connect a device that collects data and outputs that information through a usb to a computer. A software exists to receive the information but the goal is to bypass that and send the information directly to matlab. The device streams 43 bytes every 53 usec, the packet structure starts with a 16 byte header that starts with ASCII spelling out yoho, bytes 17-19 contain status of the device and bytes 20-43 contain the information of the sensors, the information in bytes 20-43 are split into three byte chunks (ex. s1 20-22, s2 23-25, s3 26-28). The device is sampling at 19.23 kHz so if the data cant be received at that speed or faster the data is not viable.
Thank you for any assistance
-KT
  1 Kommentar
chrisw23
chrisw23 am 20 Jul. 2023
Look for a .net compatible driver, load the assembly and instantiate the class to get a driver object.
asm = NET.addAssembly(<pathToYourUsbDriver.dll> ) % look for classes provided under asm.Classes
myDrvObj = <identifiedUsbDriverClass>
myDrvObj.<OpenCommunication> % i.e. to open device communication
use details(myDrvObj) / methodsview(myDrvObj) to get API informations or read the API description provided

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Rishav
Rishav am 4 Sep. 2023
Bearbeitet: Rishav am 5 Sep. 2023
Hi Kevin,
I understand that you are trying to receive information from USB directly to MATLAB.
Please refer to the below mentioned documentation for the same:
Also refer to this documentation for a brief idea on 'serial' function:

Ralf Handrich
Ralf Handrich am 25 Jun. 2024
Hello Kevin,
you can try AHid.dll. It's a commercial product, but there is also a free version that you can try:
Best regards, Potter

Kategorien

Mehr zu Instrument Control Toolbox Supported Hardware finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by