[Dallas] Document + update TTN decoder

This commit is contained in:
TD-er
2020-11-16 16:59:35 +01:00
parent c80de39b76
commit 648e9c2338
6 changed files with 110 additions and 21 deletions
+95 -16
View File
@@ -1,4 +1,3 @@
.. include:: ../Plugin/_plugin_substitutions_p00x.repl
.. _P004_DS18b20_page:
.. |br| raw:: html
@@ -6,11 +5,8 @@
<br clear="all">
DS18b20
=======
|P004_typename|
|P004_status|
DS18b20 temperature sensor
==========================
.. image:: P004_DS18b20_1.jpg
:width: 2055px
@@ -26,7 +22,7 @@ Introduction
.. note:: Beware of cheap remakes from the Chinese market. They might have wider tolerance and/or different pinouts.
The DS18B20 manufactured by Dallas and Maxim is a very simple to use temperature sensor with a tolerance of ±0.5°C.
The DS18B20 manufactured by Dallas and Maxim is a very simple to use temperature sensor with a tolerance of ±0.5°C.
Its advantages: Very simple to use due to "1-wire" data protocol. Chainable, it is possible to chain up to 100
sensors on one cable (remember ESP Easy has 12 tasks max...). No calibration necessary if the tolerance fits your
@@ -76,8 +72,8 @@ Setup
-----
.. image:: P004_Setup_DS18b20_1.png
:width: 1200px
:height: 1617px
:width: 1145px
:height: 735px
:scale: 60 %
:alt: Task Settings
:align: left
@@ -94,15 +90,96 @@ Task settings
Sensor
^^^^^^
* **GPIO <--> 1-wire**: Pulse input is generally set to **GPIO 14 (D5)**.
GPIO <--> 1-wire
""""""""""""""""
after pressing submit the following settings are revealed:
Pin used for communicating with the Dallas sensor(s).
Please note the pin must be pulled up by a resistor, so only use pins that can be in a pulled up state during boot (thus NOT use GPIO 15 on ESP8266).
Number Output Values
""""""""""""""""""""
(Added 2020-11-16)
Selector to set number of Dallas sensors for this task.
Number of address selectors is based on the set Number Output Values.
If more then one sensor is set to a task, all sensors will be sent a start measurement command in the order they are selected.
After the expected reading period (depending on the set resolution) the sensors will be read in the same order.
This means their measurement period overlap, which can be of great use to make sure the temperature values are taken at the same moment.
Not all controllers can handle reading multiple sensors in a single run.
For example you cannot send directly to Domoticz controllers running multiple sensors in the same task.
If it is still needed to have multiple sensors in the same task, one can still send the data via rules to Domoticz.
.. note:: Interleaved reading of multiple sensors on a task can only be done if the sensors are powered via their Vdd pin.
Parasite powered sensors are not supported in this mode.
Device address
""""""""""""""
Selector for a specific **sensor address**.
If a found sensor is already assigned (and saved) to a task, the task name and variable name is shown in the combo box. (Added 2020-11-16)
.. image:: P004_Setup_DS18b20_2.png
:scale: 60 %
:alt: Dallas sensor selection
:align: left
|br|
.. note:: It may be hard to keep these addresses apart.
Either add them one by one, or heat up a single one by holding it in your hand.
When the web page for a Dallas temperature task is loaded the bus is scanned thus newly attached sensors will then show up in the list.
Device resolution
"""""""""""""""""
Possible values: 9..12 bits
The resolution determines the time needed for taking a measurement.
At 12 bit resolution a measurement takes roughly 800 msec.
As temperatures do not change very fast usually a high accuracy can be chosen without problem.
N.B. resolution applies to all sensors for this task.
Error State Value
"""""""""""""""""
Select the value to send if the sensor could not be read.
Almost all controllers will not send values if the value is ``NaN``.
By chosing a specific value one can make sure values are sent.
Statistics
^^^^^^^^^^
Dallas 1-wire sensors may sometimes return a read error.
A typical setup running Dallas sensors on ESPEasy should have less than 1-in-1000 reads fail.
A failed read attempt will be replaced by the set value of the **Error State Value**.
The number of read errors may depend on a number of factors, like cabling or using non genuine sensors.
Some known counterfeit sensors are known to cause problems when used with > 3 on the same bus.
Others always report being "Parasite Powered" while they are not.
The Statistics can help determining why a setup of sensors may not perform as well as it should.
.. image:: P004_Setup_DS18b20_3.png
:scale: 60 %
:alt: Dallas sensor selection
:align: left
|br|
* **Device address**: Pick your **sensor address**, hold your hand around it to see which one is changing temperature.
Every DS18b20 has a unique address burned in at production time.
This UID (Unique IDentifier) is used to tell the sensors apart on one single cable.
* **Device resolution**: 9..12 bits, the **lower the resolution the accuracy decreases and the speed increases**.
As temperatures do not change very fast usually a high accuracy can be chosen without problem.
.. note:: If you need a star infrastructure or stubs or if you need just longer cabling there is a way out.
One line runs on one GPIO. But nobody said you can't use two GPIO's. If the cabling gets too long or
@@ -115,6 +192,8 @@ after pressing submit the following settings are revealed:
(or too thin for the given distance). Keep cabling away from other cables to avoid interferences. If necessary place a
10µF capacitor on the sensors between 3.3v and GND.
Data Acquisition
^^^^^^^^^^^^^^^^
Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

+5
View File
@@ -31,7 +31,12 @@ function Converter(decoded, port) {
case 4:
converted.name = "Dallas";
// For compatibility reasons, also include temp.
converted.temp = converted.val_1;
converted.temp1 = converted.val_1;
converted.temp2 = converted.val_2;
converted.temp3 = converted.val_3;
converted.temp4 = converted.val_4;
break;
case 5:
+10 -5
View File
@@ -118,6 +118,7 @@ void sensorTypeHelper_webformLoad(struct EventStruct *event, byte pconfigIndex,
choice = event->sensorType;
PCONFIG(pconfigIndex) = static_cast<byte>(choice);
}
String outputTypeLabel = F("Output Data Type");
if (Device[DeviceIndex].OutputDataType == Output_Data_type_t::Simple) {
switch(event->sensorType) {
case Sensor_VType::SENSOR_TYPE_SINGLE:
@@ -133,9 +134,9 @@ void sensorTypeHelper_webformLoad(struct EventStruct *event, byte pconfigIndex,
break;
}
}
outputTypeLabel = F("Number Output Values");
}
addRowLabel(F("Output Data Type"));
addRowLabel(outputTypeLabel);
addSelector_Head(PCONFIG_LABEL(pconfigIndex));
for (byte x = 0; x < optionCount; x++)
@@ -149,9 +150,13 @@ void sensorTypeHelper_webformLoad(struct EventStruct *event, byte pconfigIndex,
"");
}
addSelector_Foot();
addFormNote(F("Changing 'Output Data Type' may affect behavior of some controllers (e.g. Domoticz)"));
// addFormSelector(F("Output Data Type"), PCONFIG_LABEL(pconfigIndex), 11, options, optionValues, choice);
{
String note;
note = F("Changing '");
note += outputTypeLabel;
note += F("' may affect behavior of some controllers (e.g. Domoticz)");
addFormNote(note);
}
}
void sensorTypeHelper_saveOutputSelector(struct EventStruct *event, byte pconfigIndex, byte valueIndex, const String& defaultValueName)