Sunteți pe pagina 1din 6

International Scientific Conference Computer Science2008

Precise Temperature Measurement and Data Processing with Xilinx Spartan-3E Starter Kit
Daniel Hadji, Valentin S. Mollov
Dept. of Computer Science, Technical University of Sofia, Sofia, Bulgaria Abstract: Temperature is among the most frequently measured analogue parameters. This might be expected since most electrical, chemical, mechanical, and environmental systems are strongly affected by the temperature directly or use its value to control other relevant processes. Intuitively, temperature is a measure of how hot or cold something is, although the most immediate way in which we can measure this, by feeling it, is unreliable, resulting in the phenomenon of felt air temperature, which can differ at varying degrees from actual temperature. Here we present a prototyped design of an engineering system for precise measurement of temperature based on Xilinx Spartan 3E developing kit. Keywords: measurement, FPGA design, microprocessor, ADC, data processing

1. INTRODUCTION. DESIGN FLOW Today, almost every VLSI design team applies programmable logic devices [1] to facilitate the overall design process and to minimize the final cost. Fast reconfigurable logic together with high rate analog-to-digital converter (ADC) opens this area for digital data processing and control. The on-site data processing in FPGA-based systems minimizes the risk of faulty transmission of analog measured data [2]. The design performed here uses Xilinx Spartan-3E Starter Kit board [3] and the provided on-board devices: Linear Technology LTC1407A-1 dual channel analog-todigital converter (ADC), LTC6912-1 dual-channel programmable amplifier, and a 2lines/16-characters liquid crystal display (LCD). As a sensing device we choose National Semiconductor LM94021 multi-gain analogue temperature sensor. The design applies embedded PicoBlaze 8-bit microcontoller [4] implemented on Spartan-3E FPGA for data processing, control and storage, as well as the on-board available LCD display for results visualization. Fig.1 presents the design flow of the reported measurement system. The main system resources are also shortly described there with its main features and parameters.
LM94021 Analog Temperature Sensor PicoBlaze embedded microcontroller Read A/D converter value Compute VINA input value. Calculate the temperature corresponding to the VINA input value Convert to BCD and display LTC1407A-1 14bit Analogue to Digital converter LTC6912-1 dual channel programmable amplifier Channel A (VINA) only

Liquid crystal display (LCD)

Fig. 1: System design flow and resources

219

International Scientific Conference Computer Science2008

An extended presentation of the FPGA-based measurement system is presented in Fig.2. There, all important application specific details concerning the design resources are shown.

Fig 2: Detailed block diagram of the system

2. DESCRIPTION OF THE SYSTEM RESOURCES 2.1. Temperature Sensor For this application we choose LM94021 CMOS multi gain temperature sensor from National Semiconductor [5]. It has an analog output that operates at supply voltage as low as 1.5V while operating over a wide temperature range from 50C to +150C. The sensor delivers an output voltage that is inversely proportional to the measured temperature. The sensors low voltage supply capability makes it an ideal solution for battery-powered systems as well as for general sensing applications. The two logic inputs: GS1 and GS0 select the gain of the temperature-to-voltage output transfer function. Four slopes are selectable: 5.5 mV/C, 8.2 mV/C, 10.9 mV/C, and 13.6 mV/C. For our application we use GS1=0 GS0=1 in accordance with the onboard supply voltage of 3.3V Fig.3.

220

International Scientific Conference Computer Science2008

Fig 3: LM94021 performance specifications

2.2. Analog-to-digital converter The analog capture circuit (Fig.4) consists of a Linear Technology low noise, digitally programmable gain pre-amplifier LTC6912-1 that scales the incoming analog signal from the sensor output with a gain fixed to -1, followed by LTC1407A-1 analog-to-digital converter. Both the pre-amplifier and the ADC are serially controlled by the FPGA.

Fig 4: Detailed view of analog capture circuit

The LTC1407A-1 is a 14-bit, 3Msps ADC with two 1.5Msps simultaneously sampled differential inputs, suitable for high speed, portable applications. The analog capture circuit converts the analog voltage on VINA or VINB and transform it to a 14-bit digital code D[13:0], as expressed by the eq.1:

221

International Scientific Conference Computer Science2008

(1)

(V 1.65V) D[13 : 0] = GAIN IN 8192 1.25V

The pre-amplifier reference voltage shown by the manufacturer is 1.65V. The laboratory measurements reveal a value close to 1.666V at the output of the voltage divider - Fig.4. So, we subtract a value of 1.666V instead of 1.65V to get the proper digital code from eq.1. 2.3. PicoBlaze embedded microcontroller The main processing unit for this design is the PicoBlaze soft processor implemented onboard over Xilinx XC3S500E Spartan-3E Field Programmable Gate Array (FPGA). The FPGA XC3S500E has over 10,000 logic cells and 320-pin package. The PicoBlaze microcontroller is a compact and cost-effective fully embedded 8-bit RISC microcontroller core optimized for the Spartan-3, Virtex-II, and Virtex-II Pro FPGA families. It occupies just 96 FPGA slices. The core (Fig.5) is totally embedded within the target FPGA and requires no external resources. It has the following main features: 16 byte-wide general-purpose data registers; 1K instructions of programmable on-chip program store, automatically loaded during FPGA configuration; byte-wide Arithmetic Logic Unit (ALU) with CARRY and ZERO indicator flags; 64-byte internal scratchpad RAM; 256 input and 256 output ports for easy expansion and enhancement; automatic 31-location CALL/RETURN stack; predictable performance, 2-clock cycles/instruction; fast interrupt response; worst-case 5 clock cycles.

Fig 5: PicoBlaze embedded microcontroller block diagram

The software control for this application is performed by assembler program which controls all onboard devices, as well as reads the digital value from the ADC and convert it to the corresponding digital value, according to the sensor specifications. 2.4. Liquid crystal display The board features a 2-lines x 16-characters liquid crystal display (LCD). The FPGA controls the LCD via the 4-bit data interface. Compared to the 50 MHz on board clock available, the display is relatively slow. The PicoBlaze efficiently controls display timing plus the actual content of the display. 222

International Scientific Conference Computer Science2008

3. MEASUREMENT AND RESULTS We perform 1-day continued measurement to get the results presented on the chart in Fig.6. There, the results derived with our system is compared with these, simultaneously obtained using a sample Agilent 34401A digital multimeter. The average comparative error for both measurement devices is quite low: approx. 0.026[%] with a maximum value of 0.091[%], so we can consider our system very accurate (maximum diversion -/+1 mV).

Fig 6: Comparison between the data measured with the Agilient multimeter and Picoblaze-based system

After proper reading the analog values, we are able to convert these values to usable temperature reading using two methods: LUT (lookup table) or formula. By using the formula these values are computed further to calculate the temperature for the corresponding points. This is done by modifying sensors manufacturer formula: V2 V1 (2) V - V1 = T T (T - T1 ) , 2 1 where V is in mV and T is in C. T1 and V1 are the coordinates of the lowest temperature, T2 and V2 are the coordinates of the highest temperature. In our case we discuss a temperature range from -50 to +125, and the coordinate from the transfer table for GS=01 is 1955mV for -50C and 521mV for +125C. So we derive the following: (3) 521 1955 V - 1955 = 125 (- 50) (T - (- 50 )) V - 1955 = (- 8.194 ) (T + 50 ) . As we need to calculate the temperature from the voltage value, the above formula should be rewrite as: V 1955 V 1545.3 T= T= (4) - 50 or - 8.194 - 8.194

223

International Scientific Conference Computer Science2008

Fig.7 shows the temperature values over the 1-day measurements calculated using eq.4.

Fig 7: Temperature vs. corresponding voltage over 1-day measurement trial

4. CONCLUSIONS The FPGA-based prototype measurement system presented above shows a very good accuracy, quite simple and cost-effective structure. As it is obvious, the presented design serves as a sample one for a wide range of application aimed to capture various analog data. Using PicoBlaze embedded core, we have a very reliable programmable data processing tool, easy extendable to perform other useful function as calibration, data storage, switching between several sensors, etc. Apart from inclusion other functionality, the basic design described here uses minimum chip resources. 5. REFERENCES [1] Pong P. Chu ( 2008), FPGA Prototyping by VHDL Examples: Xilinx Spartan-3 Version. Wiley-Interscience (February 4, 2008). [2] Losansky J., Rentzsch M., Guldner, H. Intelligent measurement and control platform using Spartan3 FPGA, European Conf.on Power Electronics and Appl.,2005, pp.1-5. [3] Xilinx UG230 (v1.0). Mar., 2006. Spartan-3E Starter Kit Board User Guide. [4] Xilinx UG129 (v1.1.1). Nov., 2005. PicoBlaze 8-bit Embedded Microcontroller Users Guide. [5] http://www.national.com/pf/LM/LM94021.html - Multi-Gain Temperature Sensor.

224

S-ar putea să vă placă și