How to use serial port control node

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

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

And this readme in the source: node-red-nodes/io/serialport/README.md at master · yhur/node-red-nodes · GitHub

This :point_up_2: resource even has a demo flow you can import!

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