Skip to content

Commit 9a94d6d

Browse files
committed
0.2.0 SGP30 + add formula comment
1 parent 220d231 commit 9a94d6d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libraries/SGP30/SGP30.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,14 +269,19 @@ float SGP30::getEthanol()
269269
// CALIBRATION
270270
//
271271

272+
// slightly different formula
273+
// https://carnotcycle.wordpress.com/2012/08/04/how-to-convert-relative-humidity-to-absolute-humidity/
274+
// Absolute Humidity (grams/m3) = 6.112 × e^[(17.67 × T)/(T+243.5)] × rh × 2.1674
275+
// (273.15+T)
276+
272277
// T in °C
273278
// RH == RelativeHumidity
274279
float SGP30::setRelHumidity(float T, float RH) // Page 10
275280
{
276281
// page 10 datasheet
277282
// AH = AbsoluteHumidity
278283
// uint16_t AH = 216.7 * RH/100 * 6.117 * exp((17.62 * T)/(243.12 + T)) / (273.15 + T);
279-
float absoluteHumidity = (2.167 * 6.112) * RH ;
284+
float absoluteHumidity = (2.167 * 6.112) * RH;
280285
absoluteHumidity *= exp((17.62 * T)/(243.12 + T));
281286
absoluteHumidity /= (273.15 + T);
282287

0 commit comments

Comments
 (0)