From 9a94d6da1bf16cf3826e390d63aa2469b4474449 Mon Sep 17 00:00:00 2001 From: rob tillaart Date: Mon, 27 Feb 2023 11:48:52 +0100 Subject: [PATCH] 0.2.0 SGP30 + add formula comment --- libraries/SGP30/SGP30.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/SGP30/SGP30.cpp b/libraries/SGP30/SGP30.cpp index 96679d2bb..d0a718b40 100644 --- a/libraries/SGP30/SGP30.cpp +++ b/libraries/SGP30/SGP30.cpp @@ -269,6 +269,11 @@ float SGP30::getEthanol() // CALIBRATION // +// slightly different formula +// https://carnotcycle.wordpress.com/2012/08/04/how-to-convert-relative-humidity-to-absolute-humidity/ +// Absolute Humidity (grams/m3) = 6.112 × e^[(17.67 × T)/(T+243.5)] × rh × 2.1674 +// (273.15+T) + // T in °C // RH == RelativeHumidity float SGP30::setRelHumidity(float T, float RH) // Page 10 @@ -276,7 +281,7 @@ float SGP30::setRelHumidity(float T, float RH) // Page 10 // page 10 datasheet // AH = AbsoluteHumidity // uint16_t AH = 216.7 * RH/100 * 6.117 * exp((17.62 * T)/(243.12 + T)) / (273.15 + T); - float absoluteHumidity = (2.167 * 6.112) * RH ; + float absoluteHumidity = (2.167 * 6.112) * RH; absoluteHumidity *= exp((17.62 * T)/(243.12 + T)); absoluteHumidity /= (273.15 + T);