# Node-red-serial port port selection

**URL:** <https://discourse.nodered.org/t/node-red-serial-port-port-selection/93845>\
**Category:** General\
**Tags:** node-red-node-serialport\
**Created:** [11 December 2024 07:39 UTC](https://discourse.nodered.org/t/node-red-serial-port-port-selection/93845 "2024-12-11T07:39:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![plouc](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@plouc](https://discourse.nodered.org/u/plouc)\
**Post date:** [11 December 2024 07:39 UTC](https://discourse.nodered.org/t/node-red-serial-port-port-selection/93845/1 "2024-12-11T07:39:24Z")

</div>

Hi there!  
I'm looking for a way a user with only access to node-red dashboard to be able to select which serial port to connect to. This topic is exactly talking about it:

> [@Node-red-node-serialport port selection](https://discourse.nodered.org/t/node-red-node-serialport-port-selection/82651):
>
> When the node-red starts, the flow(program) picks up the hard-coded serial ports and open them. But when a device re-connects after disconnecting for any reason, it may be possible the port number change, but the end user of the flow can't change the port unless he/she has the access to the node-red editor. Recently I had to develop a feature on top of node-red-node-serialport that enables the end user of node-red to change the port number/name without the access to the node-red editor. I wou…

However the githubs links seems to be broken and i don't now if the feature request has been implemented yet. If not, does anyone already built a custom serial port set of nodes that can do this? Thanks a lot for your help!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [11 December 2024 07:53 UTC](https://discourse.nodered.org/t/node-red-serial-port-port-selection/93845/2 "2024-12-11T07:53:50Z")

</div>

Dynamic serial port selection was merged in 2023: [node-red-node-serialport port selection node addition by yhur · Pull Request #1035 · node-red/node-red-nodes · GitHub](https://github.com/node-red/node-red-nodes/pull/1035)

---

<div class="post-metadata">

**Author:** ![yhur](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yhur/32/84575_2.png) [@yhur](https://discourse.nodered.org/u/yhur)\
**Post date:** [12 December 2024 04:43 UTC](https://discourse.nodered.org/t/node-red-serial-port-port-selection/93845/3 "2024-12-12T04:43:10Z")

</div>

@plouc,

As @Steve-Mcl said, it's a part of node-red-node-serialport now, so once installed, you will get the below nodes

 ![Screenshot 2024-12-12 at 1.39.56 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/9/d9c56dbb0701dbe0b78d3c298d0c7e7ffe3014ac.png)

And as seen on the below, you can use the serial control to dynamically change the port.

 ![Screenshot 2024-12-12 at 1.41.15 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/5/e5e08458e51a90dd8e8dd8fe394ed4e3940de01a.png)

---

<div class="post-metadata">

**Author:** ![plouc](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@plouc](https://discourse.nodered.org/u/plouc)\
**Post date:** [12 December 2024 07:06 UTC](https://discourse.nodered.org/t/node-red-serial-port-port-selection/93845/4 "2024-12-12T07:06:49Z")

</div>

Thank you all for your response.  
I actually tried to use the control node. However i might not have expressed what i'd like to do correctly and i'm not sure the control node will help me in that situation.

I would like to have a dashboard where the user can choose which serial port to use to communicate. Say they can plus a USB/serial adapter to the computer, which i have no idea how it will mount.

The flow will list the available serial ports using a command like ls /dev/{tty,cu}.\* in MacOS send it to a list in the dashboard. Then the user can choose from it and send it back to the flow. At this point i would like to be able to open that specified com port using the Serial In and/or Out node.

but it seems that i cannot do this, as both Serial and serial control nodes have to be set up to a particular com port.

Is it maybe another way to do it using a node.js library in a function node?

Thanks a lot for your help!

---

<div class="post-metadata">

**Author:** ![plouc](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@plouc](https://discourse.nodered.org/u/plouc)\
**Post date:** [13 December 2024 07:25 UTC](https://discourse.nodered.org/t/node-red-serial-port-port-selection/93845/5 "2024-12-13T07:25:52Z")

</div>

Ok, so sorry for the newbie questions. This actually works great thank you very much for your awesome work.

For someone landing here looking for the same. You have to first configure the serial control node and the serial in and out nodes with an available serial port. Then you can chage it dynamically with serial control.

here is a flow that does the selection from dashboard:

[flows.json](https://discourse.nodered.org/uploads/short-url/brPKswzV7IEhk4h8ahV5Pi8zuVE.json) (5.1 KB)

---

<div class="post-metadata">

**Author:** ![Nic](https://avatars.discourse-cdn.com/v4/letter/n/45deac/32.png) [@Nic](https://discourse.nodered.org/u/Nic)\
**Post date:** [16 December 2024 09:49 UTC](https://discourse.nodered.org/t/node-red-serial-port-port-selection/93845/6 "2024-12-16T09:49:18Z")

</div>

Hi, I am facing on the same problem (Windows os). May I change the command in the exec node? Please, can you advise me witch command have I to place?  
Thank you in advance,  
n

---

<div class="post-metadata">

**Author:** ![plouc](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@plouc](https://discourse.nodered.org/u/plouc)\
**Post date:** [16 December 2024 14:27 UTC](https://discourse.nodered.org/t/node-red-serial-port-port-selection/93845/7 "2024-12-16T14:27:04Z")

</div>

this should help!

> **[📦 list | Node SerialPort](https://serialport.io/docs/bin-list/)**
>
> | npm | github |

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 March 2025 14:27 UTC](https://discourse.nodered.org/t/node-red-serial-port-port-selection/93845/8 "2025-03-16T14:27:21Z")

</div>

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