October 6, 2019

Home Assistant Phidgets Voltage Divider with Thermistor Temperature Sensor

The sensor value_template can be used to convert the Voltage Ratio from a Phidgets 1121 Voltage Divider with a Thermistor to a temperature value in Home Assistant. This installation uses a python script to publish the Phidgets voltage ratio to the Home Assistant MQTT Mosquito Broker. The voltage ratio is presented to the value_template as "value" in the Home Assistant configuration.yaml file. The result can be Fahrenheit or Celsius. Change the last line from FT to CT if Celcius is desired.

The Thermistor Equation Constants are from Think SRS. Additional data is from the Dywer thermistor table column B for Type II Thermistors.

sensor:
  - platform: mqtt
    name: "HVAC Plenum Supply"
    unit_of_measurement: '°F'
    state_topic: "phidgets/sensorb/a3"
    value_template: >-
        {# TE-DFN-B0444-00, 4" Probe, 10K Ohm Type II Thermistor #}
        {# Fixed Resistor Value #}
        {% set FR = 10000 %}
        {# Voltage Ratio From Phidgets #}
        {% set IV = float(value) %}
        {# constants #}
        {% set A = 0.001127354682 %}
        {% set B = 0.0002343978227 %}
        {% set C = 0.00000008674847738 %}
        {# Thermistor Resistance #}
        {% set TR = FR * (( 1 / IV ) - 1) %}
        {# Inverse K Temperature #}
        {% set IK = A + ( B * log(TR) ) + ( C * log(TR)**3 ) %}
        {# Kelvin Temperature #}
        {% set KT = 1 / IK %}
        {# Centigrade Temperature #}
        {% set CT = KT - 273 %}
        {# Fahrenheit Temperature #}     
        {% set FT = ( CT * 9 / 5 ) + 32 %}
        {{ FT | round(1) }}

No comments:

Post a Comment