Skip to content

Commit

Permalink
Merge pull request #36 from vladak/celsius
Browse files Browse the repository at this point in the history
fix Celsius spelling
  • Loading branch information
dhalbert committed Jun 21, 2022
2 parents 06e752c + 5352a4e commit b62a473
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions adafruit_sgp30.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,16 @@ def set_iaq_humidity(self, gramsPM3): # pylint: disable=invalid-name
buffer += arr
self._run_profile(["iaq_set_humidity", [0x20, 0x61] + buffer, 0, 0.01])

def set_iaq_relative_humidity(self, celcius, relative_humidity):
def set_iaq_relative_humidity(self, celsius, relative_humidity):
"""
Set the humidity in g/m3 for eCo2 and TVOC compensation algorithm.
The absolute humidity is calculated from the temperature and relative
humidity (as a percentage).
The absolute humidity is calculated from the temperature (Celsius)
and relative humidity (as a percentage).
"""
numerator = ((relative_humidity / 100) * 6.112) * exp(
(17.62 * celcius) / (243.12 + celcius)
(17.62 * celsius) / (243.12 + celsius)
)
denominator = 273.15 + celcius
denominator = 273.15 + celsius

humidity_grams_pm3 = 216.7 * (numerator / denominator)
self.set_iaq_humidity(humidity_grams_pm3)
Expand Down

0 comments on commit b62a473

Please sign in to comment.