From e154dbe681d247c0676ac8698d2ef7b14a65866d Mon Sep 17 00:00:00 2001 From: atse Date: Thu, 10 Aug 2023 13:26:14 +0800 Subject: [PATCH] Reverse polarity of current through the TEC Matches the i_set polarity with the front panel of the Thermostat. --- README.md | 2 +- src/channels.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 88ed2ec..8cc022b 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ postfilter rate can be tuned with the `postfilter` command. - Connect TEC module device 1 to TEC1- and TEC1+. - The GND pin is for shielding not for sinking TEC module currents. -When using a TEC module with the Thermostat, the Thermostat expects the thermal load (where the thermistor is located) to heat up with a positive software current set point, and cool down with a negative current set point. +When using a TEC module with the Thermostat, the Thermostat expects the thermal load (where the thermistor is located) to cool down with a positive software current set point, and heat up with a negative current set point. Testing heat flow direction with a low set current is recommended before installation of the TEC module. diff --git a/src/channels.rs b/src/channels.rs index 3b70a6f..b060d04 100644 --- a/src/channels.rs +++ b/src/channels.rs @@ -118,7 +118,7 @@ impl Channels { let center_point = self.get_center(channel); let r_sense = ElectricalResistance::new::(R_SENSE); let voltage = self.get_dac(channel); - let i_tec = (voltage - center_point) / (10.0 * r_sense); + let i_tec = (center_point - voltage) / (10.0 * r_sense); i_tec } @@ -142,9 +142,9 @@ impl Channels { }; let center_point = vref_meas; let r_sense = ElectricalResistance::new::(R_SENSE); - let voltage = i_tec * 10.0 * r_sense + center_point; + let voltage = -i_tec * 10.0 * r_sense + center_point; let voltage = self.set_dac(channel, voltage); - let i_tec = (voltage - center_point) / (10.0 * r_sense); + let i_tec = (center_point - voltage) / (10.0 * r_sense); i_tec } -- 2.47.0