# Serial node problem

**URL:** https://discourse.nodered.org/t/serial-node-problem/17481
**Category:** General
**Created:** [4 November 2019 12:35 UTC](https://discourse.nodered.org/t/serial-node-problem/17481 "2019-11-04T12:35:51Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [4 November 2019 12:35 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/1 "2019-11-04T12:35:51Z")

</div>

I have some problems with using the serial node.

It sends data w/o any problem, but able to receive data **only** in request mode.

I want to connect the device, which sends data to serial w/o any request.

Maybe somebody knows, how to fix it?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [4 November 2019 15:23 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/2 "2019-11-04T15:23:08Z")

</div>

> [@iungo](#):
>
> I want to connect the device, which sends data to serial w/o any request.

Surely, that is an issue with whatever needs to send the data?

All you need to do in NR is connect to the appropriate serial port on your computer and you are already doing that in order to be able to send data.

So all you need to do is get the other device to actually send something.

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [4 November 2019 15:47 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/3 "2019-11-04T15:47:51Z")

</div>

It is not so simple.

Please, look on video.

[https://youtu.be/Wm\_2VcWYx0g](https://youtu.be/Wm_2VcWYx0g)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [4 November 2019 18:53 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/4 "2019-11-04T18:53:28Z")

</div>

Why do you have both an in/out and a request node? Not sure how well they play together to be honest, I've never tried.

Also what settings do you have for your serial-port config node?

It is also generally helpful if you include information about what versions of node.js and Node-RED you are using.

---

<div class="post-metadata">

### Author: ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)
#### Post date: [4 November 2019 21:46 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/5 "2019-11-04T21:46:35Z")

</div>

You have need to send cr/lf in your terminal program

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [5 November 2019 08:01 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/6 "2019-11-05T08:01:47Z")

</div>

> [@TotallyInformation](#):
>
> Why do you have both an in/out and a request node? Not sure how well they play together to be honest, I've never tried.

Only to show the problem.

> [@TotallyInformation](#):
>
> Also what settings do you have for your serial-port config node?

This is my config:  
 ![serialconfig](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/06b41115b78782af5cd888c81b67aa95a8d15e0a.png)

> [@TotallyInformation](#):
>
> It is also generally helpful if you include information about what versions of node.js and Node-RED you are using

Node-Red v 0.20.7  
node.js v10.16.0

I've tried to test it on Raspbian and on Windows, same problem.

---

<div class="post-metadata">

### Author: ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)
#### Post date: [5 November 2019 10:21 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/7 "2019-11-05T10:21:27Z")

</div>

You have to set the checkbox "sendnew" in your terminal program.

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [5 November 2019 10:42 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/8 "2019-11-05T10:42:15Z")

</div>

This is not a solution. It only adds LF and CF to the message. I need a transparent transmission.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [5 November 2019 12:43 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/9 "2019-11-05T12:43:22Z")

</div>

The serial in node needs to understand what constitutes the end of a "message" or record.

So when sending, you have to decide what that will be. You either have to have a line ending or an arbitrary timespan.

Your configuration at the moment listens to input until it receives `\n` - if you never send that, the serial in node will never spit out any data.

That is your issue.

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [5 November 2019 14:25 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/10 "2019-11-05T14:25:05Z")

</div>

I think, more reasonable way is to split the messages via timeout (1-2 bytes timeout for example).

The way to split it by /n is not so good solution. Too many devices send the standard packets w/o /n on the end. And with this solution, all of those are totally unuseful for work with Node-Red. This is an issue.

---

<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: [5 November 2019 14:51 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/11 "2019-11-05T14:51:53Z")

</div>

> [@iungo](#):
>
> The way to split it by /n is not so good solution.

If there is no terminator how do you know when the end of a packet is reached?

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [5 November 2019 15:05 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/12 "2019-11-05T15:05:19Z")

</div>

> [@Colin](#):
>
> If there is no terminator how do you know when the end of a packet is reached?

Wait for 2 bytes(~1.6 milliseconds for 9600bps), if no data - end of the packet. It's a simple technique which works in many serial devices

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [5 November 2019 15:25 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/13 "2019-11-05T15:25:22Z")

</div>

You don't need to do that, have you looked at the other options in the port config?

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/d/df521482f9a2ea5f216a2eb2f951c45845d3138b.png)

If you know that you always need 2 bytes then use the fixed length option.

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [5 November 2019 15:48 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/14 "2019-11-05T15:48:35Z")

</div>

Thank you, I will try it. But I think I need _after a timeout of_ or _after a silence of_ option. Because of messages length may vary.

---

<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: [5 November 2019 17:04 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/15 "2019-11-05T17:04:07Z")

</div>

> [@iungo](#):
>
> I think I need _after a timeout of_ or _after a silence of_ option

Well do that then, the options are there.

---

<div class="post-metadata">

### Author: ![iungo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iungo/32/8099_2.png) [@iungo](https://discourse.nodered.org/u/iungo)
#### Post date: [7 November 2019 17:54 UTC](https://discourse.nodered.org/t/serial-node-problem/17481/16 "2019-11-07T17:54:42Z")

</div>

Thank you! The options _after a timeout of_ and _after a silence of_ works fine.  
I'm not pay attention on it. This is my problem)
