12-07-2012 04:39 PM
Hello,
I am trying to control a SainSmart 4 channel 12VDC relay (http://www.sainsmart.com/relay/sainsmart-4-channel-12-v-usb-relay-board-module-controller-for-automa... from Labview and having some trouble. I was hoping to control the module via serial comms but this does not seem to be working. Can anyone suggest an example that I might follow to set this up?
Thanks,
James
12-10-2012 03:47 PM
Hi James,
FYI The link you provided below seems to not be working...
What version of LabVIEW are you using? From LabVIEW 2012 if you navigate to Help > Find Examples and then browse to Hardware Input and Output > Serial there are lots of examples that you could use to get you started. Our other versions of LabVIEW should have similar shipping examples as well.
Here is a link to some documentation you might find helpful in getting started as well:
http://digital.ni.com/public.nsf/allkb/E22DA85E97818DE78625678C0069BFC9
Please give these resources a look and let me know if anything is unclear. Have a great day!
12-10-2012 05:20 PM
James,
Interesting module!
It appears that they use the FTDI chips which provide for virtual COM port operation over USB. However, a quick glance through the documentation files does not show any hints of how to configure the virtual port or what commands are used to control the module.
Have you tried to contact the company to see if they will gieve you the port configuration settings and the command protocol? With those data it will probably be fairly easy to write a LV prorgram to control the module. Without it would be a guessing game with a very large number of variables.
Lynn
10-25-2017 09:15 AM - edited 10-25-2017 09:15 AM
If someone could try this and see if works for them. We are using this one on two separate computers with a SainSmart USB 4CH relay board that has the FT245 ftdi chip. This VI is crude, but works for us.
10-26-2017 08:51 AM
Hi Mercedes300turbo,
It would be in your best interest to start a new forum post since this one is 5 years old. That will give you better visibility and allow you to ask the specific questions you have for your set up.
Thanks!
10-28-2017 10:34 AM
There's a LabVIEW driver available on their site ... https://www.sainsmart.com/products/8-channel-12v-usb-relay-module
Download and unzip the "Manual" link. There's documentation and a vi in there that looks like below..
The documentation also says there's more code here: http://www.kmtronic.com/software-examples.html
Craig
07-13-2018 03:04 PM
Just to add a note for future users: I found the documentation on the SainSmart website to be incomplete. The solution provided by Mercedes300turbo provides device initialization that is missing in the VISA example. However, on my device the code only enabled me to close one relay at a time. To get around that, I implemented the following:
Clearly the provided FTDI VIs need some work to match good style, but the functionality is there. The 4CH Output control is an array of 4 Booleans. The True values activate the Relays where the False do not.
07-28-2018 09:00 AM
I recently bought 4 of the 4-port 5V relay boards from Sain Smart. I too am struggling to get this working with Labview. As Will said, Mercedes300turbo's version is apparently missing some setup because I could not get it to work consistently. It looks like Will's version (and correct me if I am wrong) works if you only have 1 relay board connected to your PC. I am going to play around with it later. Not familiar with the FTDI VI's.
07-28-2018 09:07 AM - edited 07-28-2018 09:07 AM
True, mine searches for the first board it finds and uses that address. But you should be able to replace the search with specific addresses for specific boards. You need the initialization, otherwise the board likely won’t respond.
Hope that helps!
07-29-2018 09:57 AM
Will,
It looks like a few of your VI's are not part of the FTDI package unless you renamed them...I believe set bit rate is one of them. I am working on this now. I did try the FTDI example and pulled in the write string portion of yours with no luck. I am sure I will figure it out but I really wished I picked a relay that already had a driver already created. All I want to do is choose the COM port and set appropriately. 😞