You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tweaked the .c file to calculate the dewpoint. It's an approximation formula since we only have temp and RH, but it appeared to be a decent formula that works across the RH spread.
I tweaked the .c file to calculate the dewpoint. It's an approximation formula since we only have temp and RH, but it appeared to be a decent formula that works across the RH spread.
=== ===
--- SHT30.c.FCS 2023-08-29 19:57:07.350407411 -0500
+++ SHT30.c.new 2023-08-29 20:27:17.487321465 -0500
@@ -4,11 +4,18 @@
// This code is designed to work with the SHT30_I2CS I2C Mini Module available from ControlEverything.com.
// https://www.controleverything.com/content/Humidity?sku=SHT30_I2CS#tabs-0-product_tabset-2
+// Dewpoint formula found here:
+// https://bmcnoldy.earth.miami.edu/Humidity.html
+
+// log() requires math library (libm), so compile as:
+// gcc SHT30.c -lm -o SHT30
+
#include <stdio.h>
#include <stdlib.h>
#include <linux/i2c-dev.h>
#include <sys/ioctl.h>
#include <fcntl.h>
+#include <math.h>
void main()
{
@@ -36,7 +43,7 @@
char data[6] = {0};
if(read(file, data, 6) != 6)
{
@@ -45,10 +52,14 @@
float cTemp = -45 + (175 * temp / 65535.0);
float fTemp = -49 + (315 * temp / 65535.0);
float humidity = 100 * (data[3] * 256 + data[4]) / 65535.0;
}
=== ===
(holy cow did github mangle that)
The text was updated successfully, but these errors were encountered: