Serial connection to CAS PD-II Scale

Hello awesome Node-RED community,

I'm looking for general guidance here because I realize every serial device will be slightly different. I'm just not sure if I'm in the correct ballpark in my approach.

My environment/setup: I've got a CAS PD-II scale connected via USB (USB 2.0 Type A to Type B) to a Linux machine running Node-RED with the node-red-node-serialport palette installed.

My goal: I want to either receive a constant stream of weight value updates from the scale or make a request to the scale (if appropriate) to get the current weight value.

According to the CAS documentation and from what I've seen on support blogs, it appears I may need to send a request with a "W" character to start receiving the weight output from the scale. So I've set up a basic flow to inject that "W" character which seems to be working except a) the response doesn't make any sense, and b) I'm not getting any other messages from the scale with the weight output.

image

image

The CAS documentation seems to contradict itself on the required baud rate and other settings, but I've tried with different Baud Rate, Data Bits and Parity settings on the NR side, and the CAS also has preconfigured "Type" settings that I've tried to no success.

Before I seek to test every possible permutation of these settings, I wanted to see if the NR community had any similar experience that may help. Thank you in advance!

Hi @grodgers,

I'm not a pro here... But

If it requires a "I'm ready" type message (W), the Request/Response node setup is not likely the one you need. I could be wrong, but the Request Serial Node will do 1:1 matching...

  • Send/Receive
  • Send/Receive
  • Send/Receive
  • Send/Receive

I would...

  • Use a serial out node to send the W (it might be worth sending a new line character here also)
  • Use a serial In node to read from the resulting stream of measures

Both nodes will use the same connection.

The output you see looks like binary:
Try the below settings - it may be the weight in bytes you are seeing.

Screenshot 2024-04-03 at 18.50.00

The split allows it to settle before "dumping the payload"
but if the measuring is constant you may be get overlapped payloads, so if you know of a "termination" character that is included you can use "on the character" instead.

plenty here, who maybe more qualified then I.

Thanks, @marcus-j-davies. I tried all of your suggestions - and they make sense to me - but I'm still not getting anything useful out of the scale. Your thought about sending the new line character at the start prompted me to check the CAS documentation again.

I'm still confused by the documentation referring specifically to RS-232C interface when I'm using the USB connection. They're both serial, but does it make a difference in the type of commands being sent or received?

The CAS docs refer to a "Type-3" interface for continual RS-232C based on the following command and response protocol:

With the following example:

And this note which seems pretty clear that the newline will actually stop the transmission of data, but it never seems to start at all with what I've tried so far:

Hopefully, the additional notes help someone understand what I'm missing here.

Your usb interface is a USB to RS232 adaptor.

USB = Universal Serial Bus :wink:

Joking aside, many device manufactures simply bolt in a USB-serial convertor in side their product so it is essentially is a serial device. From the POV on Node-RED there is no difference - just make sure you select the correct device in the config.

It is not clear what W is. It mentions <W> and W<57H> and it is unclear if STX/ETC should be provided.

Can you link to the manual?

I would probably try sending various combinations like W, <STX>W, <STX>W<ETX> etc. I would also reset the device and Node-RED between attempts (to clear any buffered comms)

1 Like

And my suggestion to add a new line after W likely stops anything that may have been attempted, according to the screenshots :grimacing:

Might be this one.

http://www.microdatanorte.com.mx/app/download/6137208/PDII.pdf

Thanks, guys. Here's another link to the manual if the one Marcus provided doesn't work: Type-3 Interface - CAS PD-II Manual [Page 17] | ManualsLib

Ok, that is very helpful and good to know about the internal converter.
I agree it is not super clear, but I will try sending the commands more explicit according to their documentation and see what happens.

Progress - @Steve-Mcl your suggestion of resetting the device definitely helped. I'm now sending the W command as I have in the past, and now I'm receiving a steady stream of information from the scale.

I believe <57H> is just a reference to hex value of the W character if that's how the command must be sent. In my case, I'm just sending the ASCII. However, sending \n does not seem to stop the flow of data from the scale as expected.

I also need to figure out how to convert the data I'm receiving from the scale into something meaningful.

But this gives me hope!

1 Like

How are you setting the string to this value?

Also, CR == Carriage Return (ASCII 13, \r)

The puzzle pieces finally came together! High fives all around!

Specific to this CAS PD-II scale, I switched to "Type-2" interface. Still not sure what this actually controls, but this allowed me to make a command and receive an immediate, single response containing the value currently displayed by the scale.

Going back to the CAS documentation, <STX> refers to the "Start of Text" ASCII character (hex value of 02, which I am simply removing from the response. The docs also refer to <CR> as the end of the message coming from the scale; however it literally translates into both characters of Carriage Return and Line Feed (ASCII values of 13 and 10, respectively). This is likely what I would have to send to the scale if it's in Type-3 mode to stop the data feed, but I think I'm good with this implementation.

Once I get the value, I am just formatting it to the appropriate decimal value. I am going to try the serial request node again to see if I can simplify the flow a bit, but the following shows a working flow:

You guys are awesome! Thanks so much for the assistance in working through this!

1 Like

Oh, and here are the serial node settings in case anyone needs this for reference

image

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