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 circuitThe 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.
Previous article:Data Acquisition Based on ARM9 Power Quality Monitor
Next article:Flow measurement principle and application of ultrasonic flowmeter
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- dsp28335 SCI Summary
- Why are PCBs mostly green?
- Class AB amplifiers are replaced by Class D amplifiers
- What kind of operation circuit is U2?
- Those who want to learn ROS system should read this (video teaching materials are updated continuously...)
- A large number of books have been released after graduation, including C/C++, Linux, algorithms, and other books. They are on sale now. Only 3 days left
- IWR1642Boost people counting DEMO program operation process
- I would like to ask the experts to introduce the generation of 2HZ in detail. Now the buzzer circuit 2HZ does not work! ! ! ! ! !
- Why doesn't the CPU top cover use silver, which has better heat dissipation?
- Summary of low power consumption STM32L151+RTC wake-up application