What are the benefits of adding a temperature sensor to the circuit?

Last Update Time: 2019-05-20 13:13:53

Want to add a environment display to your product?

It is well known that either a thermistor or a temperature sensor is added to the circuit.

 

Thermistor

The resistance of the thermistor  varies with temperature. For each type of thermistor, the manufacturer will provide a table of its resistance and temperature. The procedure for calculating the temperature is usually a look-up table method or an interval linear method. Either way, there will be errors and the program will be slightly more complicated.

Using a thermistor to measure temperature is cheap.The disadvantage is that the program may be more complicated.

 

2. Temperature sensor

Take DS18B20 as an example

 image.png

The DS18B20 has three pins, one GND, one VCC, and the other one is the data pin. The temperature data is obtained through a certain timing. The data is output by one pin alone, and the program is more complicated. As the GPIO analog timing, when the MCU has other interrupts, if the timing of reading the data is interrupted, especially when other interrupts take a little more time, the read data will be inaccurate.

The DS18B20 is a digital temperature sensor. The advantage is that the accuracy error is only 0.5 ° C. The disadvantage is that the program is complicated and expensive.

 

Another temperature sensor model introduced to you today is TC1047.


 image.png

One pin of the TC1047 is GND, one pin is VCC (both 3.3V and 5V), and the remaining pin is a voltage output pin. The output voltage is proportional to the temperature, temperature = (voltage -500mV) ÷ 10, temperature range -40 ° C ~ 125 ° C.

See it, it’s that simple. It is only necessary to measure the voltage with the ADC of the microcontroller, and then obtain the temperature by a simple formula (temperature = (voltage - 500mV) ÷ 10).


For example, the measured voltage is 712mV, then the temperature = (712-500) ÷ 10 = 21.2 ° C


The circuit designed with it is very simple, and the board is also very small.

Its accuracy error is ± 2 ° C, compared to the DS18B20, the accuracy is almost the same, but compared with the thermistor, the error is still possible.