Home / Home made Projects / Microcontroller Projects / RTD PT100 temperature sensor using Microcontroller

# RTD PT100 temperature sensor using Microcontroller

In industry, sensing and controlling temperature is a very commonly used. There are a number of ways in which temperature can be sensed. Conditions may be extreme like high temperature & high pressure, therefore sensor must be reliable, stable and able to provide correct reading.  RTD thermocouples and sensors are widely used in industry for temperature measurement and control. Since the world is moving towards automation in which role of microcontrollers is cannot be eliminated. So in this article we will learn how to make RTD PT100 temperature sensor using microcontroller.  We will cover RTD PT100 temperature transmitter circuit, program for microcontroller, Proteus simulation and results.

## RTD PT100 temperature transmitter circuit

PT-100 is a thermocouple which means it changes its resistance with temperature. However microcontroller cannot measure resistance directly. Its analogue pins can only measure voltage. For this reason PT-100 cannot directly be interfaced with microcontroller. It will require some external circuitry to convert resistance into voltage to interface RTD PT100 with microcontroller.

RTD transmitter circuit (external circuitry) must be able to sense variation in PT100 resistance due to change in 1 ᵒC and must have the facility to amplify it so that it can be read by microcontroller.
The detailed requirement, design and explanation can be found in article 3 wire RTD temperature transmitter circuit

Now questions arise, why bridge circuit is used? Why 100Ω resistors are selected? Why instrumentation amplifier with above stated resistors values is selected? What are the advantages of above arrangement?

All answers to above questions is explained in my article 3 wire RTD temperature transmitter circuit.

## Connection diagram for RTD PT100 temperature sensor using microcontroller

Following figure shows the connection diagram for temperature sensor PT100 using microcontroller. PT100 is connected in bridge circuit whose output is amplified by instrumentation amplifier. Using the resistors RV5 and RV6 of instrumentation amplifier, the gain is set at almost 10. Consider the following equation for.

$Gain=\left(1+\ \frac{2RV5}{RV6}\ \right)\ \frac{R9}{R8}$

Since the resistance of PT100 is 100Ω at 0 ᵒC, so by selecting the other resistors of bridge circuit of 100Ω value, 0ᵒC is set as reference point. It is because the output  VAB at this temperature will be zero. The detailed explanation of  reference value selection is also explained in 3 wire RTD temperature transmitter circuit article.

The amplified Voltage VAB is given to the analogue pin of microcontroller. The microcontroller after necessary calculation displays temperature on LCD. The necessary calculations are explained in next portion.
LCD is interfaced with port C of microcontroller. To understand LCD interfcing click interfacing LCD with microcontroller.

### How to find temperature from the voltage measured by Microcontroller

NOTE: For this article range of temperature to be measured is 0 ᵒ to 100 ᵒC.

#### Classical method

In this method, resistance is first determined from the measured voltage and temperature is then calculated.

Let us say the voltage V0 is measured by the microcontroller. Say V0 = 2V.

Now this is the voltage after multiplying gain “G” of amplifier. In our case gain G =10.

Now to get the actual voltage VAB between point A and B

$V_{AB}=\ \frac{V_o}{G}=\ \frac{2}{10}=0.2$   …………………………………..1

This is the voltage between point A and B. From this value we can find the voltage drop across PT-100.
One leg of bridge rectifier has both resistors of 100Ω (R1 and R3). So voltage drop across each is 2.5V because input voltage is 5V and it is equally divided between two. It means voltage at point B is always 2.5V.

So voltage across R3 is 2.5V and voltage drop across PT100 should be 2.5+VAB = 2.5+ 0.2 = 2.7V.

So voltage drop across PT100  VPT100 = 2.7V

So now using voltage divider circuit, resistance of PT100 can be found

$V_{PT100}=\ \ V_{in}\left(\ \ \frac{R_{PT100}}{R_{PT100}+R2}\ \right)$   …………………………….2

By solving above equation

$R_{PT100}=\left\{\frac{\left(\frac{V_{PT100}}{V_{in}}\right)R_2}{1-\ \left(\frac{V_{PT100}}{V_{in}}\right)\ }\right\}$   ………………………..3

In our case Vin = 5V, R2= 100Ω, VPT100 = 2.7V ( method shown)

By finding the resistance, we can find the temperature by using temperature coefficient of resistance method.

$R_{P??100}=\ R_{ref}\ (1-a(T-T_{ref})$  …………………4

Since our reference point is TRef is  0ᵒC at which resistance of PT100 is Rref  is 100 Ω.

Rewriting above equation

$T=\left\{\ \frac{\left(1-\ \frac{R_{PT100}}{R_{ref}}\right)}{a}\ \right\}$ ………………………..5

Where RPT100 is found from equation 3, Rref  = 100 Ω, α= temperature coefficient of resistance and its value can be determined from its datasheet which is 0.00385.

NOTE: The above method is long and contain too many calculations. Also the temperature cofficient of resistance α is not constant and varies with temperature. Therefore in next section we will discuss alternate method.

#### Direct method

In this method, a direct relation can be determined between the output voltage and temperature. The line equation is used and modified according to requirement. General line equation is

$y\ =mx+C$

Where m = slope, C= y intercept and y = independent quantity x= dependent quantity.

To find the relation between voltage and temperature, output voltage for various values of temperature is found from the transmitter circuit and given in the table.

 Temperature T Bridge output    VAB    (mv) V output of instrumentation amplifier ( V AB x 10) Volts Increase in voltage per degree rise in temperature ( VAB / T) (volts/ ᵒC) Slope (m) 0 0 0 N/A 5 24 24 0.0048 10 47.4 48 0.0047 15 70.4 72 0.0046 20 92.5 95 0.0046 25 115 117 0.0046 30 137 139 0.0045 35 158 161 0.0045 40 179 182 0.0044 45 199 203 0.0044 50 219 223 0.0043 55 239 243 0.0043 60 258 263 0.0043 65 277 282 0.0042 70 295 301 0.0042 75 314 320 0.0041 80 331 338 0.0041 85 350 357 0.0041 90 367 374 0.0040 95 384 391 0.0040 100 400 409 0.0040

Since at 0ᵒC, VAB = 0. So put Y intercept C=0 in line equation

So equations becomes

$T=\ \frac{V_{AB\ }(in\ volts)}{m}$

It can be seen from the table that value of m (slope) varies with temperature so a single value cannot be used. For each 10 ᵒC range, separate value of m is used. This is simplest form of linearization. Other techniques of linearization can also be used.

This article uses the direct relationship between temperature and voltage to construct microcontroller based temperature sensor using PT100.

## Simulation and result for microcontroller temperature sensor using RTD PT100

Above circuit is simulated in ISIS Proteus and results are shown below. RTD temperature sensor using microcontroller is checked for different values of temperature and results are accurate with maximum error up to 0.5 ᵒC.

## Program for RTD PT100 temperature sensor using microcontroller

The code is written and complied in MIKRO C.

If you have any questions you can ask in comments. You can also share your ideas and suggest any improvments in above article.

### About Syed Noman ud din

Syed Noman ud din is an Electrical Engineer and working in Industry from last 3 years. He writes technical articles for electrical and electronic engineers. He has also published several research publications in renowned international journals.

## Digital Frequency meter for sine waves

This article describes the design and construction of microcontroller based digital frequency meter. The circuit …