Presentation is loading. Please wait.

Presentation is loading. Please wait.

Academic Workshop Lab Measuring Temperature with Thermistors.

Similar presentations


Presentation on theme: "Academic Workshop Lab Measuring Temperature with Thermistors."— Presentation transcript:

1 Academic Workshop Lab Measuring Temperature with Thermistors

2 2 Cypress Confidential Objective Exploit PSoC topology to build inexpensive digital thermometer. Understand the operation of a negative temperature coefficient (NTC) thermistor. Understand how to calculate Steinhart Hart constants for a specific thermistor. Calculate temperature using the Steinhart & Hart equation. Calculate temperature using a look up table.

3 3 Cypress Confidential Hardware Overview CY8C3210-PSoCEval1 board. MiniProg Thermistor 10k resistor Breadboard wire

4 4 Cypress Confidential Reference Material AN2028 Ohmmeter AN2017 Thermistor Based Thermometer AN2239 ADC Selection

5 5 Cypress Confidential Measuring Resistance Unlike measuring voltage or current, measuring a a passive characteristic like resistance requires stimulus A Classic method is to push current into a resistor and measure the developed voltage. Only as accurate as Current Source ADC Gain and Offsets Resistance limited to ADC range. Requires different current values for wide range of resistors. Very popular when cost of accurate current sources was less than the cost of computation.

6 6 Cypress Confidential PSoC and Measuring Resistance For this circuit the following equation holds. Solving for R test results in: Offset errors removed by difference Measurement offset voltages subtract out! Gain errors removed by quotient Measurement path errors divide out! Accuracy determined by an external reference resistor …

7 7 Cypress Confidential PSoC and Measuring Resistance And ADC resolution For an n bit ADC the number of counts seen across aR is: The reading is accurate to +/-.5 counts. Overall resolution tolerance is: For 14 bits and an attenuation of 15/16, the equation simplifies to: Tol (%)a 0.332%0.01 0.0399%0.1 0.013%1 0.0399%10 0.332%100

8 8 Cypress Confidential Thermistors A negative temperature coefficient thermistor (NTC) is a semiconductor device that becomes less resistive as its temperature increases. The change in resistance is “roughly” expressed by the equation below. Where: A is some empirical value less than one for negative temperature coefficient (NTC) thermistors. T 1 & T 2 are temperatures measured in Kelvin. R(T 1 ) & R(T 2 ) are the thermistor’s resistances at these temperatures.

9 9 Cypress Confidential NTC Thermistors ”Roughly” is defined as a good approximation for an academic introduction to thermistors. It shows the temperature/resistance relationship to be ideally exponential. It won’t hold up for real world temperature- measuring application. But for small temperature differences the following holds:

10 10 Cypress Confidential Steinhart-Hart Equation The Steinhart-Hart equation describes the resistance change of a thermistor as related to its temperature. The equation below shows it to be a 3 rd order logarithmic polynomial using three constants. Where: A, B, and C are empirical constants. T K & is temperature in Kelvin. R is the thermistor’s resistance in Ohms.

11 11 Cypress Confidential Steinhart-Hart Equation Many thermistors come with these three parameters defined. For this particular thermistor they are in the datasheet If not they must be calculated. This is done by taking three points in the conversion table and solving for these constants. It makes most sense to use the minimum, maximum, and a middle value for the temperature range for which you are interested. From the Thermistor Table TcTc Resistance 0°C32,660 ohms 40 °C5,325 ohms 80 °C1,257 ohms Note: This is an example and not for the thermistor we are using

12 12 Cypress Confidential Steinhart-Hart Equation Apply the three data points to the following equation. To get the three following equations. Solve to get: A = 0.11261637e-2 B = 0.23461776e-3 C = 0.85700804e-7

13 13 Cypress Confidential Thermistors The cost of thermistors is primarily determined by the accuracy of the thermistor’s resistance. This is where the exponential nature of thermistors works out to your advantage. A thermistor’s resistance tolerance shows up as a temperature shift. This can be calibrated out with a single point calibration. In test, bring the thermistor to 25˚C and measure its temperature. Suppose it reads 26.2˚C Software needs to store a 1.2˚offset in memory.

14 14 Cypress Confidential Thermistors In consumer products this calibration is many times left to the user. The user interface allows access to the temperature offset register. The user sets this if they think the temperature is a bit low or a bit high. A good rule of thumb is that a thermistor resistance uncertainty of n% works out to a temperature shift of approximately (n/3)˚C. This will help determine if any calibration is needed. Temperature calculations are only as accurate as the resistance measurement of the thermistor

15 15 Cypress Confidential Let’s Get Started Desired Topology Connect 10k Ohm from P05 to P01. Connect 10k Ohm thermistor from P01 to P03. Start Designer Name the Project Therm. Therm V0_Out REFHI PSoC 10k ADC REFLO P05 P01 P03 V2_Out V1_In buf1 buf0 InputAtten R 15R Buffer

16 16 Cypress Confidential EVAL1 Connections 10K Therm P05 P03 P01 Wire

17 17 Cypress Confidential Starting a New Project Open PSoC Designer Select Start new project

18 18 Cypress Confidential Starting a New Project Select Project Type Name The Project

19 19 Cypress Confidential Starting a New Project Select Device and Coding Method CY8C29466-24PXI C OK

20 20 Cypress Confidential Global Resource Settings

21 21 Cypress Confidential Select PGA UM Select PGA and name it InputAtten Insert into ACB00 Set the PGA parameters to: Atten Value set to 15/16 Reference to AGND Input connected to column MUX to read all three points on the resistor string

22 22 Cypress Confidential Select Second PGA UM Select PGA and name it Buffer Insert into ACB01 Set the PGA parameters to: This UM generate API in multiplex the input lines.

23 23 Cypress Confidential Select AMUX4 UM Select an AMUX4 and rename it ADCMUX Set its parameter has shown.

24 24 Cypress Confidential Select ADCINC UM Select an ADCINC UM and rename it ADC. Select a single modulator and place it in ASC10. Select the clock to be VC2. Place the digital block in DBB0. Input connects to Buffer. PWM is not used

25 25 Cypress Confidential Select LCD UM Select and LCD UM and name it LCD. Connect to Port 2 BarGraph is not needed.

26 26 Cypress Confidential Rename Buffers and Pins Connect the AnalogOutBuf_1 to P05. Rename this pin V0_Out. Connect the AnalogOutBuf_0 to P03. Rename V2_Out. Change PO1 to be an AnalogInput. Rename it V1_In.

27 27 Cypress Confidential Add Initialization Code In the Initialization Section Add code to start Buffer, InputAtten, ADC, and LCD. Add code to connect REFHI to the column1 analog bus. Add code to connect REFLO to the column0 analog bus. Declare iV0, iV1, iV2, iRvalue to be global variables. Enable global interrupt. Declare bTempValue to be a global 8 bit variable. Add LookUp table. (Cut and Paste from File on CD)

28 28 Cypress Confidential LookUp Table Temperature Conversion The Steinhart-Hart equation requires using the floating point math library. Floating point is slow and uses buckets more ROM compared to integer math. An alternative is to use a look up table. For any particular thermistor, the manufacturer either supplies a R/T conversion table, or supplies the three Steinhart-Hart coefficients. If only the coefficients are supplied, a table can be generated from them. This particular thermistor has a R/T conversion table that supplied.

29 29 Cypress Confidential Create a Look Up Table Excel file ThermTable.xls contains the 81resistance values for temperature for 0°C to 80 °C. Calculate half values for ½°C to 79 ½°C using the following equation. ½ degrees are used for rounding. Add the value zero at the end.

30 30 Cypress Confidential Create a Look Up Table* These values are used to make an ROM array WThermTable[ ] containing 81 values. *code is provided in lab file

31 31 Cypress Confidential Add Code Control Loop In the Control Loop Set ADCMUX to P05. Run ADC. Wait for data. Place in iV0 Set ADCMUX to P01. Run ADC. Wait for data Place in iV1. Set ADCMUX to P03. Run ADC. Wait for data Place in iV2. Calculate Resistance. Display on LCD.

32 32 Cypress Confidential Add Code CalculateR If iV0<-iV1 (Open Circuit) lRvalue = -1 Else If iV1 <= iV2 (Short Circuit) iRvalue = 0 Else Calculate Resistance Add half denominator to numerator to implement round off.

33 33 Cypress Confidential Run Build the Project. Record RAM and ROM Usage. Download to the Eval board and run. Using the look up table determine the temperature.

34 34 Cypress Confidential Summary PSoC makes measure resistance a cost effective option. Temperature can easily be measure using thermistor with the Steinhart-Hart equation or look up table.

35 35 Cypress Confidential Questions


Download ppt "Academic Workshop Lab Measuring Temperature with Thermistors."

Similar presentations


Ads by Google