From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
08-17-2020 03:05 PM
Hello Everyone,
I have been working on a labview program that will essentially control a set of motor in a machine. I currently have a simulation of what the final product will look like(attatched below) where the cube represents the different motors and the buttons control the cube. IN order to actually get this to work I need to connect my program to a set of relays that will send the signal to the motor driver to move a certain motor. I am new to LabView and I am having trouble figuring out how to send a signal to my relay. I want each button to send a signal to a specific relay. There should be three relays that are associated with the motor pair I want to use and then once that relay has been switched on a second signal should go to another relay indicating the direction. Sorry if my description is confusing but if anyone has any insight that would be greatly appreciated!
The relay I am using:
https://numato.com/product/16-channel-usb-relay-module
08-17-2020 09:20 PM
Have you downloaded and installed the drivers from the manufacturer's website? They say they have example code for LabVIEW.
09-09-2020 03:40 PM
Yes, I have looked at the driver that they provided. However, now I need to get my booleans in the event structure to communicate with the relays so that a specific relay will switch on when a press a certain button.
09-09-2020 10:31 PM
First, clean up your block diagram.
Second, I don't see how you are communicating with any relays.
Third, I do see some attempt at serial communication, but it only runs once as it is stranded outside of the loop.
09-10-2020 07:00 AM
sorry about my block diagram, I haven't gotten around to cleaning it up yet.
second I am not sure how to start communicating with the relays. This may sound dumb but I simply don't know how I should take my written code and get it to communicate with the relays. Ideally, when I press one of the buttons indicating direction on the front panel, that will send a signal to switch on a certain relay.
(sorry If I am being too vague, I just started using labview and I'm not 100% how to talk about it yet...)
thank you for your help!
09-10-2020 07:19 AM
Hi Mk,
@Mk.2020 wrote:
second I am not sure how to start communicating with the relays. This may sound dumb but I simply don't know how I should take my written code and get it to communicate with the relays.
I guess you have read the manuals provided here.
I guess you installed the driver that came with your relay board.
I guess you read the getting started information.
I guess you took a look at the example code provided by Numato.
What information is missing to you? What have you tried and where did you fail?
09-10-2020 08:42 AM
Here are a couple of VIs to get you started. One is a VI specifically for writing a value to a relay. Do note that I used a trick to make the formatting easier (format the relay value into a hex) and it will not work on a relay board with more than 16 relays, such as the 32ETHRL001 that I have been using (it's also Ethernet and uses a Telnet interface, but the commands are the same).
I also included a more proper example since the Numato example is truly worthless.
For more information on properly using a serial port, I very highly recommend you go watch this presentation: VIWeek 2020/Proper way to communicate over serial
09-10-2020 12:58 PM
Thank you for the examples!
to answer GerdW, I have looked at those resources now I just need to figure out how to turn the relays on and off via the booleans on my front panel. currently those booleans (right, left, up down...) are set up to control the position of a cube in a neighboring graph (this was for a simulation pre-relays) and are in event cases. However, in addition to moving the cube I also want the booleans to turn on a relay when pressed, as opposed to me manually choosing which relay to turn on. I am not sure how to go about doing this.