Issue getting serial data into Node-RED

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:

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:


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!

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

1 Like

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.

I tried your method and it worked perfectly. Thanks!

1 Like

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