Not knowing what’s going on inside of your electronics projects can make it quite difficult to get the bugs out. [John] was bumping up against this problem when working on wireless communications between several devices. At just about the same time his friend came up with a script with lets you monitor multiple serial devices in one terminal window.
We’re used to using minicom, a Linux package that does the job when working with serial connections of all kinds. But [John] is right, we’re pretty sure you can only connect to one device per minicom instance. But [Jim’s] Python serial terminal (available in this git repository) allows you to specify multiple devices as command line arguments. You can even use wildcards to monitor every USB connection. The script then automatically chooses a different color for each device.
The image above is from [John’s] wireless project. Even without any other background this shows how easy it is to debug this way rather than tab back and forth between windows which gets confusing very quickly.
17 thoughts on “Python Script Lets You Monitor Multiple Serial Devices At Once”
very useful. does it any standalone windows program exist for this?
Sure, this should work on Windows. It should be platform independent. All you need is python with the pySerial module. We’ve tested it on Linux and OS X.
Very useful. I’ll give it a spin in my Rpi.
Nice, thanks for sharing!
?? Wouldn’t GPG’s “less” command have worked just as well?
It’ll display multiple files and show the last line(s) updated (EOF). Not 100% sure it’d work on raw devices though, and it doesn’t display things in color.
Just a thought.
meh, i do the same thing with lua. all you need is some kinda serial library and some code-fu.
Right… and all it takes to build an Indy race car is some tires and an engine.
@rallen: What else do you need besides a serial library and code-fu???
In linux you can open a serial port and read and write to it just like a file.In any laguage.
And [John] shared the (already working) code-fu, and a pointer to the library used.
I haven’t played with Lua – so if you care to share *your* code-fu, I might read it. Myself, I’d probably go with C, C++, or lisp ’cause I like simplicity. Although putting together a hardware serial aggregator would also be cool, so you could just hook up all the wires to one board, and screen would handle it all.
But those are all *vapor*. [John] is sharing non-vapor. Which is awesome when it’s three AM and you just want to see if the hardware bits are properly cooked before stopping to have dinner.
Isn’t this a first-year CS homework assignment? To monitor serial data?
Call the function twice, pass in a new port, blam. Done.
Sure, it could be a first-year CS homework assignment.
But you know what; some of us haven’t taken CS, or don’t even have the option.
I’m delighted to have available a steady stream of /interesting/ hacks, regardless as to their triviality or simplicity.
This delights me so because I stand to learn from them all, even if I’ve seen or learned similar before.
Trivializing attitudes on the other hand, often make me question why I even bother reading the comments on this website.
Except for putting retropi on a raspberry pi, that shit is done to death.
Just use screen and be happy ;)
Looks similar to jpnevulator.
I used jpnevulator before and even wrote a script to read in its output files. To reuse that work on my Mac, I wrote a Python implementation of jpnevulator: jpnevulator.py / https://github.com/pklaus/jpnevulator.py .
It might not be as elaborate as this project with all its fancy colors but it has the same output format as jpnevulator if you or anyone else needs it.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)