# Split serial message

**URL:** https://discourse.nodered.org/t/split-serial-message/92486
**Category:** General
**Created:** [18 October 2024 08:38 UTC](https://discourse.nodered.org/t/split-serial-message/92486 "2024-10-18T08:38:21Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![soenke](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@soenke](https://discourse.nodered.org/u/soenke)
#### Post date: [18 October 2024 08:38 UTC](https://discourse.nodered.org/t/split-serial-message/92486/1 "2024-10-18T08:38:21Z")

</div>

Hello,

I am new to this forum and have my first question:

I have a serial port node that is receiving data.

The format of the recieived data is that each message STARTS with a 0xA5 and has that between 2 and 5 additional payload data.

I understood that I can split the received data within the serial input node, by entering the seperator charcater. But this is not what I need.

What I need are sequcenser likme this:

0xA5 0x0D 0x20 0x30  
0xA5 0x06 0x56 0x63 0x10  
0xA5 0x30

What this serial node is doing is:

0x0D 0x20 0x30 0xA5  
0x06 0x56 0x63 0x10 0xA5

Any ideas how I can split my received data in that way I need it?

Thanks,

Sönke

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [18 October 2024 08:43 UTC](https://discourse.nodered.org/t/split-serial-message/92486/2 "2024-10-18T08:43:49Z")

</div>

Hi and welcome to the forum.

I just want to check what you are wanting to _see/get_.

So if you receive:

```auto
0xA5 0x0D 0x20 0x30

```

You want:

```auto
0x0D 0x20 0x30 0xA5

```

But that includes the `0xA5` from the next message.  
Not a big deal, but just checking.

---

<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: [18 October 2024 08:45 UTC](https://discourse.nodered.org/t/split-serial-message/92486/3 "2024-10-18T08:45:21Z")

</div>

Hi, welcome to the forum

1. Is this a known/documented protocol?  
2. If not, can you explain precisely what the start and end marks of a transmission are? (and any other gotchas for example, how do you escape the value `0xA5` when it is not a start mark but an actual data value?)
2. Are you in control of what the serial device sends (i.e. would you be able to modify the serial device output if it made sense to?)

---

<div class="post-metadata">

### Author: ![soenke](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@soenke](https://discourse.nodered.org/u/soenke)
#### Post date: [18 October 2024 08:48 UTC](https://discourse.nodered.org/t/split-serial-message/92486/4 "2024-10-18T08:48:28Z")

</div>

Hi,

I want the 0xA5 0x0D 0x20 0x30

That is what my devices sends out.  
I have no END character that tells me the message is complete. I can only see this by receiving the new START character.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [18 October 2024 08:51 UTC](https://discourse.nodered.org/t/split-serial-message/92486/5 "2024-10-18T08:51:43Z")

</div>

Ok, sorry. I looked at it the wrong way around.

So the device is sending:  
`0xA5 0x0D 0x20 0x30`

and you want:

`0x0D 0x20 0x30`

Or is it `0x0D 0x20 0x30 0xA5`?

> I have no END character that tells me the message is complete

That isn't a problem unless you can get/receive `0xA5`

You just keep looking at the received data UNTIL you get `0xA5`

---

<div class="post-metadata">

### Author: ![soenke](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@soenke](https://discourse.nodered.org/u/soenke)
#### Post date: [18 October 2024 08:52 UTC](https://discourse.nodered.org/t/split-serial-message/92486/6 "2024-10-18T08:52:07Z")

</div>

Hi, yes the protocl is know and documented. It is the output of a decibel meter of peak tec.

It has no END byte. That is my problem 😉

I assume the 0xA5 can happen in the paypload. Due tot the fact that after the start byte 0xA5 an content identifier is sent that tells how many bytes will follow, that should be no problem (but perhaps for a spliiting alogrithm it can).

No, I can not change this protocol, it is the output of a closed device.

Thanks for your help.

Sönke

---

<div class="post-metadata">

### Author: ![soenke](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@soenke](https://discourse.nodered.org/u/soenke)
#### Post date: [18 October 2024 08:55 UTC](https://discourse.nodered.org/t/split-serial-message/92486/7 "2024-10-18T08:55:52Z")

</div>

Hi,

no the device sends a 0xA5 as start indicator. Than a content indicator and than between 2 and 4 additional bytes.

Than it starts again with the 0xA5 and so on.

 ![18-10-2024_10-55-24](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/7/57839578dcf118e32e9fff6c68c2d716e6dcf8e9.jpeg)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [18 October 2024 08:57 UTC](https://discourse.nodered.org/t/split-serial-message/92486/8 "2024-10-18T08:57:21Z")

</div>

> [@soenke](#):
>
> It has no END byte. That is my problem

Assuming there is some sort of time gap between messages you may be able to use the timeout feature to detect the end of a message.

Can you post a link to the device protocol please?  
**[Edit]** I see you have already posted the details, so ignore this.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [18 October 2024 09:01 UTC](https://discourse.nodered.org/t/split-serial-message/92486/9 "2024-10-18T09:01:04Z")

</div>

So in the second part

`0x06` is for time.

`0x0D` is for measurements

and anything else is a single piece....

Just checking.

---

<div class="post-metadata">

### Author: ![soenke](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@soenke](https://discourse.nodered.org/u/soenke)
#### Post date: [18 October 2024 09:01 UTC](https://discourse.nodered.org/t/split-serial-message/92486/10 "2024-10-18T09:01:47Z")

</div>

Hi. I am not allowed to post the pdf (am am a new user to this forum.) but you can see in the post above a screenshot of some information.

I can try to do that with the "timeout" bweteen the messages.

---

<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: [18 October 2024 09:02 UTC](https://discourse.nodered.org/t/split-serial-message/92486/11 "2024-10-18T09:02:52Z")

</div>

> [@soenke](#):
>
> Hi. I am not allowed to post the pdf (am am a new user to this forum.)

Is there not an online copy you can link to?

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [18 October 2024 09:06 UTC](https://discourse.nodered.org/t/split-serial-message/92486/12 "2024-10-18T09:06:15Z")

</div>

Would this sort of thing work for you?

I'll post pictures for now.

The flow

 ![Screenshot from 2024-10-18 20-04-49](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/b/5b9056d30d158dc592ff346a9d09cc4c6bb5de53.png)

How the `switch` is configured

 ![Screenshot from 2024-10-18 20-04-59](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/5/d58ec93f209488a85cccb6231530c3ce8563566e.png)

The output.

 ![Screenshot from 2024-10-18 20-08-57](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/5/05dcd76b9e53c0bbad54c2df3773cbcb69c457fb.png)

---

<div class="post-metadata">

### Author: ![soenke](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@soenke](https://discourse.nodered.org/u/soenke)
#### Post date: [18 October 2024 10:46 UTC](https://discourse.nodered.org/t/split-serial-message/92486/13 "2024-10-18T10:46:30Z")

</div>

Thanks for the example.

I get the following error message:

msg : string[31]

"Encrypted credentials not found"

The serial output is binary and not strings. So the 0xA5 is a real number and not the characters 0xA5.

Any ideas for me?

---

<div class="post-metadata">

### Author: ![soenke](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@soenke](https://discourse.nodered.org/u/soenke)
#### Post date: [18 October 2024 10:47 UTC](https://discourse.nodered.org/t/split-serial-message/92486/14 "2024-10-18T10:47:07Z")

</div>

Now I can post also pfds 😉

[8005\_interface protocol.pdf](https://discourse.nodered.org/uploads/short-url/qjkhr9kVnweB8I40hrtZCVwWcMV.pdf) (227.9 KB)

---

<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: [18 October 2024 11:02 UTC](https://discourse.nodered.org/t/split-serial-message/92486/15 "2024-10-18T11:02:26Z")

</div>

Can you not set the serial port to wait for the 0xA5 then send after a short timeout ? or is the stream continuous ?

 ![Screenshot 2024-10-18 at 12.02.04](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/2/723cc5ef5f890f867eb1fafb39c0f2f37dce61f3.png)

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [18 October 2024 11:44 UTC](https://discourse.nodered.org/t/split-serial-message/92486/16 "2024-10-18T11:44:43Z")

</div>

I'm guessing it will be _sporadic_.

But the _message_ wouldn't be sent until it is complete.

Though I guess increasing the time out wouldn't / shouldn't hurt.

---

<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: [16 January 2025 11:45 UTC](https://discourse.nodered.org/t/split-serial-message/92486/17 "2025-01-16T11:45:20Z")

</div>

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