Serial node problem

I have some problems with using the serial node.

It sends data w/o any problem, but able to receive data only in request mode.

I want to connect the device, which sends data to serial w/o any request.

Maybe somebody knows, how to fix it?

Surely, that is an issue with whatever needs to send the data?

All you need to do in NR is connect to the appropriate serial port on your computer and you are already doing that in order to be able to send data.

So all you need to do is get the other device to actually send something.

It is not so simple.

Please, look on video.

https://youtu.be/Wm_2VcWYx0g

Why do you have both an in/out and a request node? Not sure how well they play together to be honest, I've never tried.

Also what settings do you have for your serial-port config node?

It is also generally helpful if you include information about what versions of node.js and Node-RED you are using.

1 Like

You have need to send cr/lf in your terminal program

Only to show the problem.

This is my config:
serialconfig

Node-Red v 0.20.7
node.js v10.16.0

I've tried to test it on Raspbian and on Windows, same problem.

You have to set the checkbox "sendnew" in your terminal program.

This is not a solution. It only adds LF and CF to the message. I need a transparent transmission.

The serial in node needs to understand what constitutes the end of a "message" or record.

So when sending, you have to decide what that will be. You either have to have a line ending or an arbitrary timespan.

Your configuration at the moment listens to input until it receives \n - if you never send that, the serial in node will never spit out any data.

That is your issue.

I think, more reasonable way is to split the messages via timeout (1-2 bytes timeout for example).

The way to split it by /n is not so good solution. Too many devices send the standard packets w/o /n on the end. And with this solution, all of those are totally unuseful for work with Node-Red. This is an issue.

If there is no terminator how do you know when the end of a packet is reached?

Wait for 2 bytes(~1.6 milliseconds for 9600bps), if no data - end of the packet. It's a simple technique which works in many serial devices

You don't need to do that, have you looked at the other options in the port config?

image

If you know that you always need 2 bytes then use the fixed length option.

Thank you, I will try it. But I think I need after a timeout of or after a silence of option. Because of messages length may vary.

Well do that then, the options are there.

1 Like

Thank you! The options after a timeout of and after a silence of works fine.
I'm not pay attention on it. This is my problem)