Hello, I am hoping to use LabView to control a small relay with a USB port. Some other forum posts suggest that this isn't quite possible - I'd have to do some funky stuff with Windows to accomplish this. However, on our testing floor, this has apparently been accomplished with LabView, and I have found the code that's used (below is a screenshot of some of the code). On the testing floor, there is a computer with a USB cable going to a small homemade relay box to control a few different relays. I haven't been able to find the schematic or take apart the box, but I've been told it was made by an old engineer here and is mostly made up of shift registers and relays and just uses the data wires of the USB cable (I think).
I've tried to test this code on a USB wire that I've chopped up and have connected to an oscilloscope, but so far no good. "USB-DIO" (as shown in the screenshot) must be a custom name given a device, right? The error I get is that LabView can't find an instrument. Is there a way to "fake" a connected instrument in NI MAX and send a high signal through a specific USB port? That seems like what is going on in the screenshot, but I could be wrong.
Solved! Go to Solution.
The used VIs look definitely like DAQmx VIs, so your claim that it is just a bare USB cable is almost certainly NOT true. DAQmx works specifically with National Instruments DAQ hardware and nothing else. So somewhere in that hardware box you saw there must be a National instruments interface. NI does sell some of their USB hardware as OEM hardware (for instance here for the USB-6501), which means you get a bare PCB with no housing or anything. This is most likely one of these. In reality the hardware is still an NI USB 6501 or similar.
In NI-MAX you then can setup all NI hardware and give it any (unique) name you desire. By default DAQmx likes to call all the devices Dev1, Dev2, Dev3 and so on. But you are free to rename them in NI-MAX to USB-DIO for instance. The only strict requirement is that each device has a unique name on the particular computer.
Thank you both for the replies. I was skeptical about the relay box just being made up of basic electronics. Hopefully, I can get the opportunity to take it apart and see what exactly is in there. I have worked with LINX before, so I may just stick to an Arduino as you mentioned.
Or you can get off the shelf one like this,
This one can still be controlled using LV over serial protocol. It depends on what you prefer, whether NI DAQ + Relays, Arduino + LINX + Relays or USB Relays