LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple RS485 Devices connected via USB Converters

Hi, 

I have multiple devices that needs to be connected to PC via USB Hub. 
Now the thing I'm worried about is how do I program it so that I can have address of each device separately.

1) I need to know from software point of view how should I get started?
2) Data can be lost due to data collision because two or more than two devices can send data simultaneously?






 

Michael_Smith_0-1740655503169.png

 

0 Kudos
Message 1 of 15
(462 Views)

Hi Michael,

 


@Michael_Smith wrote:

1) I need to know from software point of view how should I get started?
2) Data can be lost due to data collision because two or more than two devices can send data simultaneously


  1. Write a driver VI that handles one COM port (for one device).
    Then scale up by using the same VI multiple times for different COM ports (when you conect to similar devices)…
  2. No, this will not happen.

What is the meaning of all those tags on your message?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 15
(454 Views)

1) I never used a USB hub, but I think it will not change the usual behaviour.Connect the USB-serial adapter one by one: with Device Manager (assuming Windows as OS) you will see a new COM port, for example COM15. If the adapter driver is "good", the assigned COM number will not change in future. There were in the past "bad" drivers that reassigned the COM port every time the adapter was disconnected and connected to another socket (maybe also to the same socket, I'm not sure).

2) I think that the driver can handle the devices in parallel. In any case USB band width is so huge compared to the typical serial baud rate, that a chance of collision would be very low.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 3 of 15
(451 Views)

Hello Gerd,

1. Is there any default VI to handle it? If yes, then from where can I find it? Also (My query is USB Hub won't consider the devices are connected on a single COM port?)
* Devices are not similar. I have (A) Servo Drive (B) Air Conditioner (C) Dehumidifier and 2 other devices


2. There is only one wire that is coming out of USB Hub which is connected to PC. All data traffic will be on that wire that's why I was thinking of data collision.


  1. @GerdW wrote:

    Hi Michael,

     


    @Michael_Smith wrote:

    1) I need to know from software point of view how should I get started?
    2) Data can be lost due to data collision because two or more than two devices can send data simultaneously


    1. Write a driver VI that handles one COM port (for one device).
      Then scale up by using the same VI multiple times for different COM ports (when you conect to similar devices)…
    2. No, this will not happen.

    What is the meaning of all those tags on your message?


    The tags were set on default. 
0 Kudos
Message 4 of 15
(435 Views)

Hello Pincpanter,


@pincpanter wrote:

1) I never used a USB hub, but I think it will not change the usual behaviour.Connect the USB-serial adapter one by one: with Device Manager (assuming Windows as OS) you will see a new COM port, for example COM15. If the adapter driver is "good", the assigned COM number will not change in future. There were in the past "bad" drivers that reassigned the COM port every time the adapter was disconnected and connected to another socket (maybe also to the same socket, I'm not sure).

2) I think that the driver can handle the devices in parallel. In any case USB band width is so huge compared to the typical serial baud rate, that a chance of collision would be very low.


1. USB Hub won't have a single COM Port usage? or it will show all COMs seperately?

2. I was reading about a data issue on RS485 communiciiton via USB-RS485 convertor - NI Community

 

0 Kudos
Message 5 of 15
(432 Views)

- you can view a USB hub as a multiplier of the USB sockets of your PC

- USB is not a passive buffer; it's arbitrated by active components that manage buffering and transmission times

- the number of COM ports depends on the number of converters you use: one converter, one COM port

- RS485 is a serial bus designed to allow the connection of multiple devices; each device will have its own unique address, set in the device configuration; also, devices are slave, that is they wait for a request of the master (your program) and will respond accordingly; however all devices must have the same protocol (say MODBUS RTU): if protocols are different, it's better to group the devices according to their protocol and manage them on separate serial lines

 

In your first post, it seems you want to use a converter for each device. Right?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 15
(398 Views)

@Michael_Smith wrote:

Hi, 

I have multiple devices that needs to be connected to PC via USB Hub. 
Now the thing I'm worried about is how do I program it so that I can have address of each device separately.

1) I need to know from software point of view how should I get started?
2) Data can be lost due to data collision because two or more than two devices can send data simultaneously?






 

Michael_Smith_0-1740655503169.png

 


I have walked this exact path before, how to connect many RS485 instruments to a PC. I was hired by a company that had a hardware configuration exactly like you show above. It was not desirable because it does not scale very well once you get into connecting 10, 20, 30 instruments.  We tried using a single USB to RS485 which scales fine (to 255) but you run into bandwidth limitations if the instruments are sending lots of data to the PC. Ultimately we went to TCP/IP and PoE as the solution as it is better in every way except for length of physical data lines, even then there are ways to get around that if that is an issue. I guess the caveat to all this is that the company was manufacturing the instruments and writing the software so we had a choice of the interface. 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
Message 7 of 15
(378 Views)

RS-485 is a multidrop topology where several devices can share a single communications bus, just set your devices to have unique addresses and only one RS-485 transceiver port is needed, not multiple ones.

 

-AK2DM 

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 8 of 15
(377 Views)

@Jay14159265 wrote:

I have walked this exact path before, how to connect many RS485 instruments to a PC. I was hired by a company that had a hardware configuration exactly like you show above. It was not desirable because it does not scale very well once you get into connecting 10, 20, 30 instruments.  We tried using a single USB to RS485 which scales fine (to 255) but you run into bandwidth limitations if the instruments are sending lots of data to the PC. Ultimately we went to TCP/IP and PoE as the solution as it is better in every way except for length of physical data lines, even then there are ways to get around that if that is an issue. I guess the caveat to all this is that the company was manufacturing the instruments and writing the software so we had a choice of the interface. 

 

 


Hello Jay, 

I understand the problem you ran into and appreciate your hardwork to resolve it. Can you please let me know if you tried it on LabVIEW, is yes can you share more details how you started? You started using an example VI or made your own?

0 Kudos
Message 9 of 15
(218 Views)

@pincpanter wrote:

- you can view a USB hub as a multiplier of the USB sockets of your PC

- USB is not a passive buffer; it's arbitrated by active components that manage buffering and transmission times

- the number of COM ports depends on the number of converters you use: one converter, one COM port

- RS485 is a serial bus designed to allow the connection of multiple devices; each device will have its own unique address, set in the device configuration; also, devices are slave, that is they wait for a request of the master (your program) and will respond accordingly; however all devices must have the same protocol (say MODBUS RTU): if protocols are different, it's better to group the devices according to their protocol and manage them on separate serial lines

 

In your first post, it seems you want to use a converter for each device. Right?


Hello @pincpanter
 
Yes dear, I will be using firstly RS485 to USB converters and then lateron connect all these USBs into a USB hub ultimately one USB cable to PC

0 Kudos
Message 10 of 15
(208 Views)