Design of industrial measuring instrument based on CS5550

Publisher:九九归一74Latest update time:2011-08-09 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction
Modern industrial measuring instruments are based on single-chip microcomputers and have functions such as digital display, switch output, over-limit alarm and communication. They are used to measure detection signals at various industrial sites and are important detection and control devices that are indispensable for industrial control automation. They are widely used in power, chemical, metallurgical and other departments.
With the improvement of component production technology and automation level, the requirements for measuring devices are getting higher and higher. In order to achieve low drift, high stability and high resolution, the CS5550 A/D converter is used. This system realizes the acquisition of voltage, current, resistance and other signals by a single instrument through simple jumpers, and realizes the conversion of various signals through powerful programs, truly achieving a multi-purpose intelligent instrument.

1 Hardware circuit design
The various input signals of the instrument are selected by jumpers, and after switching the measurement circuit, they are directly sent to the CS5550 A/D converter, converted into digital quantities and sent to the CPU for processing. After the input signal is linearized, cold end compensation, external line resistance compensation and other operations, the measured value is sent to the LED display or transmitted to the host computer or other controller via RS-232, and compared with the alarm value set by the user, thereby driving the relay alarm output.
The system structure is shown in Figure 1. The analog circuit part of the measurement circuit and A/D conversion is the key to the system design and directly affects the accuracy of the measurement results. The core part of the software is to convert the collected digital signal into an accurate measurement result, such as converting the weak voltage signal of the thermocouple into the corresponding temperature value.


1.1 A/D conversion circuit The
A/D conversion of this system uses Cirrus Logic's two-channel, low-cost Delta-Sigma analog-to-digital converter CS5550 chip, which is a small-volume, highly integrated solution that is easy to design and cost-effective.
CS5550 integrates amplifier, A/D converter, digital filter, reference voltage circuit and bidirectional serial port. It has convenient on-chip offset and gain calibration functions, which can be reset through the serial port to complete initialization and directly output accurate measurement results. It is a dual-channel solution. The
analog power supply and digital power supply of CS5550 are provided separately. The analog power supply part uses an RC low-pass filter circuit to enhance the stability of the system. The reference voltage source provided on the chip is used to simplify the circuit design. Communicate with the microcontroller through the SPI interface. The peripheral reference circuit of CS5550 is shown in Figure 2.

[page]

1.2 Measurement circuit
The measurement circuit is shown in Figure 3. The signal input is connected to the wiring terminal, and the measurement circuit of the input signal is selected through the jumper. Here, the jumper can be replaced by an analog switch, which is switched through the microcontroller control.


When jumpers 1 and 2 are short-circuited, the input voltage signal is measured, and the signal input of the thermocouple can be connected. When
jumpers 5 and 6 are short-circuited, the input current signal is measured, and the current generates a voltage drop through the precision resistor r. In this way, you only need to know the resistance value of resistor r to measure the current value, and you can connect 0-10mA and 4-20mA standard signals.
When jumpers 3 and 4 are short-circuited, the input resistance signal is measured. The resistance measurement method can use the constant current source method, which can eliminate the influence of lead resistance and the output voltage does not have nonlinearity, but the cost is relatively expensive.
This system uses a three-wire resistance measurement method. As shown in Figure 3, the dotted part is the two signal wires for measuring resistance, and the resistance ground wire is the third wire. Because the leads are usually made of the same material and the same length, the voltage drop and temperature drift generated by the resistance on the lead cancel each other out. The LM336 provides a stable reference voltage source to eliminate the influence of power supply instability on resistance measurement. This solution is low-cost, accurate and stable.
1.3 Keyboard and LED display
This system provides four buttons, connected to P1.0~P1.3 of the microcontroller, and their functions are "Menu", "+", "-", and "OK". The button information is read through timed scanning, with software de-jitter to improve stability. The system is controlled by buttons to perform calibration, set values, switch signal conversion types, etc. The LED display is scanned in real time through timed interrupts without flickering, and access is made through the buffer mechanism. When the data changes, only the buffer needs to be updated.
1.4 EEPROM storage system
EEPROM is used to permanently save the system calibration parameters when the product leaves the factory, so that when the system is powered on, the system parameter data is first read from the EEPROM. After the system has been running for a long time, the system parameters can be recalibrated to ensure the accuracy of the measurement.
1.5 RS-232 communication interface
RS-232 is the communication interface between the system and the host computer or other controllers. Through RS-232, the measurement data or alarm signal data can be output in real time as the input of other controllers, and the operation mode can be set through RS-232, which provides convenience for industrial control automation and configuration.
1.6 Switch output circuit
This circuit is used as the controller to output signals to the outside. The highest and lowest set values ​​are placed in the memory using the keyboard and saved in the EEPROM for long-term storage. The instrument compares the sample value and the set value at any time, and outputs the comparison result in the form of switch quantity to achieve the purpose of controlling the peripherals. The switch output circuit consists of a photoelectric coupling circuit and an output relay, as shown in Figure 4.

[page]

2 Software Design
The software part adopts modular coding, and the main modules are: system parameter calibration module, data calculation and transformation module, keyboard and LED display module, CS5550 operation module, 93C46 EEPROM storage module, RS-232 communication module, switch output control module, etc. The overall flow of the software system is shown in Figure 5.


After the system is turned on, it is first initialized, the calibrated system parameters are loaded from the EEPROM, and the I/O, A/D, etc. are initialized. Next, the program main loop is entered to execute keyboard scanning. When a key is pressed, key processing is performed. According to the key combination, CS5550 parameter calibration, measurement circuit calibration, signal conversion type switching or parameter value setting are performed. If no key is pressed, the input signal is sampled and calculated, and the data is converted according to the set conversion type to obtain the measured value of the signal, and then the display buffer is refreshed and the display is updated. The measured value is then compared with the high and low set values ​​of the switch quantity, and the corresponding set level is output to achieve the control purpose. Finally, if there is a communication requirement, the corresponding subroutine is executed and the loop starts.
2.1 Calibration module
First, jumpers 1 and 2 in the measurement circuit of Figure 3 are short-circuited, and the corresponding reference signal is input to calibrate the offset and gain coefficients of the CS5550. Then short jumpers 5 and 6, input standard current i, such as 10mA, read the actual measurement value, that is, the voltage drop Ur on resistor r, then the resistance value of r is Ur/i, and save the result in EEPROM as one of the system parameters. Finally, short jumpers 3 and 4, and the following details the calibration of parameters V and R in the resistance measurement circuit and the calculation of the resistance rx to be measured. The equivalent circuit is shown in Figure 6.

[page]

As shown in FIG6 , rx is the resistance to be measured, and the voltage drop generated by the current flowing through rx is u. The equations (1) and (2) are obtained from Ohm's law.

After sorting, we get formula (3), where V and R are unknowns, and u is the data measured by this system. By connecting a precision resistor box to replace the resistor to be measured, we can set two values ​​of rx, such as 100Ω and 400Ω. Substituting into formula (3), solving the equations, we can get the calibration values ​​of V and R, and store them in the EEPROM as system parameters.

After calibration, the value of the resistor rx to be measured can be accurately calculated according to formula (4).

2.2 Calculation and transformation module
After calibration and initialization, CS5550 enters the measurement phase. After calculating the conversion effective value through the latest N instantaneous measurement values, all measurement results are provided in the form of relative percentage of full scale. Channel 1 has a programmable amplifier gain selection. When working at a gain of 10, if the measurement result is lower than 10%, the system switches its gain to a gain of 50; conversely, when working at a gain of 50, if the measurement result is higher than 90%, the system switches its gain to 10. This not only widens the measured signal range, but also improves the accuracy of system measurement.
After the measurement result read from CS5550 is converted into a relative percentage, multiplying it by the corresponding full-scale value can obtain the actual measured voltage value u. If the input is a current value, the measured current value is obtained by dividing it by the system parameter r. If the input resistance is measured, the measured resistance value is calculated according to formula (4).
After obtaining the actual value of the corresponding measurement signal, further transformation is required. If the thermocouple input is a voltage signal, it needs to be converted into a corresponding temperature signal, and the voltage-temperature relationship is not a linear transformation relationship. The transformation method can use a polynomial curve fitting method or a small interval linearization processing method.
This system can perform more than a dozen signal transformations, truly achieving multiple uses of one table. The following introduces the C language implementation method of signal transformation switching, which is achieved through function pointers. First, declare a function pointer,
typedef float, (*convert_t)(float val);
then define a variable for the function pointer,
convert_tconvert:
The following are some function prototype declarations for signal conversion. The parameter in the function is the measured voltage value, and the function returns the converted value,
float lkConvert(float val): //Thermocouple K grade
float lsConveit(float val): //Thermocouple S grade
float Pt100Convert(float val): //Thermal resistor Pt100
float Cu50Conveit(float val): //Thermal resistor Cu50
The signal conversion switching method example is as follows,
SWitch(opNum){
case 1: //Thermocouple K grade
convert=lkConvert:
break:
……
}
The signal conversion function is determined, and finally the function call is as follows,
unsigned long temp;
float result;
//Read channel 1 data from CS5550
temp=read(Ox16);
//Convert to percentage
result=temp/(float)0x0l000000;
//Multiply by the full scale value
result*=fullScale;
//Execute signal conversion
result=convert(result);
In this way, the result variable is the signal value corresponding to the sensor, such as temperature.

3 Conclusion
This system uses CS5550 for hardware core circuit design, which has a very high cost performance. It uses a simple configuration to achieve multiple uses of one meter. It has a small size, high integration, reliable operation, and has good promotion value.

Reference address:Design of industrial measuring instrument based on CS5550

Previous article:Data Acquisition Based on ARM9 Power Quality Monitor
Next article:Flow measurement principle and application of ultrasonic flowmeter

Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号