How to convert my modbus data to Fahrenheit

I have a ADAMS 6015 RTD module which i wanna use with node red. Can only communication
with it via Modbus read. I have gotten as far as getting decimal and hexadecimal temperature values back to node red via Modbus read. Is there any way to get actual Celsius values back to node red, Since the module already converts rtd to Celsius? Also not quite sure on how the modbus address works.
Below is screenshot of what rtd is displaying now, and of the modbus address in utility, and of modbus from user manual. also screenshot of values in node red.

adams3

I'm confused.

One of these devices nodes gives you a reading which is the temperature, and as it gives you the reading, that node would have an output.

Going on what you have shown with your screen shot, that is the one called rtd, and it has 2 outputs.

If you connect those outputs to a debug node and set it to show the entire message: what happens?

Oh, and what is the temperature at the time of taking the reading?

Hi,

In order to get the Modbus decimal to Eng units you need to use this formula according to the docs.

Example Flow:

[{"id":"e408ef72.58812","type":"inject","z":"94ab22aa.035ba","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"22048","payloadType":"num","x":210,"y":1040,"wires":[["dda5ae4b.3055b"]]},{"id":"dda5ae4b.3055b","type":"function","z":"94ab22aa.035ba","name":"","func":"// pt100 range -50 ~ +150\n\n\nlet decimal = msg.payload\nlet celsius = ( decimal / 65535) * 200 - 50 \n\nmsg.celsius = celsius\n\nlet fahrenheit =  (celsius * 9/5) + 32\n\nmsg.fahrenheit = fahrenheit\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":450,"y":1040,"wires":[["a7beba74.31897"]]},{"id":"a7beba74.31897","type":"debug","z":"94ab22aa.035ba","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":1040,"wires":[]},{"id":"1443a3c7.aabf1c","type":"comment","z":"94ab22aa.035ba","name":"modbus decimal","info":"","x":210,"y":1000,"wires":[]}]

Code in Function :

// pt100 range -50 ~ +150

let decimal = msg.payload    // msg.payload[0] when linked to modbus node
let celsius = ( decimal / 65535) * 200 - 50 
let fahrenheit =  (celsius * 9/5) + 32

msg.celsius = celsius
msg.fahrenheit = fahrenheit

return msg;

Result :

image

[EDIT]

By the way .. what modbus addresses did you read in your screenshot above ? 40001 ?
Did you try reading 31 and 32 also ? Your device could be sending the engineering units in those directly which makes the above code unnecessary :wink:

1 Like

The one called rtd is a modbus read node, I just named it rtd.
So i can actually get my temp from decimal or hexadecimal, Not having to worry About getting a floating point number?
my sensor range in the specs is -50 - 200 celsius. Actual temp in room was around 64 fahrenheit, always changing a few degrees.
So i attached 2 debug nodes. screenshot below.
debug data is expanded on bottom two

adams5.PNG

Ofcourse .. as i have demostrated with the above example flow.
Wire a Function node to the top output of your Modbus read node with the code :

// pt100 range -50 ~ +150

let decimal = msg.payload[0]
let celsius = ( decimal / 65535) * 200 - 50 
let fahrenheit =  (celsius * 9/5) + 32

msg.celsius = celsius
msg.fahrenheit = fahrenheit

return msg;

Then wire a complete msg Debug node after the function node and thats it .. you get your fahrenheit temperature in msg.fahrenheit

I dont know about that .. i made my calculation based on the settings you had in the screeshot above
image

IF the range is -50 ~ 200 C and the reading temp is off, then you should correct the range in the Adam Utility and adjust the calculations in the function. let celsius = ( decimal / 65535) * 250 - 50

OK thank you very much. It seems like the sensor specs don't affect the reading temp.
Cause its very accurate using -50 to 150c. If not ill adjust the calculations accordingly.

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