108

I'm developing a project that has a number of hardware sensors connecting to the deployment machine through RS232 serial ports.

But ... I'm developing on a machine without an physical RS232 serial ports, but I would like to make fake serial ports that I can connect to and output data from with the aim of faking input from hardware sensors.

Does anyone know of a way to create a fake serial port and control it on Windows XP?

sorin
  • 161,544
  • 178
  • 535
  • 806
BefittingTheorem
  • 10,459
  • 15
  • 69
  • 96

7 Answers7

91

If you are developing for Windows, the com0com project might be, what you are looking for.

It provides pairs of virtual COM ports that are linked via a nullmodem connetion. You can then use your favorite terminal application or whatever you like to send data to one COM port and recieve from the other one.

EDIT:

As Thomas pointed out the project lacks of a signed driver, which is especially problematic on certain Windows version (e.g. Windows 7 x64).

There are a couple of unofficial com0com versions around that do contain a signed driver. One recent verion (3.0.0.0) can be downloaded e.g. from here.

Frank Bollack
  • 24,478
  • 5
  • 49
  • 58
  • 5
    Although `com0com` project is an excellent open source project, as it should install device driver without digital signature, some Windows systems checking digitally signed driver will not work with its virtual serial port. Just want people know. – Tae-Sung Shin Oct 31 '12 at 17:55
  • 5
    @Thomas: Searching the net reveals that there are some unofficial signed versions of the driver around. One recent verion (3.0.0.0) can be downloaded from [here](https://code.google.com/p/powersdr-iq/downloads/list). – Frank Bollack Jul 11 '13 at 15:10
  • Many Thanks, you deserve a beer! – Pale Ale Oct 16 '13 at 14:13
  • how is this actually done though? what are the windows basics? – Nacht Feb 15 '14 at 07:52
  • @Nacht Every driver makes some abstraction even there is real serial port "connectet" to them. This mean that if you write driver you will notice you do not have to comunicate with real thing. Than you can use trasmition buffer as you want. In this virtual case, instead of send stream to real thing you send data to another "port". That port is a pair with the first one. Whole thing looks like mirroring data stream. I hope it is clear now. – MrHIDEn Feb 07 '15 at 22:46
  • Was able to make an old software <->serial <-> webRTC <-> serial <-> old software solution with com0com. Thanks! – TwoFingerRightClick Jan 28 '22 at 18:08
72

I know this is an old post, but in case someone else happens upon this question...

One option is Virtual Serial Port Emulator (VSPE) from Eterlogic It provides an API for creating kernel mode virtual comport devices, i.e. connectors, mappers, splitters etc. This is a small company but continues to expand and maintain their product list. (noted early 2023)

Another good option is Eltima. This product worked as advertised in all aspects of its virtual comport offering, and included good technical support. Product options include both desktop applications, as well as software development kits with APIs. This company remains active and growing, with expanding product categories. (noted early 2023)

Neither of these two products are open source, or free. However, as other posts here have pointed out, there are other options. Here is a list of various serial utilities:

com0com (current)
com0com - With Signed Driver (old version)
Yet another place for com0com with Signed Driver (Pete's Blog)
Tactical Software
Termite
AGG Software Serial Port Emulators
Kermit (obsolete, but still downloadable)
HW Group - HWVSP3
HHD Software (free edition)

Please comment me if you find a stale link. (Links verified early 2023.)

ryyker
  • 22,849
  • 3
  • 43
  • 87
42

I use com0com - With Signed Driver, on windows 7 x64 to emulate COM3 AND COM4 as a pair.

Then i use COM Dataport Emulator to recieve from COM4.

Then i open COM3 with the app im developping (c#) and send data to COM3.

The data sent thru COM3 is received by COM4 and shown by 'COM Dataport Emulator' who can also send back a response (not automated).

So with this 2 great programs i managed to emulate Serial RS-232 comunication.

Hope it helps.

Both programs are free!!!!!

Jhollman Cutcsa
  • 631
  • 7
  • 6
  • 1
    Fantastic. This has helped me, that's for sure. Do you know of a way that I can make COM Port Data Emulator wait for my input, then send that back? – bunggo Mar 23 '16 at 21:53
6

There's always the hardware route. Purchase two USB to serial converters, and connect them via a NULL modem.

Pro tips: 1) Windows may assign new COM ports to the adapters after every device sleep or reboot. 2) The market leaders in chips for USB to serial are Prolific and FTDI. Both companies are battling knockoffs, and may be blocked in future official Windows drivers. The Linux drivers however work fine with the clones.

Bryce
  • 8,313
  • 6
  • 55
  • 73
  • 3
    Note that USB serial adapters have different timing/bunching behavior from traditional UARTs. However, testing with one isn't a bad idea if there's any chance of one ever being used. When they first become popular, poorly designed or implemented protocols sometimes broke or slowed to a crawl when used with one. Today it is less likely that something gets out the door without being tried with a USB-attached-UART in development; indeed being tried on a traditional UART on a PC is what is now unlikely. – Chris Stratton Feb 17 '18 at 22:07
4

Another alternative, even though the OP did not ask for it:

There exist usb-to-serial adapters. Depending on the type of adapter, you may also need a nullmodem cable, too.

They are extremely easy to use under linux, work under windows, too, if you have got working drivers installed.

That way you can work directly with the sensors, and you do not have to try and emulate data. That way you are maybe even save from building an anemic system. (Due to your emulated data inputs not covering all cases, leading you to a brittle system.)

Its often better to work with the real stuff.

sjas
  • 18,644
  • 14
  • 87
  • 92
1

i used eltima make virtual serial port for my modbus application debug work. it is really very good application at development stage to check serial port program without connecting hardware.

0

I found Free Virtual Serial Ports to work well for my non-commercial use-case. It isn't free for other use-cases. Having said that - it worked really well, even on an arm64 based Windows 11.

Moshe
  • 2,638
  • 2
  • 28
  • 32