## Ambient temperature

11 noviembre 2012

One of the simplest examples that can be performed with openDAQ is measuring ambient temperature. We only need a temperature sensor, such as an NTC resistor. This sensor will give us a change in its resistance according to temperature changes, decreasing resistance when temperature raises.

The electrical assembly is needed is very simple: a resistive divider used for stabilizing the output voltage. Our 100kΩ NTC is used at 25°C and the sensitivity index (B) value is 4190K. We only need to use an analog input, the power supply out (+5V) and the circuit ground. The device will measure the output voltage and mathematically convert it to temperature.

The two resistors (R1 and the NTC) are connected in series, and the middle point is connected to input A8 of openDAQ. The other terminal of the NTC is connected to +5V and the other terminal of R1 is connected to AGND.

Since the output voltage response will form a 'S' shape curve, because of the NTC nature, we calculated a R1 value which allows us to obtain the best linearity. The midrange output voltage, with the inflection point of the response curve, was centered around 25ºC. Now, we need to configure our openDAQ to make this measurement. To view the results and convert temperature, we share a sample program in Python, which you can modify to suit your NTC values​​, R1 and even other experiments.

When you run the file 'interface.py', the software will start using openDAQ to measure the temperature. The operation is very simple: our openDAQ reads the analog input voltage response, and  the software performs various calculations to convert this value, first into resistance, and then into temperature.

The formulas we use can be found in any electronic instrumentation book, but basically there are two expressions to bring the temperature value:

V_O (t) = V_i R_1 / (R_1 + R_NTC)        Output Voltage

R_o R_NTC = e ^ B (1/T-1/T_o)            Behavior of a perfect thermistor

We chose the voltage range ±4V, since the average voltage output will be around 2V.

Then, we have only to select the cycle time, click Play and the chart will begin to be painted.