Using the Arduino IDE, we can bring up the Serial Monitor to send and receive data from the Arduino. However, if you’re using Windows, this completely ties up the COM port so that it cannot be used for anything else. If your Arduino needs to communication with other piece of software on your PC, that software gets exclusive access to that port so you can no longer use the Serial Monitor. Needless to say, it would be very nice to be able to peek at real data being sent between your PC app and the Arduino. A reliable way I’ve found to do this in Window is using com0com and hub4com. Here’s how it works.
Note on driver types (it is relevant!)
On Windows 8.1 64 bit (and true for 64 bit Vista and Win7 as far as I know) you have 3 types of driver…
- Signed driver - This is preferred. It is how you are used to installing and using windows devices, but the developer must pay for it to be signed. Not an option for com0com.
- Unsigned driver - every time you want to use the unsigned virtual COM ports, you must reboot your PC twice to get to the Allow Unsigned Driver option. It is a pain. This is true of the latest com0com 220.127.116.11. If using 64bit Windows, avoid like the plague
- Test Signed Driver - you can run a simple command line instruction to tell Windows to allow Test-Signed drivers. The setting persists between reboot, so it is convenient. For com0com, this is true for the signed version of 18.104.22.168
Use version 22.214.171.124 because it is signed. When installing, I unchecked the option to add a default pair of COM ports. I preferred a clean start Run the command: bcdedit -set TESTSIGNING ON Once com0com is installed, go and get hub4com, unzip, rename the readme file and copy the whole lot into your com0com folder.
I have an Arduino on COM3, and some PC Software which talks to it, called “PC Lap Counter” (PCLC) - it’s a race management solution for slotcar racing. PCLC sends race and lap info to the Arduino over the serial connection, but I want to be able to look in on this info as it is happening.
Step 1: Setup the Virtual COM port Pairs
Step 2: Join the COM port pairs together with hub4com’s Routes
hub4com -baud=9600 -octs=off -ox=on -route=0,2:All -no-default-fc-route=0,1:All \\.\CNCB0 \\.\CNCB1 \\.\COM3
Step 3: Snoop away
Using Putty, create a new ‘Serial’ connection. In the above example, it is connected to COM6 at 9600baud