What is a virtual COM port?
A virtual COM port or a virtual serial port is an ideal solution for when a legacy software application expects a connection to a serial device port (COM port) but cannot connect, due to a physical lack of available serial ports. Instead, we reconfigure the computer to send serial port data over a local area network or the Internet as if over a true serial port. When the legacy application sends data to a serial COM port, it is actually transmitted over a TCP/IP network and back from the network to your legacy application -- and presto! -- we have a virtual serial or virtual COM port.
Why should I use a virtual COM port?
Most modern desktop computers and laptops no longer have the old school DB9 RS-232 serial ports (COM ports) that were traditionally used to connect directly to hardware used in commercial, laboratory or industrial safety and control systems. In many cases, even if they do, the number of available ports is very limited. This can be especially problematic if you still rely on legacy software applications that specifically communicate through those now non-existent (or very limited) serial ports. This is a bit of a different challenge than just converting a serial device’s interface to a USB or ethernet interface since the legacy software doesn’t know how to recognize or read USB or ethernet -- and resurrecting the software engineer that originally coded it probably isn’t an option.
We all need to upgrade computers from time to time to keep up with the latest OS and security requirements, not to mention just getting that new car smell, but that doesn’t mean your legacy serial software assets should suddenly be worthless...does it? We say down with obsolescence and waste!
We’re going to help you get more life out of your serial system while keeping your computer in the 21st century. NetBurner provides a free virtual COM port application that creates a virtual COM port that can be used to transmit serial data over the network (Internet or LAN) to NetBurner Serial to Ethernet Servers or Core Modules. This saves time and money by allowing you to continue to use your existing legacy applications.
Important Note: This tutorial deals exclusively with a NetBurner Serial to Ethernet Server virtual COM port implementation. An tutorial specific to creating a virtual COM port using a NetBurner Core Modules is still in the works.
Hardware and software required for the example
- A serial communications program, such as MTTTY serial terminal provided on our website.
- Virtual serial port software, such as NetBurners Virtual COM Port Driver provided in our website.
- One serial to USB converter dongle, such those made by Sabrent for sale here.
- A Serial to Ethernet adapter. Any of NetBurner’s serial to ethernet solutions will work.
Our test setup
We’re going to show you a very basic virtual com port configuration to display the ins and outs of getting a virtual com port running. We’re using our MTTTY serial terminal software as a placeholder for whatever legacy serial interface software app you may ultimately wish to use. MTTTY is a super useful serial communications diagnostic and debugging tool, so why not!
In our scenario the "legacy serial application" is the MTTTY application installed on our laptop which has an Ethernet connection and one USB port. First, we will create a virtual serial port on COM20 which will send data to the NetBurner serial to Ethernet (S2E) device server over the Ethernet connection. The NetBurner device will then send the received network data out of its own serial port (DB9) back to the laptop. This data will be read using the USB port on the laptop with the help of the USB to serial converter. We will use a second MTTTY terminal to read serial data from our USB converted serial port, COM6. The expected final behavior is that if we send data from one window, it will show up in the other, and vice versa.
How to setup the virtual COM port driver
1. Install the Virtual COM Port Driver software using the link provided above.The default installation directory for the software linked above can be found at C:\nburn\VirtualCommPort. From here, execute NBVirtualCommPort.exe. The application window will open...we’ll come back to this shortly.
2. Before we go further, we will need to know the IP address of your device, and the listening port number. With NetBurner devices, finding the IP address is as easy as using our IPSetup tool's search ability to discover our device on the network and looking at it's associated IP address. IPSetup can be found in the C:\nburn\pcbin\ directory of your install or just use your operating system’s search utility to find it.
If you are new to NetBurner products here’s a quick guide to help you use IPSetup. First make sure your NetBurner S2E device or Core Module is connected to your ethernet router or LAN. In our example we use the SB800EX. Second, power your devices either with an AC wall wart or via USB. Open the IPSetup software. Your device should appear in the “Select a Unit” field, but if not click “Search Again” and it should appear. If your device supports wifi, click the + sign the expanded information will reveal the unit’s current IP address. Otherwise, it should be listed on the main line of the device entry. In the figure below the SB800EX shows an IP of 10.1.1.130. Jot down this IP address to use later.
3. Now we need to go to your device's homepage, and discover its listening port. You can simply click “Launch Webpage” in IPSetup or type the IP of the device into your favorite browser. Then click the “TCP” hyperlink in the menu. The figure below shows the "TCP" page for our SB800EX Serial to Ethernet server device which has two serial ports, Port 0 and Port 1, respectively. Jot down the listening port for serial port 0.
4. Back in the Virtual COM Port application, click on "Add" in the Virtual Serial Port dialog box, which will bring up the "Edit Connection" window.
5. Next, from the “Select serial port” drop-down menu, select a comm port to associate with and give it a new “Connection Name”. In this case we chose COM20 and named it “Client_COM20” to correspond. Then, in the box labeled "Remote host name/port" enter the IP address of your NetBurner device followed by the listening port determined during the previous steps.
6. Click "Add", verify that the entry was added to the list, and then click "Apply".
7. Now we can see that our new virtual comm port has been successfully added to the main Virtual Comm Port application window.
8. Open two Multi-threaded TTY windows (the MTTTY serial terminal application). One window will be used for the USB Serial port, and one window will be used for the Virtual Serial Port. In our image below, COM20 was the virtual comm port we had set up, and COM6 is connected directly to our device via a serial port (in this case converted from the USB port- Universal Serial Bus).
9. Click connect and send data from the Virtual serial port or USB Serial port to confirm data is going back and forth.
Congratulations! You have now setup and tested your virtual com port. We hope that you can see how this example can be expanded upon to incorporate your own legacy serial comm applications and systems to work with newer computers that either have too few DB9 RS-232-style ports or none at all.