Skip to content

PDB STM

WinsonChen114 edited this page Oct 1, 2023 · 12 revisions

Thermistor Calculations

Context Here is a representation of the themistor setup

Problem

The ADC for the temperature sensor takes in voltage from a thermistor. We need to convert this to the temperature. However, different thermistors affect the voltage calculation in different ways relative to the units that are used. For example, during 2022-23's development cycle, the thermistor's temperature coefficient was given in terms of millivolts/degree Celsius. Meanwhile, the 2023-24 thermistor used had its temperature coefficient given in ohms/degree Celsius.

Solution

Volt(s) per degree Celcius

Actually, this might be a temperature sensor, not a thermistor Example: Insert 2022-2023 thermistor here

Since we know the relationship between volts and Celcius, we can just get the temperature directly from the ADC. The general equation for converting ADC value ($val_{ADC}$) given a certain source voltage ($V_{source}$) and the ADC bits ($bits_{ADC}$) is to voltage ($V_{ADC}$): $$V_{ADC} = val_{ADC} * V_{source} * \frac{1}{2^{bits_{ADC}}}$$

So, we need to get the parameters of the ADC. The STM boards should have a 12 bit ADC. The thermistor is also powered by a 3.3V source. This means the math to convert the ADC value to voltage will be: $$V_{ADC} = val_{ADC} * 3.3 * \frac{1}{4096}$$

Once we have this, we can just calculate the difference between the ADC voltage and the voltage at a base temperature ($V_{base}$, given in datasheet). Then, we can use the temperature coefficient ($temp_{coeff}$) to find out the temperature change that caused the change in voltage. In math terms: $$Temp = \frac{V_{ADC} - V_{base}}{temp_{coeff}} + temp_{base}$$

For the 2022-2023 development cycle, the base temperature was 0 degrees celcius, the voltage at that temperature was 0.4V, and the temperature coefficient was 0.0195V/degree Celcius. So, the equation becomes: $$Temp = \frac{V_{ADC} - 0.4}{0.0195} + 0$$

Ohm(s) per degree Celcius

ADC Current Calculations

Context

Problem

Solution

Clone this wiki locally