Serial input node stops reading data

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

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

Please help me.

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.

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.

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.

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 ?

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.

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.

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.

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)

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

No it doesnt work with or without the chart connected.

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

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.

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

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?

        "id": "d4b06b4c7251a85a",
        "type": "serial in",
        "z": "0d2c3513d6cb6705",
        "name": "",
        "serial": "61527f176c118dc6",
        "x": 310,
        "y": 200,
        "wires": [
        "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

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 ```)

   code goes here 

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

See this post for more details - How to share code or flow json

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

Did that help at all?

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.

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.