Project Y-Pipe, an open source dongle for monitoring serial communications (and more)


I haven’t updated my BDPathway thread in a while, but that doesn’t mean I haven’t been active on several (micro-manager related) projects in my spare time. :wink:

One of them is Project Y-Pipe which I started because I needed a tool to monitor the serial traffic between my BDPathway and the original XP computer, over a USB serial console on a secondary computer. Then it occurred to me that I could simultaneously use that secondary computer and same USB interface to also control the BDPathway via micro-manager. Two Controllers one device, hence the unoriginally named Y-Pipe.

Principle: The Y-Pipe receives delimited string commands (e.g. a string terminated by \r\n) from the controllers (linked via RS232 or via USB) and sends them to the device via RS232:

Then any answers collected back from the device are sent to all the controllers, as well as the logging window:
As well as showing serial traffic, the logging terminal allows to set which delimiter to use for sending/parsing serial traffic strings (/r, /n, /r/n or /n/r) and the baudrate to use for the serial interface to the device (and original PC, same, if required).

Hardware: The dongle works off a STM32F103 based “arduino module” (bluepill or maple mini) and one or two RS232 to TTL converters. The software is STM32-Arduino based, which allows a single STM32F103 micro-controller to present itself as up to three separate USB serial ports.

Y-Pipe are cheap and easy to make and can be as polished (or unpolished) as you see fit. I’ve made three so far:

Different implementations: Cardboard, hot glue and wirewrap, or a plastic enclosure (which is probably best!)

So why three USB serial links? One for the console, one for controlling the device via a USB serial port and… another separate one for controlling the device, also via the same USB link. Which means that you can effectively control a device via two different bits of software running simultaneously on the same computer, each getting their own serial port. For example, control an LED light source via both Micro-Manager and the original software provided by the manufacturer. Or basically any device where the original manufacturer’s software offers fine grained control, but the Micro-Manager adapter doesn’t.

Which neatly brings us to…

What else can you do with the Y-Pipe? I’m currently working on integrating some fluidics devices into Micro-Manager. For now, I want to extend Mark’s HamiltonMVP device adapter to also control Hamilton syringe pumps, possibly via a new core device class called “PumpInstance”.

Since I don’t have access to real Hamilton devices for now, I need to simulate them. And that can easily be done with the Y-Pipe code. The code for simulating a MVP valve is commented out in fakeResponse() and neatly generates answers for the listening controllers (linked via RS323 serial or one of the twoUSB serial ports) depending on what command was sent. And this being the Y-Pipe code, all the traffic between controllers and (simulated) device is sent to the Console terminal just as it’s supposed to.

Proof is in the pudding:

and all the code for the Y-Pipe is on my github. :wink: