CE210434 - PSoC® 3 and PSoC 5LP RTD Calibration.pdf

CE210434 - PSoC® 3 and PSoC 5LP RTD
Calibration
Objective
This example demonstrates how to use PSoC 3 or PSoC 5LP to calibrate an RTD.
Overview
AN70698 describes how the interchangeability error of an RTD can cause several degrees of temperature error when
measuring RTD temperature; Figure 1 shows the error versus temperature for two types of RTDs.
Figure 1. Temperature Error due to RTD Interchangeability Error
Note that the units on the right side of the figure are in degrees celsius (°C).
This error is unacceptable in systems that require high accuracy. To overcome this error, calibration is required. This code
example demonstrates how the RTD error can be calibrated out.
Requirements
Tool: PSoC Creator 3.3 CP1
®
Programming Language: C (ARM GCC 4.9, ARM MDK, DP8051 Keil 9.51)
Associated Parts: All PSoC 3 and PSoC 5LP parts
Related Hardware: CY8CKIT-001, CY8CKIT-050, CY8CKIT-030, CY8CKIT-025
Design
CE210383 describes and demonstrates how a basic RTD temperature measurement is performed on PSoC. This code
example uses the same basic setup but adds calibration.
Calibration is done on startup. The PSoC device sends a message over UART to a terminal emulator program on a PC. First,
it prompts you to confirm if you want to calibrate. To calibrate, you must bring the RTD to a known temperature, and enter this
temperature into the terminal program. The PSoC then calculates the RTD resistance for this temperature.
The PSoC then measures the RTD and calculates a ratio between the measured RTD and the value that you entered. This
ratio is then used to scale all future RTD results.
Note that this project only works for PSoC 3 and PSoC 5LP. In PSoC 4, the primary cause of error is integral nonlinearity
(INL), which cannot be calibrated out; thus calibration is not applied.
www.cypress.com
Document No. 002-10434 Rev.**
1
CE210434 - PSoC® 3 and PSoC 5LP RTD Calibration
Hardware Setup
1.
Plug CY8CKIT-025 into PORT E of either CY8CKIT-030 or CY8CKIT-050, as Figure 2 shows.
Figure 2. CY8CKIT-025 Plugged In to CY8CKIT-050
2.
On KIT-025, ensure that there are wires shorting the terminals of J8 and J9, as Figure 3 shows.
Figure 3. Shorting J8 and J9 on KIT-025
3.
(Optional) Plug an external RTD into J8 and J9, remove the J6 jumper and wires in J8 and J9, and CY8CKIT-025.
4.
Connect an LCD to the LCD Port on CY8CKIT-030 or CY8CKIT-050.
5.
Connect P3[7] to TX on the P5 connector, and P3[6] to RX on the P5 connector on CY8CKIT-030 or 050 to connect the
UART to the DB9 cable.
6.
Connect a DB9 cable from CY8CKIT-030 or CY8CKIT-050 to a PC.
Software Setup
This example firmware supports a terminal emulator interface. A UART interface outputs the temperature to a terminal
program on a PC.
www.cypress.com
Document No. 002-10434 Rev.**
2
CE210434 - PSoC® 3 and PSoC 5LP RTD Calibration
Serial Terminal
The documentation for setting up a terminal emulator for this example uses TeraTerm, but any terminal emulator software may
be used that is configurable to the standard UART settings shown in Figure 5. TeraTerm is open-source and downloadable
directly from the authors website https://en.osdn.jp/projects/ttssh2/.
1.
Create a new connection.
Launch TeraTerm and select File > New connection. Select Serial as the connection type and choose the COM port
where you connected the DB9 cable.
Figure 4. New Connection Creation
2.
Setup serial port parameters.
Open TeraTerm Serial port setup dialog (Setup > Serial port…). Only the Baud rate: should require changing to 115200,
but it is good to also confirm the other settings are as shown in Figure 5.
Figure 5. Terminal Emulator Setup Parameters
www.cypress.com
Document No. 002-10434 Rev.**
3
CE210434 - PSoC® 3 and PSoC 5LP RTD Calibration
3.
Serial output is displayed in the terminal window as shown in Figure 6.
Figure 6. Serial Window Output
Components Used
Table 1 lists the PSoC Creator Components used in this example as well as the hardware resources and parameter settings
used by each.
Table 1. List of PSoC Creator Components for PSoC 3 or PSoC 5LP
Component
Name
Hardware Resources
Non-default Parameter Settings
Config1
Conversion Mode: Single Sample
Resolution(bits): 20
ADC_DelSig [v3.0]
ADC
1 DelSig ADC Block
Conversion rate (SPS): 61
Input Rage: +/- 0.512 V (-Input +/- Vref/2)
Buffer Mode: Level Shift
Common
Number of Configurations: 1
Polarity: Source
Current DAC (8-bit) [v2.0]
IDAC
1 ViDAC
Speed: Low Speed
Range: 0-2.04 mA
Value: 1000 µa
Temperature Min: -200
RTD_Calculator [v1.20]
RTD
none
Temperature Max: -850
Calculation Error Budget: 0.01
Configure:
UART [v2.50]
UART
~2 UDBs
Mode: TX + RX
Bits per second: 115200
Character LCD [v2.10]
www.cypress.com
LCD
7 pins
N/A
Document No. 002-10434 Rev.**
4
CE210434 - PSoC® 3 and PSoC 5LP RTD Calibration
Design-Wide
Pin Locations for PSoC 3 and PSoC 5LP devices:
Pin Name
PSoC 3/
PSoC 5LP Location
LCD
P2[6:0]
RefRes_Current
P3[4]
RefRes_Positive
P4[4]
RefRes_Negative
P4[5]
RTD_Current
P3[1]
RTD_Positive
P4[0]
RTD_Negative
P4[1]
TX
P3[7]
RX
P3[6]
Operation
1.
Load the workspace into PSoC Creator by opening <Install_Directory>\CE210434\CE210434.cywrk.
2.
Build the code example by navigating to Build > Build <Project Name> in PSoC Creator.
3.
Connect the device/board to a programmer connected to a PC. On-board KitProgs are already connected to the
programming pins of the on-board device.
4.
Program the example to the device by navigating to Debug > Program.
5.
Open the terminal program by following the instructions in the Software Setup section.
6.
Power the device.
7.
Follow the on-screen instructions to calibrate the RTD.
Related Documents
Table 2 lists all relevant application notes, code examples, knowledge base articles, device datasheets, and Component
datasheets.
Table 2. Related Documents
Application Notes
PSoC 3/ PSoC 4/ PSoC 5LP
temperature measurement with
an RTD
Theory behind RTD temperature measurement.
CE210435
PSoC 3 and PSoC 5LP Broken
RTD Reconfiguration
Demonstrates how to detect a broken wire on an RTD connection and
reconfigure the Analog front end to keep measuring the RTD
CE210383
PSoC 3, PSoC 4, and
PSoC 5LP Temperature
Sensing with an RTD
Demonstrates basic RTD temperature measurement
AN70698
Code Examples
PSoC Creator Component Datasheets
RTD Calculator
Component datasheet for RTD Calculator Component
ADC DelSig
Component datasheet for ADC DelSig Component.
www.cypress.com
Document No. 002-10434 Rev.**
5
CE210434 - PSoC® 3 and PSoC 5LP RTD Calibration
Device Documentation
PSoC 3 Datasheets
PSoC 3 Technical Reference Manuals
PSoC 5LP Datasheets
PSoC 5LP Technical Reference Manuals
Development Kit (DVK) Documentation
CY8CKIT-025 PSoC Precision Analog Temperature Sensor Expansion Board
PSoC 3 and PSoC 5LP Kits
www.cypress.com
Document No. 002-10434 Rev.**
6
CE210434 - PSoC® 3 and PSoC 5LP RTD Calibration
Document History
Document Title: CE210434 - PSoC® 3 and PSoC 5LP RTD Calibration
Document Number: 002-10434
Revision
ECN
**
5077566
www.cypress.com
Orig. of
Change
TDU
Submission
Date
01/08/2016
Description of Change
New spec
Document No. 002-10434 Rev.**
7
CE210434 - PSoC® 3 and PSoC 5LP RTD Calibration
Worldwide Sales and Design Support
Cypress maintains a worldwide network of offices, solution centers, manufacturer’s representatives, and distributors. To find
the office closest to you, visit us at Cypress Locations.
PSoC® Solutions
Products
Automotive
cypress.com/go/automotive
psoc.cypress.com/solutions
Clocks & Buffers
cypress.com/go/clocks
PSoC 1 | PSoC 3 | PSoC 4 | PSoC 5LP
Interface
cypress.com/go/interface
Lighting & Power Control
cypress.com/go/powerpsoc
Memory
cypress.com/go/memory
PSoC
cypress.com/go/psoc
Touch Sensing
cypress.com/go/touch
USB Controllers
cypress.com/go/usb
Wireless/RF
cypress.com/go/wireless
Cypress Developer Community
Community | Forums | Blogs | Video | Training
Technical Support
cypress.com/go/support
PSoC is a registered trademark and PSoC Creator is a trademark of Cypress Semiconductor Corp. All other trademarks or registered trademarks
referenced herein are the property of their respective owners.
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
Phone
Fax
Website
: 408-943-2600
: 408-943-4730
: www.cypress.com
© Cypress Semiconductor Corporation, 2016. The information contained herein is subject to change without notice. Cypress Semiconductor
Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any
license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or
safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as
critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The
inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies
Cypress against all charges.
This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide
patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a
personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative
works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress
integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source
Code except as specified above is prohibited without the express written permission of Cypress.
Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the
right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or
use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a
malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’ product in a life-support systems
application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges.
Use may be limited by and subject to the applicable Cypress software license agreement.
www.cypress.com
Document No. 002-10434 Rev.**
8