Skip to content

Instantly share code, notes, and snippets.

@mcavalcantib
Last active May 5, 2025 00:01
Show Gist options
  • Select an option

  • Save mcavalcantib/a58c1e18824f7f1bcf02526bb202b6cc to your computer and use it in GitHub Desktop.

Select an option

Save mcavalcantib/a58c1e18824f7f1bcf02526bb202b6cc to your computer and use it in GitHub Desktop.
Absolute humidity calculation
#include "math.h"
#define e 2.718281828459045235360287471352
float calculateAbsoluteHumidity(float hum, float temp)
{
float UA = ((6.112 * (pow(e, ((17.67 * temp) / (temp + 243.5)))) * hum * 2.1674) / (273.15 + temp));
return UA;
}
@mcavalcantib
Copy link
Author

Absolute humidity calculation formula to use in arduino or esp32 projects.
E.g.: Read the temperature and relative humidity from DHT11/DHT22 sensor and pass to this function, so you have the relative and absolute humidity and the temperature, wich are the paraments to know how well your dryer is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment