# How to use msg.baudrate to set the baud rate for the serial request in node-red-node-serialport

**URL:** <https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919>\
**Category:** General\
**Created:** [29 October 2021 00:52 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919 "2021-10-29T00:52:31Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![yfhzs](https://avatars.discourse-cdn.com/v4/letter/y/87869e/32.png) [@yfhzs](https://discourse.nodered.org/u/yfhzs)\
**Post date:** [29 October 2021 00:52 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919/1 "2021-10-29T00:52:31Z")

</div>

How to use msg.baudrate to set the baud rate for the serial request in node-red-node-serialport has been tested many times but failed. Please give me your advice，thank you.  
 ![1635468660(1)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e0ae371a6c0cd8435cfc3ba69bb093d8ef3959b6.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/9/a9226ec5558eb6e9f677629a81b45cf507ca5e8b.png)

---

<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:** [29 October 2021 07:21 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919/2 "2021-10-29T07:21:51Z")

</div>

You can't set serial port settings dynamically via msg

---

<div class="post-metadata">

**Author:** ![yfhzs](https://avatars.discourse-cdn.com/v4/letter/y/87869e/32.png) [@yfhzs](https://discourse.nodered.org/u/yfhzs)\
**Post date:** [1 November 2021 00:56 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919/3 "2021-11-01T00:56:29Z")

</div>

Hi Steve-Mcl it is described in the node-red-node-serialport instructions that msg.baudrate can configure the baud rate. If this node cannot be configured, is there any other method to realize this function.

---

<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:** [1 November 2021 07:27 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919/4 "2021-11-01T07:27:48Z")

</div>

Does it? My apologies. Have you tried setting it? Does it not work?

---

<div class="post-metadata">

**Author:** ![yfhzs](https://avatars.discourse-cdn.com/v4/letter/y/87869e/32.png) [@yfhzs](https://discourse.nodered.org/u/yfhzs)\
**Post date:** [1 November 2021 08:56 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919/5 "2021-11-01T08:56:57Z")

</div>

I tried to configure it, but a timeout error was reported. I don't know what went wrong. Can you help me?  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/7/978f38be16da57f524fb90bb28c470a4a6f14b27.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/f/6f90de0290c72e950cc2926f6cb306e7d5884c73.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/f/4f6bcf58859995f573b77ddb7a91c7930c5299d9.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 November 2021 09:07 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919/6 "2021-11-01T09:07:46Z")

</div>

> [@yfhzs](#):
>
> I tried to configure it, but a timeout error was reported

Does it work if you set the baudrate in the node?

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [1 November 2021 09:13 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919/7 "2021-11-01T09:13:59Z")

</div>

As I said on the [issue](https://github.com/node-red/node-red-nodes/issues/850) that was raised, the timeout error happens after the baud rate would have been set.

I expect that the device connected to the port isn't expecting a boolean `true` to be sent so is not responding.

---

<div class="post-metadata">

**Author:** ![yfhzs](https://avatars.discourse-cdn.com/v4/letter/y/87869e/32.png) [@yfhzs](https://discourse.nodered.org/u/yfhzs)\
**Post date:** [1 November 2021 09:33 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919/8 "2021-11-01T09:33:56Z")

</div>

If there is no payload serial request, there will be no corresponding. According to what you said, the payload must have data to have a corresponding request?

---

<div class="post-metadata">

**Author:** ![yfhzs](https://avatars.discourse-cdn.com/v4/letter/y/87869e/32.png) [@yfhzs](https://discourse.nodered.org/u/yfhzs)\
**Post date:** [1 November 2021 09:34 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919/9 "2021-11-01T09:34:09Z")

</div>

I configured it but it doesn't work.

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [1 November 2021 09:36 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919/10 "2021-11-01T09:36:55Z")

</div>

Using the serial-request node without a payload doesn't make any sense, the whole point of this node is to send a payload and wait for a response from what ever device is attached to the serial port.

I think we need to take a step back here and you need to explain in detail what you are actually trying to do, not the inject/serial-request/debug testcase you have provided here.

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [1 November 2021 09:58 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919/11 "2021-11-01T09:58:20Z")

</div>

From the now closed issue (to keep all the discussion in the same place):

> If I just want to modify the baud rate and use serial input as the data input node, what should I do?

Having looked at the source for the serial-request node if you remove the `msg.payload` and just include a `msg.baudrate` in the inject node, it should just change the baud rate for any serial-in and serial-out nodes attached to the same serial port.

---

<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:** [31 December 2021 09:59 UTC](https://discourse.nodered.org/t/how-to-use-msg-baudrate-to-set-the-baud-rate-for-the-serial-request-in-node-red-node-serialport/52919/12 "2021-12-31T09:59:15Z")

</div>

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