Sie sind auf Seite 1von 4

International Conference on Information Science and Technology March 26-28, 2011 Nanjing, Jiangsu, China

Resistance-temperature Characteristic Measurement System for Automotive Temperature Sensor Based on C/OS-
Hui Chen

AbstractResistance-temperature characteristic is an important performance of thermistor based automotive temperature sensor, so measuring the characteristic is an important technologic process to improve the quality of automobile products and work efficiency. In this paper, an embedded resistance-temperature characteristic measurement system for automotive temperature sensor is designed, which uses ARM7 chip as kernel and preemptive real-time embedded operating system C/OS-as software platform. The system has the capability of multi-task real-time scheduling and completely meets the need of real time and reliability. The hardware and software architecture of the system and the implementation method are introduced in this paper.

II. HARDWARE CIRCUIT A. Architecture Overview The proposed hardware circuit architecture of the system is shown in Fig.1. This system uses an embedded processor LPC2214 as hardware kernel. LPC2214 produced by NXP (founded by PHILIPS Company) is an ARM7TDMI-S kernel 32-bit RISC microcontroller with Thumb offering high performance and very low power consumption. It has rich on-chip resources such us ISP (In-System Programming) on-chip flash ROM of 256KB, IAP (In-Application Programming) on-chip static RAM of 16KB, vectored interrupt controller, external bus controller, I2C serial interface, two UARTs, two SPI serial interfaces, two timers (seven capture/compare channels ), PWM unit with up to six PWM outputs, 8-channels 10-bit A/D converter, real time clock, watchdog timer, general purpose I/O pins, CPU clock up to 60 MHz, on-chip crystal oscillator and on-chip PLL [3]. According to the automobile industry standard, the measured temperature of automotive temperature sensor ranges from +40 to 140, the MEMMERT thermostat oil bath made in Germany is chosen as heat source for the measurement system whose indoor temperature ranges from 5 to 200 with the control precision of 0.1.
automobile temperature sensor AD590 Constant temperature oil bath Keyboard LCD PC RS232 Resistance / voltage converter temperature / current / Thermodynamics/ Celsius temperature converter LPC2214

I. INTRODUCTION

odern automotive engine generally uses special coolant as cooling medium. The temperature of coolant is measured by temperature sensor which is equipped on the engine cooling water jacket. The result is then sent to automotive thermometer or ECU (Electronic Control Unit) in order to display and control the coolant temperature of automotive radiator [1]. Currently, almost every type of automobiles generally use thermistor based temperature sensor to measure the coolant temperature. In order to accurately measure the temperature, the performance of automotive temperature sensor must be ensured. So the resistance-temperature characteristic must be measured during the production. The traditional measurement systems usually adopt manual way, which has low efficiency and accuracy, so it can not meet the need of measurement. In this paper, we designed a resistance-temperature characteristic measurement system for automotive temperature sensor, which can be used to dynamically measure and display the resistance-temperature characteristic of automotive temperature sensor. The system uses computer technology as basis, ARM7 chip as control kernel and real-time kernel embedded operating system C/OS-as software platform [2]. Finally a highly efficient, accurate and reliable automatic measurement system is constructed here. The rest of this paper is organized as follows: Section describes the hardware circuit of the system. Section introduces the software design. Finally, a conclusion is given in Section .

IS61LV25616AL SST39VF160

Fig. 1.

Hardware circuit architecture

Hui Chen is with the School of Electronic and Information Engineering, Nanjing University of Information Science and Technology, Nan Jing, China (phone: 13585198951; e-mail: chenhui0501@ 163.com).
978-1-4244-9442-2/11/$26.00 2011 IEEE

During the measurement, the automotive temperature sensor is placed in the oil bath, and the output signal is sent to LPC2214 A/D port through a resistance-voltage conversion circuit. The temperature of medium in oil bath is measured by temperature sensor AD590 placed in oil bath, which is

921

converted to voltage signal by temperature / current / Thermodynamics / Celsius temperature conversion and measurement circuit, then sent to another LPC2214 A/D port to process. Finally the resistance-temperature characteristic curve of temperature sensor is displayed by LCD. The measured data can also be afforded to upper computer for collecting and processing through serial interface RS232. B. Resistance Measurement Circuit for Automotive Temperature Sensor Automotive temperature sensors mostly use negative temperature coefficient thermistor as the sensing element. Measuring the temperature sensor is virtually to measure its resistance, which can be implemented by resistance/voltage conversion circuit. The circuit diagram is shown in Fig.2. We add a constant-current source to the sensor in order to convert the variation of resistance to the variation of voltage, then the signal is sent to A/D port of LP2214 for processing through signal conditioning circuit. It must be regarded that, as the value of thermal can be affected by temperature, if the current of constant-current source is too high, the thermal loss of thermistor will increase, then the accuracy of measurement well be influenced, so the current of constant-current source is usually lower than 1mA. The circuit uses constant-current diode 2DH1 with the constant current of 1mA. The diode is connected with measured thermistor in series. In the circuit, the operational amplifier A1 is a voltage follower whose function is impedance matching, and A2 is an in phase proportional amplifier which is used to adjust the voltage coefficient [4].
+5V 100k 2DH1 10k 10k

the output current will increase 1A. The temperature measurement ranges from -55 to 150. Temperature sensor AD590 is connected with a resistor of 10k in series. It converts the current to the voltage UA, the value of which is (273+T)A10k=(2.73+T/100)V. In order to ensure the accuracy of measurement, a voltage follower A1 is added, which can increase the input impedance, and prevent the output current I from shunting. The voltage follower is composed of operational amplifier LM358. In Fig.3, the voltage UB firstly is held at 6V by a zener diode, then the output voltage UB is adjusted to 2.73V using rheostat as voltage divider. The value of the voltage is equal to UA at 0 . So the difference between UA and UB is 0V at 0, which is the converted Celsius temperature scale. The differential amplifier is composed of operational amplifier A2, whose output voltage Uo= (30k/10 k)(UA-UB).
12V 1.2k 10k 50k DZ 6V 10k UB 10k 10k UC 30k

A2

Uo

12V
I UA

A1 AD590 +
10k LM358

2214A/D LM358 30k

Fig.3.

Coolant temperature measurement circuit

A1 +

D. Other External Interface Circuit


+ A2
LPC2214 A/D LM358

LM358

measured sensor
Fig. 2. Consistence-voltage conversion circuit

C. Coolant Temperature Measurement Circuit Coolant temperature measurement circuit is a temperature / current / voltage / Thermodynamics / Celsius temperature conversion circuit, which contains temperature sensor AD590, voltage regulator, voltage follower A1 and differential amplifier A2. The circuit diagram is shown in Fig.3. The temperature sensor integrated circuit AD590 is a kind of temperature-current sensor, which has fine linear performance, high stability and sensitivity, and has no need of compensation. It has many other advantages such as low heat capacity, strong anti-interference ability, remote temperature measurement, convenience, etc [5]. The output current is proportional to the temperature. When voltage from 4V to 30V is added, the output current takes the absolute zero (-273 ) as benchmark, every time the temperature increase 1,

Other external interface circuit mainly contains keyboard, LCD display circuit, serial port communication circuit and external memory extended circuit. The keyboard is composed of 4 4 matrix keyboard, including numeric keyboard and functional keyboard. It is mainly used to initialize the parameters and implement function conversion. The LCD liquid display module uses the dot-matrix graph liquid crystal display module SEMG240128. The display memory of 32KB embedded in the module has the dot-matrix pixel of 240128, black text / white bottom, STN LCD screen, and the angle of view is 6:00. Its embedded controller is T6963C (produced by TOSHIBA Company) which integrates a negative voltage DC-DC circuit (LCD drive voltage). It only needs a single 5V power supply. The LCD module uses 8-bit bus interface to be connected with microprocessor. SEMG240128 and LPC2214 are connected using 8-bit bus, the circuit diagram is shown in Fig.4. Because SEMG240128 has no address bus, both address bus and data bus are connected through DB0-DB7. The graphic liquid module C/D and A1 are connected, control module A1 is used to process data/command, nCS3 in LPC2214 is used to control chip-select signal. When nCS3 is at zero level, the module is selected.

922

LPC2214 D0 D7 nCS3 A1 nWE nOE 47011


Fig.4.

SMG240128 DB0 DB7 CE C/D WR RD

SEMG240128 and PLC2214 connection circuit

The serial port communication uses MAX232 to be connected with upper computer. Taking account of using C/OS-, existing large numbers of data to be collected, processed and stored, and enough display buffer to display the data, a piece of SRAM IS61LV25616AL and a piece of FLASH SST39VF160 are extended to the external memory of LPC2214. III. SOFTWARE DESIGN A. Software Platform Traditional embedded software systems are designed using single task with foreground / background style. Each task in the system has the same priority. Manual scheduling is the main way to occupy CPU and other resources. This strategy is clearly powerless to a complex system [6]. So we adopt C/OS-here, which is a kind of free and open source embedded operating system. It has high efficiency, takes small space, and has excellent real-time performance and scalability. The kernel of C/OS- has functions of task scheduling and management, time management, synchronization and communication between tasks, memory management and interruption service. So far, C/OS-has run on more than 40 microprocessors with different architecture [7]. So it is suitable for the software platform of this control system. B. Porting of C/OS- Portability is a kind of performance representing that a real-time kernel can run on other microprocessors or microcontrollers. A processor can run C/OS- if it meets the following general requirements: 1) There must be a C compiler for the processor and the C compiler must be able to generate reentrant code. 2) It must be able to disable and enable interrupts from C. 3) It must support interrupts and need to provide an interrupt that occurs at regular intervals. 4) It must support a hardware stack, and the processor must be able to store a fair amount of data on the stack. 5) It must have instructions to load and store the stack

pointer and other CPU registers either on the stack or in memory[8]. Microcontroller LPC2214 meets all abovementioned requirements, so C/OS- can run on LPC2214. The main work of porting C/OS- is programming. We choose ADS1.2 integrated development environment provided by ARM Company as software development kit. The code contains three files as follows: 1) OS_CPU.H: This file mainly contains some definitions of date types, constants and macros related to processor. Because some data types in C such as short, int and long are related to the word length of processor and complier, so they are non-portable. In order to ensure the portability, we should define these data types in this file. 2) OS_CPU_A.ASM: This file contains the operations on register, and must be programmed using assembly language. There are four functions related to processor need to be modified here, such as OSStartHighRdy function to start the highest priority task ready-to-run, OSCtxSw function for a task level context switch, OSIntCtxSw function to perform a context switch from an interrupt service routine and OSTickISR function to provide a periodic time source to keep track of time delays and timeouts. 3) OS_CPU_C.C: This file contains ten C functions to implement some basic operations. These functions are OSTaskStkInit, OSTaskDelHook, OSTaskStatHook, OSTCBInitHook, OSTaskSwHook, OSTaskIdleHook, OSTaskCreateHook, OSInitHookBegin, OSInitHook End and OSTimeTickHook. C. System Tasks Having ported C/OS- to ARM microprocessor LPC2214, the next major work is task assignment according to the functional requirements of the system. The function of the system is collaboratively accomplished by multiple subtasks, each subtask taking charge of some part of the work. The scheme of task assignment will directly affect the efficiency and performance of the software [9]. The whole task of this system is mainly divided as follows: 1) Key_Scan_Task: Keyboard scanning task has the priority of 30. When a key is pressed, an interrupt will be generated. The interrupt service subroutine wakes up the keyboard scan task by transmitting semaphore. 2) Temp_Test_Task: Medium oil temperature test task has the priority of 19. In this task, the temperature of coolant is measured at first; then the sensor resistance collection task is woken up by the transmitted semaphore. The task is executed iteratively through time delay. 3) R_Test_Task: Sensor resistance test task has the priority of 20. This task mainly collects the sensor resistance, and further processes data. 4) LCD_Fresh_Task: LCD screen refresh task has the priority of 32. The main task is to update the data of display periodically. 5) RS232_Com_Task: Serial port communication task has the priority of 21. This task is woken up by the semaphore transmitted by keyboard task. When it needs to communicate with upper computer, the corresponding key is pressed; then

923

the communication task will be woken up by the semaphore transmitted by keyboard task. D. Program Flow The application program of the system begins at main function. The central program segmentation of main function is as follows: int main ( void ) { TargetInit ( ); OSInit ( ); OSTaskCreate ( R_Test, ( void * ) 0, (OS_STK *) & R_Test [ R_Test_STK_SIZE-1], 20 );

current / voltage / Thermodynamics / Celsius temperature measurement and conversion circuit. The embedded real-time operating system C/OS- is chosen as the software platform, which manages and schedules multiple tasks of the system. Results of practical application indicate that the proposed system has high performance, safety and reliability, and can fully meet the inspection process requirements for automotive temperature sensor. In further study, we can cut, expand and optimize the system, in order to make it more powerful. REFERENCES
Y. X. Zhou and D. G. Huang, Study of Fuzzy Control System for Engine Coolant Temperature, Journal of University of Electronic Science and Technology of China, vol. 38, no. 3, pp. 471 - 475, Mar. 2009 [2] Y. Yang and Y. Zhang, Research and Implementation of Porting C/OS- Based on ARM7, Computer Engineering and Design, vol. 30, no. 3, pp. 539 - 541, Mar. 2009 [3] L. G. Zhou, ARM based Embedded System Tutorial. Beijing: Beijing Aerospace University Press, 2005, pp.415 - 4312 [4] C.Y. Hua and S.B.Tong, Basic Analog Electronic. Beijing: Higher Education Press, 2006, pp.325 - 400 [5] C. Wang, Four-Channel Inspect Digital Thermometer Design Based AD590, Metrology and Measurement Technique, vol. 37, no. 11, pp. 46 - 48, Nov. 2010 [6] A. Sangiovanni-Vincentelli and M. D. Natale, Embedded System Design for Automotive Applications, IEEE Computer, vol. 40, no. 10, pp. 42 - 51, Oct. 2007 [7] J. J. Labrosse, C/OS-: the Real Time Kernel. USA: CMP Books, 2002, pp. 179 - 198 [8] C. J. Ning, C. Wang and X. Z. Zhou, Transplant of uC/OS- RTOS on ARM7 Kernel, China Measurement Technology, vol. 31, no. 2, pp. 65 - 66, Mar. 2005 [9] C. Zhang and D. Cordes, Resource Access Control for Dynamic Priority Distributed Real-time Systems, Real-Time Systems, Vol. 34, no. 2, pp. 101 - 127, Oct. 2006 [10] Z. K. Wang and L. Zhao, Research on task schedule strategy in C/OS- , Journal of Shandong University of Technology, vol. 23, no. 2, pp30 - 35, Mar. 2009 [1]

OSStart ( ); Return 0; } TargetInit function is used to initialize the system. Its work mainly contains defining relevant parameters and variables, setting all kinds of interrupts, and initializing devices. OSInit function is used to initialize C/OS-. OSTaskCreate function is used to create different functional tasks, then to create the semaphore for communication between tasks. OSStart function is used to activate multi-task scheduling [10]. The program flowchart is shown in Fig.5.
Start System hardware initialization Key_Scan_Task ( ) C / OS-II initialization LCD initialization R_Test_Task ( ) LCD_Fresh_Task ( ) Temp_Test_Task ( ) RS232_Com_Task ( )
Program Flowchart

Start multi-task scheduling

Create tasks Create maphores


Fig.5.

IV. CONCLUSION In this paper we proposed a resistance-temperature characteristic measurement system for automotive temperature sensor. The hardware circuit and software platform of the system are introduced in detail here. The control kernel of the hardware circuit is an ARM7 microprocessor LPC2214. The external circuit contains resistance / voltage conversion circuit and temperature /
924