im reading modbus tcp values, when temperature goes -1 and below the graph seems to go bananas at night. Im trying to find out the right formula to calculate negative values passed from the modbus tcp.. i tried
y=mx+c
where x is analog value, y is values stored as max/min value in holding register(16bit)
m=(Ymax-Ymin)/(Xmax-Xmin)
The sensor is a PT1000 and i base Xmax as Ymax.. in example.. PT1000tables at the internet shows me +50 at 1194ohm and -50 at 303ohm
(50--50)/(1194-303) => 100/891=0,11 (m)
and... here im stuck, not sure what to do... maybe my sensor is bad or my node-red settings are bad
Does the x value represent ohms or what?
What x values are you getting and what values are X and Y max and min?
What formula are you using at the moment and are the values correct for positive values?
If you are getting the right values without calculation for +ve but not for -ve then yes, you have a signed value which you need to convert to unsigned. It may be that you should be user the buffer-parser node for extracting the data, that will likely do everything you need in one go.
Sorry, I didn't mean convert to unsigned, I meant that you should pick it up from the buffer, converting it a signed value as you do it, rather than an unsigned value.