Skip to content

Commit

Permalink
0.2.0 SGP30 + add formula comment
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart committed Feb 27, 2023
1 parent 220d231 commit 9a94d6d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libraries/SGP30/SGP30.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,19 @@ 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
{
// 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);

Expand Down

0 comments on commit 9a94d6d

Please sign in to comment.