Steinhart-Hart equation
Applies Steinhart-Hart equation to MSG Payload For use with NTC Thermistors Read in By ADC
Code taken Form Various other Nodes and combined for this Specific purpose.
[{"id":"2652293.9923c56","type":"function","z":"89b19a42.2ec3e","name":"Steinhart-Hart","func":"//Create variables\n\nvar T;\nvar R;\nvar analogueOut = Number(msg.payload); //Reading from ADC\nvar Temp\n\n// Steinhart-Hart B parameter Equation variables\nvar B = 3380; //Type of NTC or B variable\nvar T0 = 298.15;\nvar rPass = 10; //resitance of passive resitor in kOhm\nvar rThermistor = 10.55; //resistance of thermistor at room temperature in kOhm (Take manual Mesurement)\n\n//Take readings\n//calculate resistance of thermistor\nR = rPass / ((4095 / analogueOut)-1); // 4095 or 1026 depending on ADC used\n//calculate correspnding temperature in degC of thermistor based on resistance value using Steinhart-Hart equation\n//B parameter version of steinhart equation\nT = 1 / (1/T0 + 1/B*Math.log(R/rThermistor)) - 273.15;\n//Round Number to 2 decimals\nT = Math.round(T * 100) / 100; \n\n//Send the information out\nnode.send({topic: Temp , payload: T , id: '2'}); //send inforamtion out of node, attach topic to payload for identification later\n\n\n","outputs":1,"noerr":0,"x":660,"y":220,"wires":[["26ae06a3.04a5b2"]]}]