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

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -9,9 +9,9 @@
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
width="125.34mm"
height="165.31999mm"
viewBox="0 0 12534 16531.999"
width="60.926762mm"
height="80.360718mm"
viewBox="0 0 6092.6763 8036.0717"
preserveAspectRatio="xMidYMid"
fill-rule="evenodd"
stroke-width="28.222"
@@ -45,7 +45,8 @@
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg439" />
inkscape:current-layer="svg439"
inkscape:document-rotation="0" />
<defs
class="ClipPathGroup"
id="defs8">
@@ -347,7 +348,7 @@
</defs>
<g
id="g124"
transform="translate(-3234,-4235)">
transform="translate(-3234,-4234.9999)">
<g
id="id2"
class="Master_Slide">
@@ -362,7 +363,7 @@
<g
class="SlideGroup"
id="g437"
transform="translate(-3234,-4235)">
transform="matrix(0.48609191,0,0,0.48609191,-1572.0212,-2058.5992)">
<g
id="g435">
<g

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

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>

View File

@@ -240,7 +240,11 @@ Via the I²C bus, the humidity value of the sensor is read. As the sensor can be
When the humidity rises above 95% for more than an hour the current temperature is stored and the heater is switched on for 10 minutes. Than the heater is switched off again. If after 10 minutes the humidity is still above 95% the heater is turned on again for another 10 minutes. 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.
Flow chart under development.
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.
This algorithm can be enabled by setting the HeaterCoil (see ModBus secion).
![Heater algorithm](./images/smart_heater.svg "Heater algorithm")
## Temperature
@@ -258,7 +262,7 @@ This sensor is still under development.
The weather station uses ModBus RTU over a simplex RS-485 line. For 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.
Below an example of how to read the wind direction in Python using the minimalmodbus library.
Below an example of how to read the wind direction and enable the heater algorithm in Python using the minimalmodbus library.
#!/usr/bin/env python3
import minimalmodbus
@@ -270,36 +274,49 @@ Below an example of how to read the wind direction in Python using the minimalmo
wind_direction = instrument.read_register(1, 0, 4)
print(wind_direction)
### Input registers
# register address, value, function code
instrument.write_bit(0, 1, 5)
The measurements and order of the measurements are the same as for APRS weather reports. But of course we use SI units.
### Input registers (read only)
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.
| Address | Description | Units |
|---------|-------------------------------------|-----------------------|
| 30000 | Device ID (0x5758) | NO UNIT |
| 30001 | Wind direction | degrees |
| 30002 | Wind speed (average of 10 minutes) | m/s * 100 |
| 30003 | Wind gust (peak of last 10 minutes) | m/s * 100 |
| 30004 | Temperature (two's complement) | degrees Celcius * 100 |
| 30005 | Rain last hour | l/m2 * 100 |
| 30006 | Rain last 24 hours | l/m2 * 100 |
| 30007 | Rain since midnight | NOT IMPLEMENTED |
| 30008 | Humidity | percent * 100 |
| 30009 | Barometric pressure | hPa * 10 |
| 30010 | Luminosity | W/m2 |
| 30011 | Snow fall | NOT IMPLEMENTED |
| 30012 | Raw rain counter | NOT IMPLEMENTED |
| 30013 | Temperature (two's complement) | degrees Celcius * 100 |
| 30014 | Status bits | see table below |
| 00 | Device ID (0x5758) | NO UNIT |
| 01 | Wind direction | degrees * 10 |
| 02 | Wind speed (average of 10 minutes) | m/s * 100 |
| 03 | Wind gust (peak of last 10 minutes) | m/s * 100 |
| 04 | Temperature (two's complement) | degrees Celcius * 100 |
| 05 | Rain last hour | l/m2 * 100 |
| 06 | Rain last 24 hours | l/m2 * 100 |
| 07 | Rain since midnight | NOT IMPLEMENTED |
| 08 | Humidity | percent * 100 |
| 09 | Barometric pressure | hPa * 10 |
| 10 | Luminosity | W/m2 |
| 11 | Snow fall | NOT IMPLEMENTED |
| 12 | Raw rain counter | l/m2 * 100 |
| 13 | Temperature (two's complement) | degrees Celcius * 100 |
| 14 | Status bits | see table below |
^NOTE^ Register 30013 holds the backup temperature reading from the pressure sensor.
| Status bits | Description | logic 0 | logic 1 |
|-------------|---------------|------------|-----------|
| 0 | Heater status | heater off | heater on |
| Status bits | Description | logic 0 | logic 1 |
|-------------|------------------|-------------|------------------|
| 0 | Heater status | heater off | heater on |
| 1 | Temp update | every 2 sec | every 20 minutes |
| 2 | Heater algorithm | disabled | enabled |
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.
### Output coils (write only)
Input registers are numbered 1 to 9999 but have data addresses 0x000 to 0x270E. The default value is of a register is 0.
| Address | Description | logic 0 | logic 1 |
|---------|------------------|----------|---------|
| 0 | Heater algorithm | disabled | enabled |
# Schematic
[![Schematic](./images/weather_station_schematic.svg)](./images/weather_station_schematic.pdf)

Binary file not shown.