Close and release serial Com ports from within flows

As I have seen others searching in a couple of older posts, I need to release the Serial Com port from within running flows for use by other software. My specific need is to release my rpi pico boards from communication from Node-Red to allow for programming via VSCode all running on a raspberry pi 4b. Stopping and restarting Node-Red is not a very pleasant solution in my case.

Are there any plans to add the flow controlled options for releasing the ports, or does anyone have any working solutions for this type of use on raspberry pi linux based systems?


This is not going to be so simple. The same applies in VSCode - also need to close the project in order to release the port.

"A way" I can think of could be to use the node-red API to remove/post the flow.

Another possibility would be to write a python (or whatever is your favourite language) application that manages the comms and communicates with node-red via (for example) MQTT. Then you could stop and start that using an exec node in node-red.

That is a very good use case justification for the serial node supporting disconnect/connect commands.

If I had time, I would submit a pull request. Is that something you are able to do? It would benefit many.

I am not sure where/how to make the changes to the serial node myself. Even if I figured out a way, my code is usually more proof of concept grade than stable for the masses.

I would rather not add a middle man to the serial communications. My node-red setup is actually working as the control interface for a CNC control which directly serial streams to a grblHAL setup on one pico and a custom motor driver with direct serial streaming as well. From my experience, MQTT would be far to slow for the fast gcode streaming needed for grbl to keep smooth motion.

The VSCode setup I am running is programming in C++, not python. As long as I do not have the serial monitor running, it does not require closing the project to release the port back to other processes.

I am not sure how your suggestion of using the API would work. For now, I have been disabling the serial ports within my flow and deploying. Then uploading from VSCode, and finally redeploying with the ports enabled again. It is a bit of a hassle, and at different times, resetting my flows has losses in my process and machine control that could be sketchy under worst case scenarios.

Thanks all for the suggestions.

Rather than a Python script, you should consider using a virtual COM port that allows multiple access. Not used one for a while so can't remember the utility but they are available for both Linux and Windows.

Thanks. I looked around a lot for a virtual com since another post suggested it too. I could not find anything that appeared to fit my application and would run on the rpi.

@Steve-Mcl I found a recent pull request that you were discussing with the requester. Not sure if it was something you all were considering folding in or not:

I lost track of it.

I've nudged the guys involved.

Let's see.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.