# Serial input stops

**URL:** <https://discourse.nodered.org/t/serial-input-stops/69419>\
**Category:** General\
**Tags:** node-red-dashboard\
**Created:** [22 October 2022 11:39 UTC](https://discourse.nodered.org/t/serial-input-stops/69419 "2022-10-22T11:39:24Z")\
**Posts on this page:** 9\
**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:** [22 October 2022 11:39 UTC](https://discourse.nodered.org/t/serial-input-stops/69419/1 "2022-10-22T11:39:24Z")

</div>

Hi there, I am using Serial input node with NodeRED on my Laptop to receive data coming at a baud rate of 9600 from a NodeMCU. I am receiving around 100 data per second from the NodeMCU. Since the graph node on NodeRED is not capable of handling data at such high speed, I have used a delay node (To allow only 10 data per second) to allow the graph plot smoothly.

This thing goes smooth for some time. After that, The data coming stops and plotting stops. If i restart the NodeRED, it starts working.

There is no issue in data from the NodeMCU as i have checked this with Python script and there is no issue in data coming from the NodeMCU.

Any solutions please.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [22 October 2022 11:42 UTC](https://discourse.nodered.org/t/serial-input-stops/69419/2 "2022-10-22T11:42:37Z")

</div>

> [@XYZ](#):
>
> (To allow only 10 data per second) to allow the graph plot smoothly.
> 
> This thing goes smooth for some time. After that, The data coming stops and plotting stops. If i restart the NodeRED, it starts working.

After roughly how many seconds does the problem show up? That is, how many data points does the graph show? How many pixels wide is your browser window?  
What is the memory and CPU usage of the browser?

---

<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:** [22 October 2022 11:45 UTC](https://discourse.nodered.org/t/serial-input-stops/69419/3 "2022-10-22T11:45:37Z")

</div>

@jbudd Hi there, Thanks for your response. The problem arises after 2-3 minutes. I am allowing only data for 5 seconds (10 data per second) for the X axis.

---

<div class="post-metadata">

**Author:** ![EmilWesselink](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/emilwesselink/32/65829_2.png) [@EmilWesselink](https://discourse.nodered.org/u/EmilWesselink)\
**Post date:** [22 October 2022 12:11 UTC](https://discourse.nodered.org/t/serial-input-stops/69419/4 "2022-10-22T12:11:59Z")

</div>

First I would check if your problem is the serial port. If you put too many data points in the memory of node-red it can crash.

Let it run without the graph disconnected and a debug connected and rule out where your problem is

---

<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:** [22 October 2022 12:21 UTC](https://discourse.nodered.org/t/serial-input-stops/69419/5 "2022-10-22T12:21:05Z")

</div>

If you inject payload into the chart directly (ie, without sending a full new array), the dashboard will append the values to each array, eventually you will run out of memory and/or the browser won't enjoy it any longer.

If you push a full new array to the chart node, it will flush previous values.

example with a function node sending 1000 random elements every second;

```auto
const d = Date.now()
function getRandomArbitrary(min, max) {
    return Math.random() * (max - min) + min;
}

const tmp = [
    { 
        series: ["sensor"], 
        data: [[]],
        labels: [""]
    }
]
for(let z=0;z<1000;z++){
    tmp[0].data[0].push({x:(d+z),y:getRandomArbitrary(10,100)})
}
msg.payload = tmp
return msg;

```

this can run forever in the dashboard.

So in your case, you could "cache" the latest x values and send it, but you don't even have to cache, just send it.

---

<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:** [22 October 2022 12:26 UTC](https://discourse.nodered.org/t/serial-input-stops/69419/6 "2022-10-22T12:26:48Z")

</div>

@bakman2 Thanks man. I will try this and let everyone know here.

---

<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:** [22 October 2022 12:34 UTC](https://discourse.nodered.org/t/serial-input-stops/69419/7 "2022-10-22T12:34:49Z")

</div>

I just ran it with an inject node set to 0.1 seconds - 1000 elements, looked like a nice oscilloscope 😉  
Appears to behave quite well.

---

<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:** [22 October 2022 12:47 UTC](https://discourse.nodered.org/t/serial-input-stops/69419/8 "2022-10-22T12:47:57Z")

</div>

@bakman2 Ohh really. Actually i am out. Not with my system. Will check after i reach. This sounds amazing. Can't wait to check myself

---

<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:** [5 November 2022 12:48 UTC](https://discourse.nodered.org/t/serial-input-stops/69419/9 "2022-11-05T12:48:33Z")

</div>

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