Display serial input into debug

Hi There,

I'm trying to get the serial data send to my hardware in the debug output.I'm not sure whether it will send the data without any function node.below is the flow i have created.Kindly guide me to get serial data in the debug.currenlty it shows msg.payload as " " only. check the screenshots below.

If any node with some script is required I request you to give that also as I am at all into coding.
image

Thank You

Is your hardware sending any data ?

To send data to your hardware you need to use the serial-out or serial-request node.

Hi

Im using putty in my laptop to send serial data to my hardware running nodered using RS232.whenever I type something I can see in the nodered debug Im getting the outout as shown in the picture.
So I guess data is reaching till my hardware.I just want to see the exact character as I type in putty in the debug tab.

image
Hope its now clear for you

Thank you so much

you cant have two things talking to the same serial port - so either you can use putty OR you can use Node-RED. If you want to do what you suggest you need two serial ports connected back to back with a crossover cable

putty -> serial A -> x -> serial B -> Node-RED

Hi

actually I am connected with cross over cable from laptop to the device where NodeRED in running. I have a seperate hardware where I am running NodeRED.So the connection is exactly same as you showed.

Could you please share your views now.

Then as long as the port details are all correct then it should work. /dev/ttyCOM0 is a bit unusual though not seen one called that before.

I have actually, my old graphing calculator would connect to that one :slight_smile: It's an unusual one, but not impossible.

1 Like

What do you see if you tell the node to output a binary buffer?

Hi Colin,

Binary buffer doesn't give any output to the debug tab.

Hi dceejay
/dev/ttyCOM0 shows in the pallet as connected. If I change any of the character it says not connected. So I think it's properly talking with the serial port.

If I use msg.payload.length it gives the character count in the debug tab. I hope this will give you some good crack. I tried msg.payload.string hoping that it may return the character but it doesn't.

That doesn't make sense. Do you mean that no debug message appears at all, even if you keep sending data? Try it with split into fixed lengths of 1 (or another count) characters and send buffers.
When set to string do you get one message in the debug each time you send a character?

What character count? With it set to timeout after 0 msec you should get one character at a time.

Hi Colin,

I got this from forum .

var newMsg = { payload: msg.payload.length };
return newMsg;

if I use this I am getting the number of characters typed during the time interval.see the image.
image

if I replace the command like this and change ascii to binary I am getting the payload as below.with ascii string payload filed shows nothing.( what are the other options available to replace "length"? any changes here will give me the character I am typing ?)
image

for the first reply of yours,

when I did split into fixed length of I debug output is as below.
image

yes , I am getting one message in debug each time I send a character.

I hope this inputs helps you to understand the behavior. Thank you so much for your inputs.

So all your characters are coming through as zeros. I presume you are confident that you have the baud rate correct. If you run something other than node-red on the receiver end are you able to receive correctly?

Good idea. Try looping putty 1 to putty 2