# Issue getting serial data into Node-RED

**URL:** <https://discourse.nodered.org/t/issue-getting-serial-data-into-node-red/55326>\
**Category:** General\
**Created:** [17 December 2021 02:41 UTC](https://discourse.nodered.org/t/issue-getting-serial-data-into-node-red/55326 "2021-12-17T02:41:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CerealPort](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@CerealPort](https://discourse.nodered.org/u/CerealPort)\
**Post date:** [17 December 2021 02:41 UTC](https://discourse.nodered.org/t/issue-getting-serial-data-into-node-red/55326/1 "2021-12-17T02:41:05Z")

</div>

Hi all. I'm trying to read some serial data from an environmental data logger.

This is the raw serial data it exports as read from my Mac using SerialTools:

 ![Screenshot 2021-11-30 at 13.01.11](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/7/37efc10b4599dbe4fb39fe362784cac24f4ae9e5.png)

Simply parsed, it is

> 43290000000945 (945 parts per million CO2)  
> 41040100000612 (61.2% relative humidity)  
> 42010100000186 (18.6ºC)

The flow to parse this clean data (which is separating them based on the header, and keeping only the last three characters) is done and works great when using an Arduino to export data in a similar format (ie just the "42010100000186"), but when I try to read the serial data from the actual data logger, Node-RED can't read it.

Using the terminal, I can see that the Raspberry Pi can actually receive the serial stream fine:

 ![Screenshot 2021-12-17 at 02.31.16](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/6/36c95da3693ed9de8b06d9084d04e9c01b6cedf7.jpeg)  
In this screenshot it's getting ■4201010000017302 and refreshing once per second or so. The 02 at the end is of course not desired, but that's easy to remove if needed.

So my thinking is that maybe somehow the \<0D\> and \<02\> are preventing it from going into Node-RED.

Any ideas?

Thanks!

---

<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:** [17 December 2021 07:33 UTC](https://discourse.nodered.org/t/issue-getting-serial-data-into-node-red/55326/2 "2021-12-17T07:33:12Z")

</div>

How have you setup the serial port? It looks like you should wait for 0x02 then split on \r (the 0d)

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

---

<div class="post-metadata">

**Author:** ![CerealPort](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@CerealPort](https://discourse.nodered.org/u/CerealPort)\
**Post date:** [17 December 2021 14:54 UTC](https://discourse.nodered.org/t/issue-getting-serial-data-into-node-red/55326/3 "2021-12-17T14:54:12Z")

</div>

Thanks! I just managed to do it by splitting after 100ms of inactivity and it now works great, but I have to do a couple more flows for this, so I'll definitely try your method which is more elegant.

---

<div class="post-metadata">

**Author:** ![CerealPort](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@CerealPort](https://discourse.nodered.org/u/CerealPort)\
**Post date:** [18 December 2021 10:55 UTC](https://discourse.nodered.org/t/issue-getting-serial-data-into-node-red/55326/4 "2021-12-18T10:55:40Z")

</div>

I tried your method and it worked perfectly. Thanks!

---

<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:** [1 January 2022 10:56 UTC](https://discourse.nodered.org/t/issue-getting-serial-data-into-node-red/55326/5 "2022-01-01T10:56:37Z")

</div>

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