Introduction: Measuring Temperature Using a PT100 and an Arduino

The aim of this project is to design, build and test a temperature sensing system. The system was designed to measure a temperature range of 0 to 100 °C. A PT100 was used to measure the temperature, and it is a resistance temperature detector (RTD) that changes its resistance depending on its surrounding temperature.

Step 1: Apparatus

1x PT100

1x Breadboard

2x 2.15 kohms resistors

1x 100 ohms resistor

Wires

Power supply

Differential amplifier

Step 2: About the PT100

As part of our project we are tasked with measuring the ambient temperature ranging from 0 degrees to 100 degrees Celsius. We decided on using the PT100 due to the following reasons:

The PT100 is a resistance temperature detector (RTD), which can measure temperatures from -200 degrees to a maximum of 850 degrees Celsius, but is not usually used to measure temperatures over 200 degrees. This range complies with our requirements.

This sensor produces a resistance for a given surrounding temperature. The relationship between temperature and resistance of the sensor is linear. This, along with the minimal setup the sensor requires, makes it easy to work with and altar if other temperature ranges are needed in the future.

The PT100 also has a slow response time but is accurate. These characteristics do not have much of an impact on our goal and thus were not as influential when deciding which temperature sensor to use.

Step 3: Wheatstone Bridge

The wheatstone Bridge is used to measure an unknown electrical resistance by balancing two legs of a bridge circuit, one leg of which includes the unknown component.

The primary benefit of the circuit is its ability to get a range of output voltage that begins at 0V.

A simple voltage divider could be used but would not allow us to get rid off any offset present, which would make amplifying the voltage output less effective.

The resistance in a PT100 varies from 100 to 138.5055 for a temperature of 0 to 100 degrees Celsius.

The formula for a wheatstone bridge is below, it can be used to rescale the wheatstone bridge for different ranges gotten from the pdf table attached.

Vout=Vin( R2/(R1+R2) - R4/(R3+R4) )

In our scenario:

R2 will be our PT100 resistance.

R1 will be equal to R3.

R4 needs to be equal to 100 ohms in order to output 0V at 0 degrees Celsius.

Setting Vout to 0V and Vin to 5V allows us to resistance obtain values for R1 and R2 = 2.2k ohms.

We can then sub in 138.5055 ohms for the resistance of the sensor to obtain our output voltage at 100 degrees Celsius =80mV

Step 4: Simulating the Circuit

A tool for simulating circuits, OrCAD Capture was used to simulate our circuit and find expected Voltage outputs at different temperatures. This would be used later to compare how accurate our system was.

The circuit was simulated by perfoming a transient time analysis with a paramatic sweep that varied the pt100 resistance from 100 ohms to 138.5055 ohms in steps of 3.85055 ohms.

Step 5: Simulated Results

The results above show the linear relationship of The output Voltage of the circuit and the resistance values.

The results were then inputted into excel and plotted. Excel provides the linear formula associated with these values. Confirming the linearity and the output voltage range of the sensor.

Step 6: Creating the Circuit

The circuit was put together using two 2.2k ohm resistors and a 100 ohm resistor.

The resistors have a tolerance of +-5%. The different resistance values cause the bridge to be unbalanced at 0 degrees.

Parallel resistors were added in series to the 100 ohm resistor to add nominal amounts of resistance to get R4 as close to 100 ohms as possible.

This produced an output voltage of 0.00021V which is extremely close to 0V.

R1 is 2,1638 ohms and R3 is 2,1572 ohms. More resistor could be connected to make R1 and R3 exactly equal, giving a perfectly balanced bridge.

possible errors:

  • variable resistor box used to test different temperatures values could have be inaccurate.

Step 7: Measured Results

The measured results can be seen below.

Change in temperature was measured using a variable resistor box, to set the resistance of R2 to different resistances that can be found in the PT100 datasheet.

The formula found here will be used as part of the code to determine the temperature output.

Step 8: For Much Larger Temperature Ranges

A Type K thermocouple could be introduced into the circuit if very high temperatures need to be recorded. The type K thermocouple can measure a temperature range of -270 to 1370 degrees Celsius.

Thermocouples operate based on the thermoelectric effect, A difference in temperature produces a potential difference (Voltage).

As Thermocouples operate based on the difference of two temperatures the temperature at the reference junction needs to be known.

There are two methods of measuring with thermocouples we could use:

  • A PT100 sensor could be placed at the reference junction and measure the reference voltage.
  • The reference junction of the thermocouple could be placed in an Ice bath which would be a constant 0 degrees Celsius but would be impractical for this project.

Step 9: Overview: Differential Amplifier Stage

The differential amplifier is an integral part the build. The differential amplifier combines what is essentially a non-inverting and inverting amplifier into a single circuit. Of course like with any build it comes with it's own limitations however as shall be shown over the next few steps, it definitely aids in obtaining the correct output of 5V.

Step 10: About the Differential Amplifier

The differential amplifier is an operational amplifier. It plays a key role in this circuit design of amplifying the voltage output from the Wheatstone bridge in mV to V and is then read in as a voltage input by the Arduino. This amplifier takes two voltage inputs and amplifies the difference between the two signals. This is called the differential voltage input. The differential voltage input is then amplified by the amplifier and can be observed at the output of the amplifier. The amplifier inputs are obtained from the voltage dividers of the Wheatstone bridge in the previous section.

Step 11: Benefits and Limitations

The differential amplifier comes with its own share of pros and cons. The main benefit of using such an amplifier is for ease of construction. As a result of this easy construction, it makes troubleshooting issues encountered with the circuit easier and more efficient.

The cons of using such a circuit are that in order to adjust the gain of the amplifier, the gain determining resistors (feedback resistor and ground connected resistor) both must be switched out, which can be timeconsuming. Secondly the op-amp has a relatively low CMRR (common-mode rejection ratio) which is not ideal for mitigating the influence of input offset voltage. Thus in a configuration like ours, having a high CMRR is essential in mitigating the effects of offset voltage.

Step 12: Selecting Desired Output Gain

The op-amp features 4 resistors connected to the circuit. 2 matched resistors at the voltage inputs, another connected to ground as well as a feedback resistor. These two resistors serve as the op-amp's input impedance. Typically, a resistor in the range of 10-100 kilohms should suffice, however once these resistors have been set, the gain can be determined by letting the desired output gain equal the ratio of the feedback resistor to the input resistor at one of the inputs (Rf/Rin).

The ground connected resistor, as well as the feedback resistor, are matched. These are the gain determining resistors. By having a high input impedance, it minimises the effects of loading on the circuit i.e. preventing high amounts of current from driving through the device which can have devasting effects if uncontrolled.

Step 13: ARDUINO MICROCONTROLLER

The Arduino is a programmable microcontroller featuring digital and analog I/O ports. The microcontroller was programmed to read the voltage from the amplifier via an analog input pin. First, the Arduino will read the voltage from the circuit output range 0-5 V and convert it to 0-1023 DU and it will print the value. Next, the analog value will be multiplied by 5 and divided by 1023 to get the voltage value. This value will be multiplied by 20 to give the exact scale for the temperature range from 0-100 C.

To get the offset and sensitivity values, the readings from the input pin on A0 were taken with different values for the PT100 and the graph was plotted to get the linear equation.

The code that was used :

void setup() {
Serial.begin(9600); //start the serial connection with the computer

pinMode (A0, INPUT); //output from the amplifier will be connected to this pin

}

void loop()

{ float offset = 6.4762;

float sensitivity=1.9971;

int AnalogValue = analogRead(A0); //Read the input on A0

Serial.print("Analog Value: ");

Serial.println(AnalogValue); //print the input value

delay(1000);

float DigitalValue = (AnalogValue * 5) / (1023); //mul by 5 to give the range 0-100 degree

Serial.print("Digital value: ");

Serial.println(DigitalValue); //analog voltage value

float temp = (AnalogValue - offset)/sensitivity;

Serial.print("Temperature value: ");

Serial.println(temp); //print temp

delay(5000);

}

Step 14: Troubleshooting

The 15V supply to the op-amp and the 5V to the wheatstone bridge and arduino must have a common ground. (all 0v values need to be connected together.)

A Voltmeter can be used to make sure that the voltage drops after every resistor to help ensure there are no short circuits.

If results are varying and inconsistant the wires used can be tested by using the voltmeter to measure the resistance of the wire, if the resistance says "offline" it means there is infinite resistance and the wire has an open circuit.

Wires should be less than 10 ohms.

The voltage difference across the wheatstone bridge should be 0V at the minimum range of the temperature range, if the bridge is not balanced it could be because:

resistors have a tolerance, which means they could have an error which may cause the wheatstone bridge to be unbalanced, the resistances can be checked with a voltmeter if it is removed from the circuit. smaller resistors could be added in series or parallel to balance the bridge.

Rseries=r1+r2

1/Rparallel =1/r1 + 1/r2

Step 15: Rescaling

The formula and method for rescaling the system for a different temperature can be found in the wheatstone bridge section. Once these values are found and the circuit is set up:

The PT100 should be replaced with a resistor box, The resistance values should be adjusted from the new temperature range using the appropriate resistance values obtained from the attached pdf.

The measured voltage and resistances and should be plotted in excel with temperature (resistance) on x axis and voltage on the y.

A formula will be given from this plot, the offset will be the constant that is added and the sensitivity will be the number multiplied by x.

These values should be changed on the code and you have successfully rescaled the system.

Step 16: Setting Up the Arduino

connect the output of the circuit amp to the A0 input pin of the Arduino

Connect the Arduino Nano via the USB port on a PC.

paste the code to the Arduino sketch workspace.

Compile the code.

Select Tools > Board > Select Arduino Nano.

Select Tools > Port > Select COM port.

Upload the code to the Arduino.

The digital value outputted is the voltage output of the op-amp (should be 0-5V)

The temperature value is the systems read temperature in Celsius.