MATLAB Answers

USB Relay Board Numato - Sending Commands

4 views (last 30 days)
Fabien Jammes
Fabien Jammes on 6 Nov 2017
Answered: rasp pie on 16 Dec 2017
Dear all,
For our experimental setups, we have been using USB relay modules from Numato and use LabView to send the commands. It works fine. I would like to implement it in Matlab for my project. While I can connect to the device, writing the command 'relay on 1', to activate the first relay, does not work.
For instance:
obj = serial('COM8');
fopen(obj);
fprintf(obj,'relay on 1');
The code works but nothing happens. I wonder if I need to create a VISA for this, as in LabView the functions used are 'VISA write'. But if it is the case I don't know how to do it...
Thanks for your help !

  0 Comments

Sign in to comment.

Answers (2)

andrea balestrero
andrea balestrero on 4 Dec 2017
Hi, try to change the terminator parameter of the obj structure: obj.Terminator = 'CR' instead of 'LF', which should be the default one.

  0 Comments

Sign in to comment.


rasp pie
rasp pie on 16 Dec 2017
Hi, To control the relay through serial you will need to define the serial comm parameters. I have used this relay board ncd.io USB Relay Board with this matlab example code Matlab USB Relay example You will need to change the command vales to make it work with your relay board. Hope this helps. Cheers!!!!

  0 Comments

Sign in to comment.

Sign in to answer this question.