# Serial data filtering + interpretate

**URL:** <https://discourse.nodered.org/t/serial-data-filtering-interpretate/8805>\
**Category:** Share Your Projects\
**Created:** [10 March 2019 12:23 UTC](https://discourse.nodered.org/t/serial-data-filtering-interpretate/8805 "2019-03-10T12:23:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spychacz84](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@spychacz84](https://discourse.nodered.org/u/spychacz84)\
**Post date:** [10 March 2019 12:23 UTC](https://discourse.nodered.org/t/serial-data-filtering-interpretate/8805/1 "2019-03-10T12:23:27Z")

</div>

Hello community.

This is my first post on this grupo so please be patient and forgive me my mistakes.

I am newbie with java, But i am trying my best.

I already connected Masimo Rad-7  
[[http://gaursurgicals.in/wp-content/uploads/2018/07/radical7.png](http://gaursurgicals.in/wp-content/uploads/2018/07/radical7.png)]  
to  
Raspberry pi 3 B+  
using standard RS232 to usb wire

I am receiving data in such form in debug:

> Blockquote  
> "03/10/19 13:48:12 SN=---------- SPO2=091% BPM=075 PI=00.90 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:13 SN=---------- SPO2=091% BPM=075 PI=00.91 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:14 SN=---------- SPO2=091% BPM=075 PI=00.97 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:15 SN=---------- SPO2=091% BPM=075 PI=00.97 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:16 SN=---------- SPO2=093% BPM=075 PI=01.00 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:17 SN=---------- SPO2=092% BPM=074 PI=01.00 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:18 SN=---------- SPO2=092% BPM=074 PI=01.00 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:19 SN=---------- SPO2=092% BPM=074 PI=01.00 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:20 SN=---------- SPO2=092% BPM=074 PI=00.99 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:21 SN=---------- SPO2=092% BPM=074 PI=00.99 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:22 SN=---------- SPO2=092% BPM=074 PI=00.99 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:23 SN=---------- SPO2=092% BPM=074 PI=00.96 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:24 SN=---------- SPO2=092% BPM=074 PI=01.10 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:25 SN=---------- SPO2=092% BPM=074 PI=01.10 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:26 SN=---------- SPO2=091% BPM=074 PI=01.00 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:27 SN=---------- SPO2=089% BPM=074 PI=01.10 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:28 SN=---------- SPO2=091% BPM=074 PI=00.97 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:29 SN=---------- SPO2=091% BPM=074 PI=00.93 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:30 SN=---------- SPO2=091% BPM=074 PI=00.93 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:31 SN=---------- SPO2=091% BPM=074 PI=00.93 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:32 SN=---------- SPO2=092% BPM=075 PI=00.93 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:33 SN=---------- SPO2=091% BPM=078 PI=00.92 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:34 SN=---------- SPO2=090% BPM=078 PI=00.91 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:35 SN=---------- SPO2=092% BPM=080 PI=00.89 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> "03/10/19 13:48:36 SN=---------- SPO2=092% BPM=080 PI=00.85 SPCO=--% SPMET=--.-% SPHB=--.- SPOC=-- RR=--- DESAT=-- PIDELTA=+-- PVI=--- ALARM=000000 EXC=0000800 EXC1=00000000↵"  
> Blockquote

I am able to send data to file and after all i can also filter in calc / excell requested data, but what is my target is to filter data, and to be able to log to webserver and read it in real time.

 ![2019-03-10_13h26_53](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/50bc73c6054bc722382d4ab949f133bbf86622ca.png)

The problem for me is to generate formulas understandable for graphs

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [10 March 2019 13:25 UTC](https://discourse.nodered.org/t/serial-data-filtering-interpretate/8805/2 "2019-03-10T13:25:28Z")

</div>

It’s javascript not java.

The data is a string (look at the quotes) so you will need to split it into different parts.

This is trivial to do with a function node and the javascript split command. There are numerous tutorials online if you google for “javascript split”

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 March 2019 14:37 UTC](https://discourse.nodered.org/t/serial-data-filtering-interpretate/8805/3 "2019-03-10T14:37:33Z")

</div>

I'm not in a position to assist only able to give clues...

1. I believe you can set a delimiter on the serial node. Set that to carriage return (or line feed or whatever the data sends at the end of its line)
2. Send the output to a function node than use msg.payload.split(" ");.
3. Send that to a debug node to see if it's splitting the lines into and array of strings containing XXX=yyy
4. Next you need to loop through the array and split each element by =. E.g. var propValPair = splitData[I].split("=");

Give them steps a try first, see where you get. If you get stuck, export and post your flow here between three backticks `` ```

Google search is your friend here.

---

<div class="post-metadata">

**Author:** ![spychacz84](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@spychacz84](https://discourse.nodered.org/u/spychacz84)\
**Post date:** [10 March 2019 18:50 UTC](https://discourse.nodered.org/t/serial-data-filtering-interpretate/8805/4 "2019-03-10T18:50:28Z")

</div>

Thank You Steve-Mci

I will try Your tips in next couple of days.

I reach my target in round way.  
I am really newbie with java **SCRIPT**  
Last experience was nearly 20 years ago based on turbopascal 🙂

According to few tutorials i wrote fuctions like asking 3 years old kid to replicate letters:

I spered data by [Space]  
Then read exact part trim,  
then again i cut string - this time by (=)  
As final efect i reach something like that

What is problematic - when i am turning off the source of serial data, there is no information about disconnect of infoirmation.

I will try to figureout, how to add the button ie:  
If incoming string from serial - then displey connected; other display disconected.  
 ![2019-03-10_20h20_42](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/6fdd98d3d2347c1949cb0563339726b9ac0db60a.png)  
 ![2019-03-10_19h46_09](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/d/d32ec124dc42695f22d517f58cdb548914e7d40c.png)  
 ![2019-03-10_19h46_51](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/fdfd4e79fc7cfb1a923427c1693c6e682660436b.png)  
 ![2019-03-10_19h47_10](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/58ccf6039eda1ef33ed68cb2d0946088c7e2b147.png)  
 ![2019-03-10_19h47_52](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/ff57079604320c86dc273471aa9e727ac641bb8f.png)
