Added heather algorithm

This commit is contained in:
marcel
2024-01-17 16:07:02 +01:00
parent 439a6b6a1f
commit e99422412e
11 changed files with 1587 additions and 88 deletions

View File

@@ -564,7 +564,17 @@ But not before the temperature is measured and stored, as the sensor is
now cooled off to ambient temperature. If the humidity is below 95% the
sensor is free from moisture and the process is not repeated for another
hour.</p>
<p>Flow chart under development.</p>
<p>When the heater algorithm is active, the temperature is updated every
20 minutes instead of every 2 seconds. Statis bit 0 (ModBus register
30014) indicated if the heater is on or off and status bit 1 gives the
update rate of the main temperature sensor.</p>
<p>This algorithm can be enabled by setting the HeaterCoil (see ModBus
secion).</p>
<figure>
<img src="./images/smart_heater.svg" title="Heater algorithm"
alt="Heater algorithm" />
<figcaption aria-hidden="true">Heater algorithm</figcaption>
</figure>
<h2 id="temperature-1">Temperature</h2>
<p>The temperature is read from the humidity sensor as this sensor gives
the most accurate temperature readings. When the heater is on (see
@@ -582,8 +592,8 @@ boring.</p>
now, the ModBus address is hard coded as 14 in the software. The values
are available in the input registers and can be read via function code
04.</p>
<p>Below an example of how to read the wind direction in Python using
the minimalmodbus library.</p>
<p>Below an example of how to read the wind direction and enable the
heater algorithm in Python using the minimalmodbus library.</p>
<pre><code>#!/usr/bin/env python3
import minimalmodbus
@@ -592,10 +602,14 @@ instrument = minimalmodbus.Instrument(&#39;/dev/ttyUSB1&#39;, 14)
# register number, number of decimals, function code
wind_direction = instrument.read_register(1, 0, 4)
print(wind_direction)</code></pre>
<h3 id="input-registers">Input registers</h3>
<p>The measurements and order of the measurements are the same as for
APRS weather reports. But of course we use SI units.</p>
print(wind_direction)
# register address, value, function code
instrument.write_bit(0, 1, 5)</code></pre>
<h3 id="input-registers-read-only">Input registers (read only)</h3>
<p>Input registers are numbered 30001 to 39999 but have data addresses
0x000 to 0x270E. The measurements and order of the measurements are the
same as for APRS weather reports. But of course we use SI units.</p>
<table>
<colgroup>
<col style="width: 13%" />
@@ -611,77 +625,77 @@ APRS weather reports. But of course we use SI units.</p>
</thead>
<tbody>
<tr class="odd">
<td>30000</td>
<td>00</td>
<td>Device ID (0x5758)</td>
<td>NO UNIT</td>
</tr>
<tr class="even">
<td>30001</td>
<td>01</td>
<td>Wind direction</td>
<td>degrees</td>
<td>degrees * 10</td>
</tr>
<tr class="odd">
<td>30002</td>
<td>02</td>
<td>Wind speed (average of 10 minutes)</td>
<td>m/s * 100</td>
</tr>
<tr class="even">
<td>30003</td>
<td>03</td>
<td>Wind gust (peak of last 10 minutes)</td>
<td>m/s * 100</td>
</tr>
<tr class="odd">
<td>30004</td>
<td>04</td>
<td>Temperature (twos complement)</td>
<td>degrees Celcius * 100</td>
</tr>
<tr class="even">
<td>30005</td>
<td>05</td>
<td>Rain last hour</td>
<td>l/m2 * 100</td>
</tr>
<tr class="odd">
<td>30006</td>
<td>06</td>
<td>Rain last 24 hours</td>
<td>l/m2 * 100</td>
</tr>
<tr class="even">
<td>30007</td>
<td>07</td>
<td>Rain since midnight</td>
<td>NOT IMPLEMENTED</td>
</tr>
<tr class="odd">
<td>30008</td>
<td>08</td>
<td>Humidity</td>
<td>percent * 100</td>
</tr>
<tr class="even">
<td>30009</td>
<td>09</td>
<td>Barometric pressure</td>
<td>hPa * 10</td>
</tr>
<tr class="odd">
<td>30010</td>
<td>10</td>
<td>Luminosity</td>
<td>W/m2</td>
</tr>
<tr class="even">
<td>30011</td>
<td>11</td>
<td>Snow fall</td>
<td>NOT IMPLEMENTED</td>
</tr>
<tr class="odd">
<td>30012</td>
<td>12</td>
<td>Raw rain counter</td>
<td>NOT IMPLEMENTED</td>
<td>l/m2 * 100</td>
</tr>
<tr class="even">
<td>30013</td>
<td>13</td>
<td>Temperature (twos complement)</td>
<td>degrees Celcius * 100</td>
</tr>
<tr class="odd">
<td>30014</td>
<td>14</td>
<td>Status bits</td>
<td>see table below</td>
</tr>
@@ -705,12 +719,45 @@ from the pressure sensor.</p>
<td>heater off</td>
<td>heater on</td>
</tr>
<tr class="even">
<td>1</td>
<td>Temp update</td>
<td>every 2 sec</td>
<td>every 20 minutes</td>
</tr>
<tr class="odd">
<td>2</td>
<td>Heater algorithm</td>
<td>disabled</td>
<td>enabled</td>
</tr>
</tbody>
</table>
<p>The ModBus registers are 16 bit wide. For better precision, some
units are scaled by a factor of 10 or 100. This way, values with up to
two decimal points can be stored as 16 bit integer values. Just divide
by 10 or 100 to get the floating point values.</p>
<h3 id="output-coils-write-only">Output coils (write only)</h3>
<p>Input registers are numbered 1 to 9999 but have data addresses 0x000
to 0x270E. The default value is of a register is 0.</p>
<table>
<thead>
<tr class="header">
<th>Address</th>
<th>Description</th>
<th>logic 0</th>
<th>logic 1</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>0</td>
<td>Heater algorithm</td>
<td>disabled</td>
<td>enabled</td>
</tr>
</tbody>
</table>
<h1 id="schematic">Schematic</h1>
<p><a href="./images/weather_station_schematic.pdf"><img
src="./images/weather_station_schematic.svg" alt="Schematic" /></a></p>