Python in the Middle Serial Port Monitor How to

1 minute read

preliminary article

Making a quick Python based serial monitor

For some reason everyone has seemingly forgotten about the poor old serial port! While you don’t see it very often in consumer electronics, it’s still a very important dependecy in developing most embedded systems. Even if you are just using serial data over Bluetooth and/or USB, it is still important to be able to monitor and/or log that data for making new tools or fixing existing bugs.

There used to be support in Windows for such things with PortMon and there were even a couple free to use programs that got the job done. Now none of those things seem to work with 32-bit or modern operating systems or they want to charge you an arm and a leg for something you only need to use occasionally. Sure, we could do this in Linux with socat or something else, but in the embedded world we are often hamstrung to Windows. So what to do??

PySerial and com0com to the rescue!

With a simple and very useful feature hidden away in PySerial and a virtual set of serial ports using com0com, we can get a Python based logging/monitoring application up and running without much impact on the interface. This example will be quick and crude, but is functional and should certainly get you going if you want to make something more robust with threading and such.

coming soon!!