Interfacing RS232 instruments to a TCP/IP network
Authored by Tom Lutz, TALtech - instrumental software solutions.
Most modern electronic instruments including bar code scanners, measuring tools and laboratory instruments (balances, electrochemistry meters, spectrometers, spectrophotometers, measuring instruments, etc.) are designed to interface to a computer using a standard RS232 serial cable connection. The RS232 serial communications protocol has been around for many years and is extremely well established with a number of inexpensive hardware and software solutions available for it. Almost all computers are equipped with at least one RS232 serial port with add-on serial adapters being widely available. There are also hundreds of software applications available for communicating with instruments through RS232 connections. Because of the flexibility and the ubiquity of the RS232 standard, it is likely to remain the interface of choice for most instruments well into the future. Even many newer devices that connect to a PC through a USB port are shipped with drivers that emulate a standard RS232 COM port so that they remain compatible with traditional RS232 communication software.
A Problem with RS232 Communications
The problem with RS232 communications is that it requires a hard wired, point-to-point cable connection that is limited in the distance that you can run a cable. You must also run a separate cable connection to a unique RS232 serial port on a PC for each instrument that you need to communicate with. This means that if you want to connect multiple devices to a single PC, you must install multiple RS232 serial ports on the PC. Not only can this get messy, it also makes it difficult to interface an instrument to more than one computer.
If the RS232 standard were to be improved upon, it would allow multiple connections through a single cable, there would be no restriction on the length of the cable and it would remain 100% compatible with all currently available serial communications software.
Fortunately there is a very simple way to accomplish all of the above improvements (and more) using currently available and reasonably inexpensive hardware or software. The trick is to use an RS232-to-TCP/IP converter (a software or a hardware based "serial device server") to convert the RS232 serial connection to a TCP/IP network connection. You would then be able to use an existing Ethernet network as the backbone for connecting all the RS232 instruments to all the PCs in a network.
You could use either a small hardware device called a "Serial Device Server" or you could use a software RS232-to-TCP/IP converter to expose the serial ports on a PC to a TCP/IP network. An RS232-to-TCP/IP converter essentially allows you to use a PC as a serial device server.
How it Works
The way that it works is that you use your existing network instead of running RS232 serial cables and then connect the RS232 serial instruments directly to the network using an appropriate (hardware or software) converter. A hardware based serial device server is a small box that has a RS232 serial port on one side and an Ethernet connector on the other. It is basically a small computer that establishes a network connection and then feeds any data that it receives through the RS232 port out over the network connection through a TCP/IP port and vice versa. The hardware device servers must be plugged into the network through a hub or switch using standard network cables. In most cases, the TCP/IP network protocol is used to pass data across the network to other workstations. This means that each device server would need to be configured with a unique IP address just like each PC that is connected to a TCP/IP network has its own unique IP address. The serial device server thus becomes just another node on the network.
An RS232-to-TCP/IP converter is a program that you run on a PC to expose the serial ports on that PC to the network. In other words, it does the same job as a hardware based serial device server except that it is a software program that you run on a PC. You still connect the instrument to a RS232 serial port on the PC, however the PCs network connection is used to share the serial ports on that PC with other workstations in the network. The IP address of the PC where the RS232-to-TCP/IP converter is running is used for all of the exposed serial ports on that PC and you configure it to feed data from each serial port through a different TCP/IP port.
To make everything work transparently with existing software, you would also need the ability to create a "Virtual COM Port" on every PC in the network that needs to communicate with each RS232 device. The "Virtual COM Port" tricks your PC into thinking that the serial port on the serial device server (or RS232-to-TCP/IP converter) is actually a serial port installed locally on your PC. In other words, the "virtual" serial port behaves just like a real serial port except that it actually establishes a TCP/IP connection through the network to the serial port on the serial device server. Any existing software that is designed to open a standard RS232 serial port would then be able to open the serial port on the serial device server just as if it were a serial port installed directly in your PC. You can think of it as using your network as an RS232 serial cable. Not only do you gain access to all your RS232 instruments from any PC connected to your network (or across the Internet if configured correctly), you do away with having to run cables directly from a device to a specific PC. If you use hardware based serial device servers, none of the PCs that you might want to use will need any RS232 serial ports at all.
In addition, with the right software or hardware, more than one workstation can communicate with the same RS232 device simultaneously - something that is not possible with RS232 devices that are connected directly to a PC.
|Click [+] for other articles on||The Market Place for Lab Automation & Screening||The Market Place|