What is a virtual COM port?
A virtual COM port or a virtual serial port is an ideal solution when a legacy software application expects a connection to a serial device port (COM port or COMM 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 attempts to send data to a serial COM port, it is actually transmitted through the virtual serial port over a TCP/IP connection. Information sent back to the legacy application also travels over the network where it is received by the virtual serial or virtual COM port, and is then finally passed to your legacy application.
As Used in This Article
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 the 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 problematic if you still rely on legacy software applications that communicate through those now non-existent (or very limited) serial ports. The challenge here is different than just converting a serial device’s interface to a USB or Ethernet interface. This is because the legacy software doesn’t know how to recognize or read USB or Ethernet data — 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. However, 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 a network (Internet or LAN) to NetBurner Serial to Ethernet Servers or System on Modules. This saves time and money by allowing you to continue using your existing legacy applications.
Important Note: This tutorial deals exclusively with a virtual COM port implementation that is used with NetBurner devices. If you are looking for a native software solution to create virtual COM ports for use with other systems or hardware, we suggest the Virtual Serial Port over Ethernet Connector or the Virtual Serial Port Driver from our partners at Eltima Software. They are both incredibly stable and versatile utilities that support various Windows versions, up to the latest Windows 10.
Hardware and software required for the example
- A Serial to Ethernet adapter. Any of NetBurner’s serial to Ethernet solutions will work.
- A serial communications program, such as the MTTTY serial terminal provided on our website.
- Virtual serial port software, such as NetBurner’s Virtual COM Port Driver provided on our website. (License Terms)
- One serial to USB converter dongle, such those made by Sabrent for sale here.
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. Please note that the virtual COM port driver provided on our website can only be used with NetBurner’s serial to Ethernet (S2E) hardware and System-on-Modules. To set up a virtual serial port configuration that can be used with any type of device over a network, we recommend the Virtual Serial Port over Ethernet Connector from our partners at Eltima Software. This application allows for the creation of any number of virtual COM ports with preassigned parameters. It can be used to establish a connection with hardware serial device servers over an Ethernet connection, as well as to create links with virtual serial ports created on other computers.
In our scenario, we will run an instance of the MTTTY serial terminal application to represent both ends of our communication path. First, it will represent the “remote client” that is connected to the NetBurner serial to Ethernet device through the serial to USB converter. Second, it will represent the “legacy serial application” that is sending and receiving data to this device through the virtual COM port.
We will start by creating a virtual serial port on COM20. This will allow us to send data from the ” legacy serial application” MTTTY instance to the NetBurner serial to Ethernet device over an Ethernet connection. The NetBurner device will then send this 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 a USB to serial converter. Finally, we will use the “remote client” MTTTY terminal to read the data from our USB converted serial port, COM6. This communication path is bi-directional. This means that data sent to one MTTTY terminal instance will show up in the other, and vice-versa.
How to setup the virtual COM port driver
- Install the Virtual COM Port Driver software. 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.
- 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. 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 System on Module is connected to your Ethernet router or LAN. In our example, we use the SB800 EX. Second, power your devices either with an AC wall wart or via USB (if you are using a development carrier board, and have the jumper configuration setup to do so).
Open the IPSetup software. Your device should appear in the “Select a Unit” field, but if not click “Search Again” and wait for it to show up. If your device supports WIFI, clicking the “+” sign will expand the device’s entry to reveal the unit’s current IP address. Otherwise, it should be listed on the first line of the device entry. In the figure below, the SB800 EX shows an IP of 10.1.1.130. Jot down this IP address to use later.
- 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. Click the “TCP” hyperlink in the menu. The figure below shows the “TCP” page for our SB800 EX, which has two serial ports, Port 0 and Port 1, respectively. Jot down the listening port for serial port 0.
- 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.
- Next, from the “Select serial port” drop-down menu, select a COM port to associate the virtual COM port with, and give it a new “Connection Name”. In this case, we chose COM20 and named it “Client_COM20”. 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.
- Click “Add”, verify that the entry was added to the list, and then click “Apply”.
- Now we can see that our new virtual COM port has been successfully added to the main Virtual Comm Port application window.
- Open two Multi-threaded TTY windows (the MTTTY serial terminal application). One window will be used for the USB Serial port connection, and one window will be used for the virtual serial port. In our image below, COM20 was the virtual COM 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).
- Click the “Connect” button on both application windows, and send data from the virtual serial port or USB serial port to confirm data is going back and forth.
Congratulations! You have now set up 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 to work with newer computers that either have too few DB9 RS-232-style ports or none at all.
Permission is hereby granted to purchasers of NetBurner System-on-Modules and serial-to-Ethernet modules (NetBurner Devices) to use this program to create a virtual serial communications port on a Windows computer so long as the sole purpose is to connect to the NetBurner Device. No other rights to use this program or its derivatives in part or in whole are granted.