MyAdvantech Registration

MyAdvantech is a personalized portal for Advantech customers. By becoming an Advantech member, you can receive latest product news, webinar invitations and special eStore offers.

Sign up today to get 24/7 quick access to your account information.

Automatic Serial Data Collection



As many devices come equipped with some type of communication for data collection and monitoring, the amount of data that can be collected by a PC in a system is astounding. A problem arises, however, when multiple instruments or devices need access to the PC through the serial port, but only one port is available. 

There are multiple options for expanding the capability of a port that was designed to communicate with only one device. You can add a separate serial port for each RS-232 device that you need to talk to. By adding serial ports, multiple devices can have their own dedicated port, often concurrently, and at high speeds. The drawback is that separate serial ports may be expensive and require some effort to configure. There is also a practical limit on resources available inside the PC to allocate to serial ports. 

Multiple devices can be tied together by converting the signal at each point to a multi-drop bus, like RS- 485. This allows up to 32 devices on a single network without repeaters. The devices can also be connected up to 1200 meters (4000 ft) away from the PC. The disadvantage is that each device must have its own unique address. Also, some protocol needs to be established to prevent more than one device at a time from sending data to the PC. Usually this is done by having the PC poll each device individually. This does not lend itself well to devices that send their data automatically, without being requested. 

Using a Buffered Smart Switch, such as Model# BB- 232BSS4 from B+B SmartWorx, is an excellent way to collect data from multiple devices by utilizing RS-232 serial ports. Up to four instruments, card readers or time clocks can be connected directly to the BB-232BSS4, providing access through a single serial port on your PC. 

If you have more than four devices that are sending data, more than one BB-232BSS4 can be cascaded, allowing more ports to be added. The BB-232BSS4 buffers data from all ports at once, making it well suited for devices that will send a fixed amount of data at sporadic intervals, such as measurement instruments, security access card readers, barcode scanners or time clocks. Below is an explanation of how best to use the BB-232BSS4 to connect these devices to your PC. 

Figure 1 shows a typical setup, with multiple devices sending information at random times to the PC. The switches at Level 2 receive the data and send it on to the Level 1 switch. The Level 1 switch buffers the data and sends it to the PC. Each of the switches will automatically send the data when it is available. If another port has access to the PC, the data will be buffered until a path is available.


    Figure 1. Buffered Smart Switch Cascade


Cascading in Automatic Mode 

For best results, in an automatic system, the BB- 232BSS4 should be set up as follows: 

  • Set the switches to turn on the AutoSelect feature. 
  • Set the Port Timer to 0. 
  • Set the Inactivity Timer on all of the switches to between 50 and 500 milliseconds, depending on the space between data packets, and response time required to each connected device. 

If you need your software to identify which port sent the data, set up the port preamble on the Level 2 switches. Set each port to have a unique preamble. The preamble can be 1, 2, 3 or 4 characters long, and any characters can be used. The preamble will be added to the beginning of each new data packet arriving at the PC. The data collection software on the PC should be written to recognize this preamble as an address or identifier of the data source. 

Cascading in Polled Mode 

This configuration will also work with systems where the devices have to be polled for information. With the setup of Figure 1, the switches can be configured so that you still only have to send one set of switching characters. To do this, set the switches as follows: 

  • Set the switch on Level 1 to broadcast to all slaves on startup. 
  • Set the switch on Level 1 to AutoSelect mode, no preamble. 
  • Set the switch on Level 1 for 0 Port Time. 
  • Set the switch on Level 1 for a short Inactivity Time, around 5 milliseconds or so. 
  • Set the switches on Level 2 for no AutoSelect. 
  • Set the preamble on the Level 2 switches to be unique from each other. One suggestion is to use a 3 character command. Use the first character as a start of command character like STX. The second character could represent the address of the Level 2 switch you are going to. The third character is the command character. 

Write the software to send the command to select the port. By setting the Layer 1 switch to Broadcast and AutoSelect, only 1 set of command characters is needed.