Polling T4 Temperature_AIR_K | LabJack
 

Polling T4 Temperature_AIR_K

5 posts / 0 new
Last post
n5oe
n5oe's picture
Polling T4 Temperature_AIR_K

New to Labjack and Node-Red modbus all together. I am trying to poll the register for the ambiant air temperature of my T4. I can read and talk to the T4 succesfully when getting info on FIO4 and FIO5 as either high or low using node red. But when I try to poll the temperature register 60050 I get a data array[2] of 0:17307 and 1:21099

I finally figured out I think, this is a FLOAT32 register, and I need to have a quantity of 2 when I actually read. Kipling shows the value at aprox 310.5871 as of this post +/-, this is the number I was expecting to see once I polled this from Node-Red.

Any help would be appreciated, again sorry if this is obvious to the rest of the group, but I am VERY NOOB.

Thanks

LabJack Support
labjack support's picture
I would start by reading the

I would start by reading the test registers.  Based on the results it is easier to troubleshoot what is going on:

https://labjack.com/support/software/api/modbus/getting-started

 

n5oe
n5oe's picture
Thanks, had tried that before

Thanks, had tried that before I understood things a little more. Was getting the same kind of data array, but now I know the second half of the array is hex which is what I need to be converting with.

I have managed to get the temperature to work correctly by running the hex through a "function" node with the attached screenshot coding. This seems to work great, although if anyone sees this and has a better solution to convert float32 to BigEndian I am all ears. The Kelvin to F was copied from the online manual and worked flawlessly as well.

Am excited to continue to learn and integrate the T4 into Node-Red, Linux, and start some python scripting.

Keep up the great work oand offerings on this equipment, LOVE it!

LabJack Support
labjack support's picture
It looks like you are using

It looks like you are using the appropriate buffer function call, readFloatBE, to read the data as a big-endian float (4-bytes) starting at offset byte 0 in the buffer. Not sure if the hex encoding is needed and you can trying using "msg.payload.buffer.readFloatBE(0)".

n5oe
n5oe's picture
Fantastic, that worked

Fantastic, that worked perfectly and really cleaned my code up. THANK YOU Labjack Support!