@ -85,3 +85,13 @@ All notable changes to this project will be documented in this file.
There is a bug in the Si7021 chip: when the sensor is exposed to extreme environmental conditions for a longer period (very high or very low humidity), the humidity register will wrap around and give wrong values. (https://community.silabs.com/s/question/0D51M00007xeOo9SAE/si7021-relative-humidity-reading-underflowing-?language=en_US).
Workaround: let's assume the humidity will never go below 15%. In the Netherlands a humidity below 20% is rare, but can occur and the minimum value ever measured in De Bilt was 6% (on 1 april 1965). At several other sites in the Netherlands the humidity went as low as 10%. But as this was a one time event and the measurements are doubtful, this event was not registered in the original database. (https://nl.wikipedia.org/wiki/Relatieve_luchtvochtigheid)
In rare cases, the humidity value could creep up above 15% (when the actual humidity is 100%) and still give wrong values.
## [0.3.0] - 2024-05-02
### Added
Support for HYT-221 humidity sensor
### Removed
Support for si7021 humidity sensor (this sensor was not suited for outdoor measurments)
# Todo list for weather station with ModBus over RS-485
## Reset firmware via ModBus coil bit
Soemtimes the weater station needs to be reset. For example if the I2C communication with the sensors is lost. The pressure sensor tends to have this probem occacionally.
## Implement support for new humidity sensor
Heater function of former sensor needs to be disabled as the new sensor does not have (or need) a heater.
</p><p>This work is licensed under a <arel="license"href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
The Si7021 humidity sensor is not made for outdoor use. The datasheet is clear about that. But a lot of people use this cheap sensor for weather stations anyway. So I choose this sensor for my design. But that was not smart. After an initial time without any problems, the sensor started to saturate. This happened during a very wet and mild winter we had. My first solution was to utilize the build in heater to drive of the moisture. That worked, but only for a short period. The heater blew up and the sensor started to report humidity levels above 100% and because of a bug in the firmware of the sensor, the humidity register wrapped around and the sensor reported humidity levels of 0-30%. I tried to find a software solution, which worked for a while, but the sensor deteriorated even more. To the point of being totally useless. So I searched for another, better sensor. And I found the HYT-221 from Innovative Sensor Technology. This sensor is designed to work outdoors and can even be used in saunas, where the humidity levels are always high and the air is condensating. The datasheet specifically mentions outdoor weather stations as an application. The only downside is its price: it is ten times more expensive than the Si7021.
The sensor can be controlled via the I2C bus, so implementing the new sensor in the firmware was very easy. From version 0.3.0 onward, this sensor is used. The Si7021 is removed from the code.
Wire.beginTransmission(HYT_ADDR);// Begin transmission with given device on I2C bus
Wire.requestFrom(HYT_ADDR,4);// Request 4 bytes
// Read the bytes if they are available
// The first two bytes are humidity the last two are temperature
if(Wire.available()==4){
intb1=Wire.read();
intb2=Wire.read();
intb3=Wire.read();
intb4=Wire.read();
Wire.endTransmission();// End transmission and release I2C bus
// combine humidity bytes and calculate humidity
intrawHumidity=b1<<8|b2;
// compound bitwise to get 14 bit measurement first two bits
// are status/stall bit (see intro text)
rawHumidity=(rawHumidity&=0x3FFF);
humidity=100.0/pow(2,14)*rawHumidity;
// Scale for more decimal positions when converted to integer value for ModBus
MeasuredData.Humidity=100*humidity;
}
// Read Si7021 sensor and process data
voidReadSi7021(void)
{
charresult=0x2;
floathumidity;
si7021.triggerMeasurement();
si7021.getHumidity(humidity);
// There is a bug in the Si7021 chip: when the sensor is exposed to extreme environmental conditions for a longer period (very high or very low humidity),
// the humidity register will wrap around and give wrong values. (https://community.silabs.com/s/question/0D51M00007xeOo9SAE/si7021-relative-humidity-reading-underflowing-?language=en_US).
// Workaround: let's assume the humidity will never go below 15%. In the Netherlands a humidity of below 20% is rare, but can occur and the minimum value ever measured
// in De Bilt was 6% (on 1 april 1965). At several other sites in the Netherlands the humidity went as low as 10%. But as this was a one time event and the
// measurements are doubtful, this event was nor registered in the original database. (https://nl.wikipedia.org/wiki/Relatieve_luchtvochtigheid)
// In rare cases, the humidity value could creep up above 15% (when the actual humidity is 100%) and still give wrong values.
if(humidity>100||humidity<15)
humidity=100;
//If humidity is larger than HUMIDITY_THRESHOLD switch on heater to get more acurate measurement and prevent memory offset
result=HeaterSi7021(humidity);
MeasuredData.StatusBits&=0xFFFC;// Reset heater status bits to zero
MeasuredData.StatusBits|=result;// And set the proper bits to one if there are any. The result is we copied the status bits to the register
// Temperture and humidity readings are valid (as the sensor is not heated)
if(result&0x2){
si7021.getTemperature(MeasuredData.Temperature);
// Scale for more decimal positions when converted to integer value for ModBus