LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

controlling a 5v relay throught usb port

Solved!
Go to solution

Hi people

 

 

Seems someone search the same problem years ago.

 

http://forums.ni.com/t5/LabVIEW/Communication-between-PC-and-ATMEL-micro-controller-using-USB/td-p/6...

 

The microchip in my boad is an ATMEL 1522  TINY45  20SU

 

 

Best regards

cpalka

0 Kudos
Message 21 of 31
(4,739 Views)
0 Kudos
Message 22 of 31
(4,714 Views)

 Hi people

 

Can somebody tell me if mine

 

http://www.ebay.com/itm/5V-USB-Relay-1-Channel-Programmable-Computer-Control-For-Smart-Home-UK-selle...

 

Has a similar work of  this????

 

http://www.ebay.com/itm/8-Relay-I2C-USB-reprogrammable-on-board-CPU-5V-12V-24V-LabVIEW-drv-Arduino-/...

 

If yes I can build a vi with sub-vis created with dll file

 

cpalka

0 Kudos
Message 23 of 31
(4,652 Views)

Ok Friends

 

Seems this post have no solution (starting by me no knowdledge enought to resolve it)

 

I import the shared library and it creat a lvlib but when I try to run the subvis no one gives live to the relay......

 

Thanks to all

 

cpalka

0 Kudos
Message 24 of 31
(4,596 Views)

Hi friends

 

I buy a similar usb relay module, but this one connect to the COM port

 

http://www.ebay.com/itm/DC-5V-USB-Relay-Module-Computer-PC-Command-Smart-Control-Switch-Controller-B...

 

And with attached example it works perfect.

 

 

Best cpalka

0 Kudos
Message 25 of 31
(4,481 Views)

The Device I have is also a HID device (you can see with usbtreeview)

 

When I use the delivered c code, I can connect to the device.

 

If I want to use in LabView, I try to generate LabView code from Shared Library...

The Problem is that LabView does not like the c struct (defined in usb_relay_device.h) :

/*usb relay board info structure*/
struct usb_relay_device_info
{
unsigned char *serial_number;
char *device_path;
usb_relay_device_type type;
usb_relay_device_info* next;
};

 

When generating  LabView Code from Shared Library it ignores functions with the pointer to this struct, especially:

struct usb_relay_device_info *device_info = usb_relay_device_enumerate();

 

Smiley Sad

 

Any idea?

 

 

-------------------------------------------------------------------
Eugen Wiebe
Bernstein AG
CLAD - Certified LabView Associate Developer
0 Kudos
Message 26 of 31
(3,051 Views)

Hey!

 

Just found this thread because I had the same problem. Here's a solution:

you can use the .exe files provided at https://github.com/pkfrom/USBRelay

to communicate via labview with your relay.
I prepared a short example in the attached vi on how to control it easily.

You just need to find out your device serial number (as described in the ReadMe of the github) and have the CommandApp_USBRelay.exe and usb_relay_device.dll in the same folder.

Best,

Alex

 

Message 27 of 31
(2,787 Views)
Solution
Accepted by cpalka

I struggled with this and finally got it to work. Written in LV2016 and saved to 2012 version. 

Two options given, a single action run or a continuous loop. I hope this helps you. 🙂 

Message 28 of 31
(2,576 Views)

it works, Thank you very much!

0 Kudos
Message 29 of 31
(2,463 Views)

Hi JCS5920

 

 

 

Since 2016 that I start this topic and for coincidence I receive today a new module usb 2CH relays.

I though I buy a COM port communication, but was once gain HID.

After searching in the forum, I found this topic and I found your solution.

 

It work with my old 1CH USB relay and works with my new 2CH USB relays (I need to change it for 2 relays)

 

Many thanks

cpalka

0 Kudos
Message 30 of 31
(2,432 Views)