After much time spent struggling to find some kind of tutorial to interface Matlab with a Velleman K8055 USB I/O board, I finally gave in and tried it myself. It actually wasn't all that hard. All that was required was the initial connection using the boards DLL. Here are the source files to
download .
Included in this RAR file are the following:
- K8055 User Manual containing all the commands that can be used
- The M-File for Matlab
- The Dll and header file needed to access the board
For those of you who don't know much about this really useful I/O board, check out the Velleman
site.
Basically what I did was write a short M-File to connect to the board, and display, in a separate window, all the commands present in the DLL. Once the function '
K8055_Connect' is called in Matlab, the user is prompted to supply the address of the board. This is selected by placing jumpers on the board, but check the manual to see how this is done. Then, Matlab tries to connect to the board. If it is a success, a separate window will pop up giving the user a list of all the functions that can be called to access the board's many digital and analog inputs and outputs.
These functions can be called by using
calllib in Matlab:
Eg:
calllib('K8055D', 'SetDigitalChannel',0);
This sets the first digital output high.
The nice thing about having such a board is you can now get data live from the real world and interface it directly to Matlab. You can get your program to sense, do some calculations, plot some graphs etc, then react. The perfect toy for all your
Mechatronics projects involving matlab.
If you have any problems with the code or have any improvements to the code, just let me know. Oh, and please let me know about your project using this info.
Enjoy!