diff --git a/build-doc/images/smart_heater.odg b/build-doc/images/smart_heater.odg index b39da35..49f6c3d 100644 Binary files a/build-doc/images/smart_heater.odg and b/build-doc/images/smart_heater.odg differ diff --git a/build-doc/images/smart_heater.svg b/build-doc/images/smart_heater.svg index 4c9f22b..f8e4d83 100644 --- a/build-doc/images/smart_heater.svg +++ b/build-doc/images/smart_heater.svg @@ -9,18 +9,18 @@ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.2" - width="53.513924mm" - height="158.25598mm" - viewBox="0 0 5351.3924 15825.598" + width="43.079552mm" + height="127.39856mm" + viewBox="0 0 4307.9552 12739.856" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xml:space="preserve" - id="svg462" + id="svg460" sodipodi:docname="smart_heater.svg" inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">image/svg+xml + inkscape:current-layer="svg460" /> @@ -71,7 +71,7 @@ + id="defs75"> - + id="glyph70" /> + id="glyph72" /> + id="defs79"> + id="g77" /> + id="defs111"> + id="path81" /> + id="path84" /> + id="path87" /> + id="path90" /> + id="path93" /> + id="path96" /> + id="path99" /> + id="path102" /> + id="path105" /> + id="path108" /> + id="g116" + transform="translate(-6485,-2235)"> @@ -346,10 +341,10 @@ + id="g458" + transform="matrix(0.59167083,0,0,0.59167083,-3836.9853,-1322.3843)"> + id="g456"> + id="g452"> + id="g133"> + id="rect118" /> + id="path120" /> + id="path122" /> Smart heater + id="tspan124">Smart heater + id="g156"> + id="rect135" /> + id="path137" /> + id="path139" /> Measure humidityMeasure humidityMeasure temperature + id="tspan147">Measure temperature + id="g187"> + id="rect158" /> + id="path160" /> + id="path162" /> RH>95%RH>95%for morefor more than 1 hour + id="tspan178">than 1 hour + id="g204"> + id="rect189" /> + id="path191" /> + id="path193" /> RH>95% + id="tspan195">RH>95% + id="g221"> + height="1032" + id="rect206" /> + id="path208" /> + id="path210" /> Heater ON + id="tspan212">Heater ON + id="g240"> + width="3534" + height="1265" + id="rect223" /> + id="path225" /> + id="path227" /> Wait 10 minutes + id="tspan231">Wait 5 minutes + id="g249"> + id="rect242" /> + id="path244" /> + id="path246" /> + id="g258"> + id="rect251" /> + id="path253" /> + id="path255" /> + id="g267"> + id="rect260" /> + id="path262" /> + id="path264" /> + id="g290"> + id="rect269" /> + id="path271" /> + id="path273" /> Measure humidityMeasure humidityMeasure temperature + id="tspan281">Measure temperature + id="g299"> + id="rect292" /> + id="path294" /> + id="path296" /> + id="g316"> + id="rect301" /> + id="path303" /> + id="path305" /> Heater OFF + id="tspan307">Heater OFF + id="g335"> + id="rect318" /> + id="path320" /> + id="path322" /> Wait 10 minutes + id="tspan326">Wait 15 minutes + id="g344"> + id="rect337" /> + id="path339" /> + id="path341" /> + id="g353"> + id="rect346" /> + id="path348" /> + id="path350" /> + id="g362"> + id="rect355" /> + id="path357" /> + id="path359" /> + id="g371"> + id="rect364" /> + id="path366" /> + id="path368" /> + id="g380"> + id="rect373" /> + id="path375" /> + id="path377" /> + id="g389"> + id="rect382" /> + id="path384" /> + id="path386" /> + id="g402"> + id="rect391" /> No + id="tspan393">No + id="g415"> + id="rect404" /> Yes + id="tspan406">Yes + id="g428"> + id="rect417" /> No + id="tspan419">No + id="g441"> + id="rect430" /> Yes + id="tspan432">Yes + id="g450"> + id="rect443" /> + id="path445" /> + id="path447" /> diff --git a/build-doc/weather_station.html b/build-doc/weather_station.html index 27caa1f..b6b9e35 100644 --- a/build-doc/weather_station.html +++ b/build-doc/weather_station.html @@ -552,22 +552,23 @@ sensor can become saturated with moisture it can get stuck at 100%. This happens in particular with fog or other high humidity and condensing weather types. The sensor has a build in heater to drive of moisture and thus preventing this problem. Because the temperature of the sensor -rises when the heater is turned on, accurate ambient temperature -readings are no longer possible. But with a smart algorithm it is -possible to get the benefits of the build in heater while still being +rises when the heater is turned on, accurate ambient temperature and +humidity readings are no longer possible. But with a smart algorithm it +is possible to get the benefits of the build in heater while still being able to use the sensor as an ambient thermometer.

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.

-

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.

+temperature and humidity are stored and the heater is switched on for 5 +minutes. Than the heater is switched off again. If after 15 minutes the +humidity is still above 95% the heater is turned on again for another 5 +minutes. But not before the temperature and humidity are 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.

+

When the heater algorithm is active, the temperature and humidity +values are 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 temperature and humidity +values.

This algorithm can be enabled by setting the HeaterCoil (see ModBus secion).

@@ -701,9 +702,15 @@ same as for APRS weather reports. But of course we use SI units.

-

NOTE Register 30013 holds the backup temperature reading -from the pressure sensor.

+

NOTE Register 13 holds the backup temperature reading from +the pressure sensor.

++++++ @@ -721,9 +728,9 @@ from the pressure sensor.

- - + + @@ -739,7 +746,7 @@ 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.

+to 0x270E. The default value of a register is 0.

Status bits
1Temp updateevery 2 secTemp/humidity update every 20 minutesevery 2 seconds
2
diff --git a/build-doc/weather_station.md b/build-doc/weather_station.md index 78a3b12..bfdb268 100644 --- a/build-doc/weather_station.md +++ b/build-doc/weather_station.md @@ -236,11 +236,11 @@ The pulse from the rain meter is connected to an interrupt input of the micro-co ## Humidity -Via the I²C bus, the humidity value of the sensor is read. As the sensor can become saturated with moisture it can get stuck at 100%. This happens in particular with fog or other high humidity and condensing weather types. The sensor has a build in heater to drive of moisture and thus preventing this problem. Because the temperature of the sensor rises when the heater is turned on, accurate ambient temperature readings are no longer possible. But with a smart algorithm it is possible to get the benefits of the build in heater while still being able to use the sensor as an ambient thermometer. +Via the I²C bus, the humidity value of the sensor is read. As the sensor can become saturated with moisture it can get stuck at 100%. This happens in particular with fog or other high humidity and condensing weather types. The sensor has a build in heater to drive of moisture and thus preventing this problem. Because the temperature of the sensor rises when the heater is turned on, accurate ambient temperature and humidity readings are no longer possible. But with a smart algorithm it is possible to get the benefits of the build in heater while still being able to use the sensor as an ambient thermometer. -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. +When the humidity rises above 95% for more than an hour the current temperature and humidity are stored and the heater is switched on for 5 minutes. Than the heater is switched off again. If after 15 minutes the humidity is still above 95% the heater is turned on again for another 5 minutes. But not before the temperature and humidity are 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. -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. +When the heater algorithm is active, the temperature and humidity values are 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 temperature and humidity values. This algorithm can be enabled by setting the HeaterCoil (see ModBus secion). @@ -299,19 +299,19 @@ Input registers are numbered 30001 to 39999 but have data addresses 0x000 to 0x2 | 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. +^NOTE^ Register 13 holds the backup temperature reading from the pressure sensor. -| 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 | +| Status bits | Description | logic 0 | logic 1 | +|-------------|----------------------|------------------|-----------------| +| 0 | Heater status | heater off | heater on | +| 1 | Temp/humidity update | every 20 minutes | every 2 seconds | +| 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. +Input registers are numbered 1 to 9999 but have data addresses 0x000 to 0x270E. The default value of a register is 0. | Address | Description | logic 0 | logic 1 | |---------|------------------|----------|---------| diff --git a/build-doc/weather_station.pdf b/build-doc/weather_station.pdf index 75769b4..f0da343 100644 Binary files a/build-doc/weather_station.pdf and b/build-doc/weather_station.pdf differ diff --git a/test_software/__pycache__/epever_control.cpython-36.pyc b/test_software/__pycache__/epever_control.cpython-36.pyc index a38d4ad..a4a1d1e 100644 Binary files a/test_software/__pycache__/epever_control.cpython-36.pyc and b/test_software/__pycache__/epever_control.cpython-36.pyc differ diff --git a/test_software/epever_control.py b/test_software/epever_control.py index 4c42a90..8dfc102 100644 --- a/test_software/epever_control.py +++ b/test_software/epever_control.py @@ -43,10 +43,10 @@ class EpeverChargeController(minimalmodbus.Instrument): @retry(wait_fixed=200, stop_max_attempt_number=5) def retriable_read_register( - self, registeraddress, number_of_decimals, functioncode + self, registeraddress, number_of_decimals, functioncode, signed=False ): return self.read_register( - registeraddress, number_of_decimals, functioncode, False + registeraddress, number_of_decimals, functioncode, signed ) @retry(wait_fixed=200, stop_max_attempt_number=5) @@ -76,7 +76,7 @@ class EpeverChargeController(minimalmodbus.Instrument): def get_temperature(self): """Rated Battery's voltage""" - return self.retriable_read_register(4, 2, 4) + return self.retriable_read_register(4, 2, 4, True) def get_rain(self): """Rated charging current to battery""" @@ -100,7 +100,7 @@ class EpeverChargeController(minimalmodbus.Instrument): def get_temperature_backup(self): """Charging mode: 0x0001 = PWM""" - return self.retriable_read_register(13, 2, 4) + return self.retriable_read_register(13, 2, 4,True) def get_status_bits(self): """Charging mode: 0x0001 = PWM"""