summaryrefslogtreecommitdiffstats
path: root/src/tempmodule/main.ino
diff options
context:
space:
mode:
Diffstat (limited to 'src/tempmodule/main.ino')
-rw-r--r--src/tempmodule/main.ino9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tempmodule/main.ino b/src/tempmodule/main.ino
index 9288deb..d0db8ea 100644
--- a/src/tempmodule/main.ino
+++ b/src/tempmodule/main.ino
@@ -194,18 +194,21 @@ static void discover_client(void)
* Rt: Thermistor resistance
* Ra: Voltage divider resistor
* Vt: Tap voltage
- * Vcc: Input Voltage (3.3V)
+ * Vcc: Input Voltage (3.31V)
*
* Rt = Ra * Vcc / Vt - Ra
*
* Using 64-bit arithmetic as 32-bit would overflow.
- * On WeMOS D1 Mini the A0 reads 3.3V as 1023, that is our Vcc.
+ * On WeMOS D1 Mini the A0 reads 3.2V as 1023; our Vcc is 3.31V
+ * The correct value of the reference volume obtained by measuring
+ * resistances with a multimeter, taking the ADC reading and applying
+ * Ohm's law.
* We shift the range by one to avoid division by zero.
*/
static int get_resistance(int64_t vt, int64_t ra)
{
++vt;
- return ra * 1024 / vt - ra;
+ return ra * 1080 / vt - ra;
}
static int get_temperature(int res)