# Serial input node stops reading data

**URL:** https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451
**Category:** General
**Created:** [23 October 2022 08:15 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451 "2022-10-23T08:15:20Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![XYZ](https://avatars.discourse-cdn.com/v4/letter/x/b5a626/32.png) [@XYZ](https://discourse.nodered.org/u/XYZ)
#### Post date: [23 October 2022 08:15 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/1 "2022-10-23T08:15:20Z")

</div>

I am using a serial input node. The node just stops after approximately around 4-5 minutes. I am using the function:

const d = Date.now()  
function getData()  
{  
return msg.payload  
}  
const tmp =[{series: ["US1"],data: [],labels: [""]}]  
for(let z = 0; z \< 51; z++)  
{  
tmp[0].data[0].push({x:(d+z),y:getData()})  
}  
msg.payload = tmp  
return msg;

Please help me.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [23 October 2022 08:22 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/2 "2022-10-23T08:22:05Z")

</div>

What do you mean with "just stops" ? Are you outputting into the debug window ? because there is only a limited amount of data it will display - which could make it appear that it just stops.

---

<div class="post-metadata">

### Author: ![XYZ](https://avatars.discourse-cdn.com/v4/letter/x/b5a626/32.png) [@XYZ](https://discourse.nodered.org/u/XYZ)
#### Post date: [23 October 2022 08:23 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/3 "2022-10-23T08:23:45Z")

</div>

Yeah i am checking with debug and chart node. I mean no data is received from the node after 4-5 minutes. I checked with other serial terminal, it is coming.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [23 October 2022 08:44 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/4 "2022-10-23T08:44:55Z")

</div>

Why are you building an array for the data when it is live data coming in ? - Why not just send the numeric payload from the serial input as a payload direct to the chart - the chart will add the timestamp - and you can set it to limit it to 50 reading etc.

---

<div class="post-metadata">

### Author: ![XYZ](https://avatars.discourse-cdn.com/v4/letter/x/b5a626/32.png) [@XYZ](https://discourse.nodered.org/u/XYZ)
#### Post date: [23 October 2022 08:48 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/5 "2022-10-23T08:48:40Z")

</div>

How do i limit it to 50 at a time. I have data coming around 50 per sec. Shall i limit using delay node or is there something in the chart node itself ?

Why is serial node stopping and not receiving any data ?

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [23 October 2022 08:52 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/6 "2022-10-23T08:52:14Z")

</div>

I would use either the delay node in rate limit mode - set to drop intermediate messages - or use the smooth node (to create an average) and tick the reduce option to only emit the value every x samples.

---

<div class="post-metadata">

### Author: ![XYZ](https://avatars.discourse-cdn.com/v4/letter/x/b5a626/32.png) [@XYZ](https://discourse.nodered.org/u/XYZ)
#### Post date: [23 October 2022 08:54 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/7 "2022-10-23T08:54:19Z")

</div>

That is fine. I used delay node to limit too.

That too didnt work.

Waht about serial input node ? It is not showing any data.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [23 October 2022 08:56 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/8 "2022-10-23T08:56:30Z")

</div>

Sorry - not sure what you mean - in what way doesn't it work ?  
If you aren't receiving anything from the serial node then indeed nothing further will work.  
Add a debug directly to the output and see what it is receiving.

---

<div class="post-metadata">

### Author: ![XYZ](https://avatars.discourse-cdn.com/v4/letter/x/b5a626/32.png) [@XYZ](https://discourse.nodered.org/u/XYZ)
#### Post date: [23 October 2022 08:59 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/9 "2022-10-23T08:59:23Z")

</div>

I mean the serial node stops showing anything after 4-5 minutes in the debug node.  
I could see the data coming with other serial terminal software (to see whether data is coming on the COM port or not)

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [23 October 2022 09:13 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/10 "2022-10-23T09:13:26Z")

</div>

Does it do that if you only have the debug attached and not the rest of the flow (charts etc)

---

<div class="post-metadata">

### Author: ![XYZ](https://avatars.discourse-cdn.com/v4/letter/x/b5a626/32.png) [@XYZ](https://discourse.nodered.org/u/XYZ)
#### Post date: [23 October 2022 09:15 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/11 "2022-10-23T09:15:22Z")

</div>

No it doesnt work with or without the chart connected.

It shows "connected", but no data after 4-5 minutes

---

<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: [23 October 2022 09:31 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/12 "2022-10-23T09:31:00Z")

</div>

> [@XYZ](#):
>
> I could see the data coming with other serial terminal software

Do you mean you have node-red and another terminal software package both connected to the same COM port. I thought that was not allowed.

---

<div class="post-metadata">

### Author: ![XYZ](https://avatars.discourse-cdn.com/v4/letter/x/b5a626/32.png) [@XYZ](https://discourse.nodered.org/u/XYZ)
#### Post date: [23 October 2022 09:34 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/13 "2022-10-23T09:34:26Z")

</div>

No, not at the same time. one at a time.

---

<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: [23 October 2022 09:40 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/14 "2022-10-23T09:40:29Z")

</div>

Select the serial node and Export it, then paste it here. Use the `</>` button at the top of the forum entry window when pasting it.  
Also what version of node-red, node.js and the serial node are you using?

---

<div class="post-metadata">

### Author: ![XYZ](https://avatars.discourse-cdn.com/v4/letter/x/b5a626/32.png) [@XYZ](https://discourse.nodered.org/u/XYZ)
#### Post date: [23 October 2022 09:44 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/15 "2022-10-23T09:44:34Z")

</div>

```auto
[
    {
        "id": "d4b06b4c7251a85a",
        "type": "serial in",
        "z": "0d2c3513d6cb6705",
        "name": "",
        "serial": "61527f176c118dc6",
        "x": 310,
        "y": 200,
        "wires": [
            [
                "6997f8a061f3fba0"
            ]
        ]
    },
    {
        "id": "61527f176c118dc6",
        "type": "serial-port",
        "z": "0d2c3513d6cb6705",
        "serialport": "COM6",
        "serialbaud": "9600",
        "databits": "8",
        "parity": "none",
        "stopbits": "1",
        "waitfor": "",
        "dtr": "none",
        "rts": "none",
        "cts": "none",
        "dsr": "none",
        "newline": "\\n",
        "bin": "false",
        "out": "char",
        "addchar": "",
        "responsetimeout": ""
    }
]

```

This is the flow.

NodeRED version: v2.0.5  
Node.js version: v12.16.2

---

<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: [23 October 2022 10:17 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/16 "2022-10-23T10:17:05Z")

</div>

Please paste the flow directly here using the `</>` button.  
Further explanation in this canned reply:

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

You can edit and correct your post by clicking the pencil ✏ icon.

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<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: [23 October 2022 10:22 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/17 "2022-10-23T10:22:05Z")

</div>

Set a 1 second timeout in the serial node, so that if no newline character is received it will still output something.

---

<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: [25 October 2022 14:02 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/19 "2022-10-25T14:02:24Z")

</div>

Did that help at all?

---

<div class="post-metadata">

### Author: ![XYZ](https://avatars.discourse-cdn.com/v4/letter/x/b5a626/32.png) [@XYZ](https://discourse.nodered.org/u/XYZ)
#### Post date: [25 October 2022 14:13 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/20 "2022-10-25T14:13:52Z")

</div>

No Colin. After sometime, the serial in node shows no data. It has something to do with NodeRED. I disabled the serial node and checked with putty, got the data.

---

<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: [25 October 2022 14:17 UTC](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451/21 "2022-10-25T14:17:42Z")

</div>

Stop node red and start it again in a terminal. Wait till it stops receiving and copy/paste the terminal output here, from the start.

[Next page](https://discourse.nodered.org/t/serial-input-node-stops-reading-data/69451.md?page=2)
