Serial input won't split on hex character? (re: STX / ETX)

I'm new to Node-RED and I'm trying to use the serial input node to have it detect response messages from the serial port in the format: STX .. ETX.

If I don't assign a start character and split character it displays fine:

In the debug output you can see the 0x2 and 0x3 in the message.

However, if I assign them as start/split characters then I don't get any output at all:

What am I doing wrong?

I'm looking at other threads that might provide a clue. In my flow, I have one serial output node (to send test messages to the serial port) and then a separate serial input node to see the responses. I will look into using the serial request node, but I wanted to separate them for now to play around with Node-RED.

The answer is on the bottom of the screen shot.
You have to enter 0x02 instead of 0x2.


I've also tried that (and double-checked just now) and it doesn't work either. :frowning:

I think I've tried everything I can think of ... (and I made sure to re-deploy, etc)

Here is my flow:

With that setup what do you see in the debug?
What happens if you leave in the split on but take off the wait for, and vice versa.

OK - This is quite strange and frustrating.

These settings produce consistent results every single time:

You can see the 0x2 at buffer[8] and the 0x3 at buffer[14].

These next settings only work sometimes and it's very random:

This is really driving me crazy... The first settings work every single time without fail and the data is exactly the same in the debug window. I'm using my [Turn Off] injector to send data into the serial port for my testing. I've also monitored the serial port myself (minicom, etc) and the data input/output is exactly the same so I'm not sure why the start character is acting so inconsistently?

Has anyone got any quick Arduino/ESP fu to knock up a quick .ino file to send some data over serial like above so we can attempt to debug this ? thanks

With the start character specified and the timeout, when it doesn't work what do you see in the debug? Anything?

@dceejay I'll create an Arduino sketch to recreate the exact input/output sequence. Thank you SO MUCH for looking into this!

What device is easiest for you to test with? I can write something for Arduino Uno, ESP8266, ESP32, etc.

@Colin When it doesn't work I don't see anything at all in the debug.

Here is an Arduino test script.

#define ARRAYSIZE 15

byte myarray[ARRAYSIZE] = {0x33,0x30,0x20,0x61,0x31,0x20,0x30,0xd,0x2,0x20,0x32,0x20,0x38,0x20,0x3};

void setup() {


void loop() {
  for (int i = 0; i < ARRAYSIZE ; i++) {

Sorry for the crtl+v, it's not allowed to upload ino or zip file here.


Great - that looks good.. will give it a go.

Found it... - version 0.10.3 pushed to npm. Should update in flows soon.
Thanks all.
Now prints me a buffer like
when set to look for 0x02 and split on 0x03

1 Like

@dceejay Wow - thanks so much for taking the time to fix it and so quickly! Initial testing looks like your fix is working.

Thanks very much as well to @edje11 for writing the test code and to @Colin for helping!

Going forward, it looks like I should use the serial request node though, right? For example, I need to send a serial command and wait for an acknowledge response. (I was using Serial In and Serial Out to learn Node-RED and test the commands individually, etc)

The goal is of my first project (workflow) is to convert a serial device to mqtt.

1 Like