Add NTC/resistance sensor docs

Ref https://github.com/esphome/esphome/pull/560
This commit is contained in:
Otto Winter 2019-05-28 15:43:56 +02:00
parent 0bd3be8b67
commit 639f095393
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
11 changed files with 162 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

91
components/sensor/ntc.rst Normal file
View File

@ -0,0 +1,91 @@
NTC Sensor
==========
.. seo::
:description: Instructions for setting up NTC thermistor sensor in ESPHome
:image: ntc.jpg
The ``ntc`` platform is a helper sensor that allows you to convert resistance readings
from a NTC thermistor to temperature readings.
First, you need to get resistance readings from the sensor - you can set this up with the
:doc:`resistance <resistance>` and :doc:`adc <adc>` sensors.
This platform will then convert the resistance values to temperature readings.
It also requires calibration parameters for this conversion. There are two
ways of obtaining these values: By looking at the datasheet or manual calculation.
If you have the datasheet of the thermistor, you can look at its "B-constant" and
reference temperature/resistance. For example `this product <https://www.adafruit.com/product/372>`__
would have the following calibration configuration.
.. code-block:: yaml
# Example configuration entry
sensor:
- platform: ntc
# ...
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 10kOhm
If you don't have access to the datasheet or want to calculate these values yourself,
you have to first measure three resistance values at different temperatures.
Heat/cool the NTC to three different temperatures (best if temperatures are far apart)
and write down the resistance readings at those temperatures. Then enter these values in the
calibration parameter:
.. code-block:: yaml
# Example configuration entry
sensor:
- platform: ntc
# ...
calibration:
- 10.0kOhm -> 25°C
- 27.219kOhm -> 0°C
- 14.674kOhm -> 15°C
.. code-block:: yaml
# Example configuration entry
sensor:
- platform: ntc
sensor: resistance_sensor
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 10kOhm
name: NTC Temperature
# Example source sensors:
- platform: resistance
id: resistance_sensor
sensor: source_sensor
configuration: DOWNSTREAM
resistor: 5.6kOhm
name: Resistance Sensor
- platform: adc
id: source_sensor
pin: A0
Configuration variables:
------------------------
- **name** (**Required**, string): The name for the sensor.
- **sensor** (**Required**, :ref:`config-id`): The sensor to read the resistance values from
to convert to temperature readings.
- **calibration** (**Required**, float): The calibration parameters of the sensor - see above
for more details.
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
- All other options from :ref:`Sensor <config-sensor>`.
See Also
--------
- :doc:`adc`
- :doc:`resistance`
- :ref:`sensor-filters`
- :apiref:`resistance/resistance_sensor.h`
- :ghedit:`Edit`

View File

@ -0,0 +1,68 @@
Resistance Sensor
=================
.. seo::
:description: Instructions for setting up resistance sensors in ESPHome
:image: omega.png
The ``resistance`` platform is a helper sensor that allows you to convert readings
from a voltage sensor (such as the :doc:`ADC Sensor <adc>`) into resistance readings
in Ω (ohm).
In order to calculate the resistance, the circuit needs to be set up in a
`voltage divider circuit <https://learn.sparkfun.com/tutorials/voltage-dividers/all>`__.
This consists of three parts:
- A voltage reference, usually this is connected to 3.3V (VCC). For example in the image
below it is 5V (though on ESPs you should not use that voltage)
- A reference resistor with constant resistance. For example below it is R₁ with a value
of 5.6kOhm.
- The variable resistor we wish the read the resistance of. Here R₂.
There are two kinds of configurations for this circuit: Either the variable resistor
is close to GND (DOWNSTREAM) or it is closer to VCC (UPSTREAM).
.. figure:: images/resistance-downstream.png
:align: center
:width: 25.0%
Example voltage divider configuration of type "DOWNSTREAM" and a voltage
reference of 5V.
.. code-block:: yaml
# Example configuration entry
sensor:
- platform: resistance
sensor: source_sensor
configuration: DOWNSTREAM
resistor: 5.6kOhm
name: Resistance Sensor
# Example source sensor:
- platform: adc
id: source_sensor
pin: A0
Configuration variables:
------------------------
- **name** (**Required**, string): The name for the sensor.
- **sensor** (**Required**, :ref:`config-id`): The sensor to read the voltage values from
to convert to resistance readings.
- **configuration** (**Required**, string): The type of circuit, one of ``DOWNSTREAM`` or
``UPSTREAM``.
- **resistor** (**Required**, float): The value of the resistor with a constant value.
- **reference_voltage** (*Optional*, float): The reference voltage. Defaults to ``3.3V``.
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
- All other options from :ref:`Sensor <config-sensor>`.
See Also
--------
- :doc:`adc`
- :doc:`ntc`
- :ref:`sensor-filters`
- :apiref:`resistance/resistance_sensor.h`
- :ghedit:`Edit`

BIN
images/ntc.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

1
images/omega.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M19.15 19h-5.76v-2.13c2.11-1.62 3.2-3.63 3.2-6.03 0-1.5-.43-2.68-1.27-3.55C14.47 6.42 13.37 6 12.03 6c-1.35 0-2.46.42-3.32 1.3-.87.87-1.3 2.07-1.3 3.58 0 2.38 1.09 4.38 3.2 5.99V19H4.85v-2.13h3.56c-2.37-1.55-3.56-3.64-3.56-6.27 0-2.1.65-3.74 1.96-4.94 1.31-1.21 3.03-1.81 5.16-1.81 2.18 0 3.92.6 5.22 1.79 1.31 1.19 1.96 2.86 1.96 4.94 0 2.63-1.2 4.73-3.6 6.29h3.6V19z"/></svg>

After

Width:  |  Height:  |  Size: 449 B

View File

@ -118,9 +118,11 @@ Sensor Components
MPU6050, components/sensor/mpu6050, mpu6050.jpg
MQTT Subscribe, components/sensor/mqtt_subscribe, mqtt.png
MS5611, components/sensor/ms5611, ms5611.jpg
NTC Thermistor, components/sensor/ntc, ntc.jpg
PMSX003, components/sensor/pmsx003, pmsx003.svg
Pulse Counter, components/sensor/pulse_counter, pulse.svg
Pulse Width, components/sensor/pulse_width, pulse.svg
Resistance, components/sensor/resistance, omega.svg
Rotary Encoder, components/sensor/rotary_encoder, rotary_encoder.jpg
SDS011 Sensor, components/sensor/sds011, sds011.jpg
SHT3X-D, components/sensor/sht3xd, sht3xd.jpg

BIN
svg2png/crosshairs-gps.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

BIN
svg2png/omega.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB