# How to use serial port control node

**URL:** <https://discourse.nodered.org/t/how-to-use-serial-port-control-node/87564>\
**Category:** General\
**Created:** [28 April 2024 13:36 UTC](https://discourse.nodered.org/t/how-to-use-serial-port-control-node/87564 "2024-04-28T13:36:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ALOKA1432](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@ALOKA1432](https://discourse.nodered.org/u/ALOKA1432)\
**Post date:** [28 April 2024 13:36 UTC](https://discourse.nodered.org/t/how-to-use-serial-port-control-node/87564/1 "2024-04-28T13:36:36Z")

</div>

How can i use serial port control node to change the port and other parameters on the fly. Kindly help someone.

---

<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:** [28 April 2024 14:37 UTC](https://discourse.nodered.org/t/how-to-use-serial-port-control-node/87564/2 "2024-04-28T14:37:05Z")

</div>

Have you read the built in help on the side bar in your node-red editor?

> Stops, starts the serial communication and changes the serial port configuration.
> 
> This node provides the serial port control capability to
> 
> - stop the communication and releasing the serial port so, for example the Arduino can upload the new binary without shutting down the nodered.
> - start the communication after stopped with this `Serial Control` node for above reason or the like.
> - change the serial port and the configuration on the run time programatically.
> - query the serial port configuration if empty or no valid configuration parameters are passed.
> 
> ### Inputs
> 
> In order to control the communication, just send these JSON messages to the control node.
> 
> ```
> {
> "serialport": "/dev/tty.usbmodem1234561",
> "serialbaud": 115200,
> "databits": 8,
> "parity": "none",
> "stopbits": 1
> "enable": true
> }
> ```
> changes the serial port and the configuration on the fly. 
> 
> The following optional parameters will change the configuration only if they are present.
> 
> Any combination of them can be passed to change/control the serial communication
> 
> - serialport 
> - serialbaud 
> - databits 
> - parity 
> - stopbits 
> - dtr 
> - rts 
> - cts 
> - dsr 
> - bin 
> - out 
> - enable 
> 
> When the `enable` property is not present, it will default to `true`
> 
> `{"enable":true}` or `{"enable":false}` will start or stop the communication.
> 
> If `enable` is passed along with other parameters, the configuration will be changed and either be started or just be ready to be started(ie. stopped ) depending on its value.
> 
> ### Outputs
> 
> `msg.payload` is the response. It contains the serial port configuration

There is also info in the NPM README: [node-red-node-serialport - npm](https://www.npmjs.com/package/node-red-node-serialport#control)

And this readme in the source: [node-red-nodes/io/serialport/README.md at master · yhur/node-red-nodes · GitHub](https://github.com/yhur/node-red-nodes/blob/master/io/serialport/README.md#serial-control)

This 👆 resource even has a demo flow you can import!

---

<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:** [27 July 2024 14:37 UTC](https://discourse.nodered.org/t/how-to-use-serial-port-control-node/87564/3 "2024-07-27T14:37:26Z")

</div>

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