Recieving Data from Serial Port

2,581 views
Skip to first unread message

Paul F Prinsloo

unread,
Mar 21, 2017, 11:44:38 PM3/21/17
to Node-RED
Hello Paul here.

I have a "strange" problem with a serial port from a Inverter that I want to connect to. My system is as follow:

OS : Windows 10
Node Red :
Node been used : node-red-node-serialport

The Communication format
Baud rate : 2400
Start bit : 1
Data bit : 8
Parity bit : N
Stop bit : 1

Then to receive data you first need to send a CRC command and then the Inverter responds with the data , in my case the command would be : 51 50 49 47 53 B7 A9
 When I send the command it seems as if no data is received from the inverter but when I use a serial port monitor I can see that Node Red is injecting the command and the inverter responds with data but it does not show up in the message payload. 
What am I missing? Is there some other node that I must first load to be able to see the data coming from the inverter?

Here is a picture of the setup : you will see that it also shows as Connected as well.


Thank you for taking the time to assist!

Best regards

Paul



Dave C-J

unread,
Mar 22, 2017, 12:20:36 AM3/22/17
to node...@googlegroups.com
By default the serial in waits for a cr ( \n ) character before sending data. What does the inverter actually send ? Did it end with a cr ? Or do you need to look for another char, or time ?

Paul F Prinsloo

unread,
Mar 22, 2017, 1:15:42 AM3/22/17
to Node-RED
Hello Dave thank you for responding

This is the response I get from "Free Device Monitoring Studio" 

The output that I exspect should be in the form of 
(231.0 50.0 000.0 00.0 0000 0000 000 000 00.00 00 000 0021 0000 000.0 00.00 00000 00000000È

If it helps this is the tread that I am working from to read the Inverter >

http://forums.aeva.asn.au/pip4048ms-inverter_topic4332_post57733.html#57733


Best regards


Paul

Dave C-J

unread,
Mar 22, 2017, 4:30:52 AM3/22/17
to node...@googlegroups.com
Hi,
oops I may have confused things... the default is for the node to look for \n which is of course lf (not cr) - looking at the spec you need cr which should be \r
Also I see they add a crc which may be a non-ascii character - that may "just work" - or you may have to receive a binary buffer first then pull out the data you need... - 
eg as below - (but try the ascii / text first just in case)
Inline images 1

Paul F Prinsloo

unread,
Mar 22, 2017, 5:33:01 AM3/22/17
to Node-RED
Ah Thank you Dave 

Yes that will also have an influence on sending the data to the inverter.The one problem that I still have is that I don't get a response from the serial node. Even if I do give the wrong command to the Inverter will respond as I noticed in the serial monitor. 

So I am not sure , if the "debug" node might not be able to "see" the data coming from the serial node in the sense that it might not be able to understand if it is sent or does the serial node not receive data from the com port even though it is sent by the inverter. 
Is there a way , other than the debug node , to check if data is received by the serial node?

Best regards

Paul

Dave C-J

unread,
Mar 22, 2017, 6:30:22 AM3/22/17
to node...@googlegroups.com
Well the debug will try to handle anything it sees. As I said the serial node may need to be put into binary mode to handle the crc character. (or may not)... 
The other thing to try is to set the port to wait for a timeout instead. That starts timing from as soon as it sees a character - so try something like 20mS to start with and play from there. This is never ideal as you may get half or one and half messages etc... but at least it will show if anything arrives... 

Paul F Prinsloo

unread,
Mar 22, 2017, 6:16:42 PM3/22/17
to Node-RED
Hi Dave and Co

Ok I have manage to get the command right and receive the data as it should look like unfortunately not in node red. The settings in Serial port matches with that of AccessPort , where I have managed to send the command and receive the correct answer.

Where else can i add settings for the serial port node as it seems asif I have all the settings. The only thing that I see that is different is the Buffer Size , will that result in the data not been send in Node Red?

Paul F Prinsloo

unread,
Mar 22, 2017, 6:22:21 PM3/22/17
to Node-RED
Here is another view of the serial monitor where you can see that the command does get injected into the port from node red.



On Wednesday, March 22, 2017 at 5:44:38 AM UTC+2, Paul F Prinsloo wrote:

Dave C-J

unread,
Mar 22, 2017, 6:49:27 PM3/22/17
to node...@googlegroups.com
And do you have a shot of the Node-RED debug output when set to \r , and Buffer mode ?

Paul F Prinsloo

unread,
Mar 22, 2017, 10:57:00 PM3/22/17
to Node-RED
Hi Dave thank you for taking the time to help!

Below is the Screenshot and the results after inject. The problem , I think , is with receiving the response and showing it on debug as the input is recorded. But how to find why it is not showing the "output" I am a loss at.

Reply all
Reply to author
Forward
0 new messages