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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

send signal to Relay

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

 

 

0 Kudos
Message 1 of 8
(1,730 Views)

Have you downloaded and installed the drivers from the manufacturer's website?  They say they have example code for LabVIEW.

0 Kudos
Message 2 of 8
(1,670 Views)

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. 

0 Kudos
Message 3 of 8
(1,614 Views)

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.

0 Kudos
Message 4 of 8
(1,606 Views)

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!

0 Kudos
Message 5 of 8
(1,591 Views)

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(1,586 Views)

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


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
0 Kudos
Message 7 of 8
(1,575 Views)

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.

 

 

0 Kudos
Message 8 of 8
(1,564 Views)