DSP Implementation in Weighing Controller Design

Publisher:SparklingRiverLatest update time:2011-07-22 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1 Introduction

This design aims to solve the problems of low weighing accuracy and low automation in the glass batching process. The high-performance digital signal processor TMS320F2812 (F2812) is used as the core device. On the basis of designing a friendly human-machine interface, the controller specially designs an amplifier circuit that matches the built-in analog-to-digital converter of F2812, and adds a sampling calibration method in the A/D sampling process to ensure that the sampling data is more accurate; the digital filtering method is used to process the sampling data and filter out the interference in the sampling data.

2 Batching system workflow

The glass batching system generally includes a weighing controller, a preparation hopper, a metering hopper and related power devices. The preparation hopper is used to store a certain amount of material to be tested. The discharge port below the preparation hopper is driven by an electric vibrator. By changing the vibration speed of the electric vibrator, the discharge speed of the preparation hopper can be changed. Below the preparation hopper is a metering hopper, which is a suspended container placed on a weighing sensor. The controller obtains the mass of the material in the metering hopper by interpreting the data of the sensor.

When the weighing process starts, the weighing controller sends a control signal, and the material preparation hopper starts to discharge materials quickly. After the material enters the measuring hopper, the weight signal is measured by the sensor under the measuring hopper, and the signal is processed and restored to the weight of the material. The controller automatically compares the deviation between the current material weight and the target weight. When the deviation value E is reduced to a certain range (such as 10%, that is, reaching 90% of the target weight), it sends a signal and drives the material preparation hopper to discharge materials slowly, so that the measured weight value changes slowly, which is conducive to precise control. Whenever the controller sends a stop feeding signal, a certain amount of material will just leave the outlet of the electric vibrator and fall (i.e. "flying material"), so that the final weighed material weight is greater than the target weight determined by the system. The general solution is to stop feeding in advance before reaching the target value, wait for the "flying material" to fall, and after the detection value stabilizes, the controller will judge the deviation value and perform the next step of control (i.e. jog feeding mode) until the weight reaches the target value. Then the controller sends a signal to open the measuring hopper to discharge the weighed material, completing a weighing control process. Combined with the above working process, the controller design is as follows.

3 Controller Hardware Implementation

The hardware block diagram of the controller is shown in Figure 1. It is mainly composed of F2812, signal conditioning circuit, display/keyboard module, and serial communication module. As a 32-bit digital signal processor, F2812 adopts Harvard bus structure, has strong computing power, and the highest operating speed reaches 150MIPS. It can process various algorithms including weighing control and software filtering. It includes 128KB flash memory (FLASH) and 128KB read-only memory (ROM) internally, and the storage space is large enough to meet most program design requirements. It supports 45 peripheral interrupts, responds quickly, and facilitates the rapid call of subroutines. It integrates a 12-bit A/D converter on the chip, which can quickly perform analog-to-digital conversion, and no additional hardware needs to be added during system design. It has two serial communication interfaces (SCI) and one serial peripheral interface (SPI), which can simplify the communication interface design and make the system compact.


Figure 1 System hardware block diagram

3.1 Signal Conditioning Circuit

Signal conditioning The circuit mainly completes the filtering and amplification of the signal before analog-to-digital conversion. Since this design adopts software filtering, the amplification of the signal is mainly considered. In field applications, the full-scale output signal voltage of the weighing sensor with a sensitivity of 2mV/V is 20mV when the 10V voltage excites the weighing sensor. The input voltage of the built-in A/D converter of F2812 is 0-3V, so an amplification circuit must be set. The design adopts an instrument amplifier circuit composed of 3 operational amplifiers (Figure 2). The two OP07s on the left side of the circuit form the first-stage differential amplifier circuit, and the OP07 on the right side is the second-stage differential amplifier. The gain of the circuit can be adjusted by adjusting the 1k Ω variable resistor. According to calculations, in order to achieve a gain adjustment of 150 times, the variable resistor R needs to be adjusted to 1.33 Ω. This circuit has high input impedance and high common-mode rejection ratio. In order to prevent the input voltage from exceeding the working voltage of the DSP and damaging the chip in an unexpected situation, a 3V voltage regulator tube is required before the signal is input to the DSP pin.


Figure 2 Schematic diagram of the amplifier circuit

3.2 A/D conversion and sampling calibration

The accuracy of A/D conversion will largely determine the accuracy of the weighing controller. This design uses the analog-to-digital converter built into F2812, which can simplify the circuit design while achieving the conversion accuracy required by the controller.

Gain error and offset error are the main factors affecting the accuracy of A/D conversion. Gain error refers to the difference between the slope of the actual transfer function and the slope of the ideal transfer function; offset error refers to the deviation of the actual output from zero when the input is zero. This design uses the sampling calibration method to compensate for gain error and offset error. The typical error between 8 channels in a group of A/D conversion units of F2812 is less than 0.2%. By sampling the known reference voltages Hx and Lx of the other two sampling channels, the A/D conversion results Hy and Ly are obtained, and then the gain error and offset error are calculated using the principle of solving a linear equation group, and then a more accurate conversion result is calculated. y is the amount to be corrected, and the corrected result x can be expressed by formula 1:

The F2812 chip itself is designed with a reference voltage for A/D conversion sampling calibration, which is output by the ADCREFP and ADCREFM pins, with voltages of 2V and 1V respectively. When in use, an external 10 μF low equivalent series resistance ceramic bypass capacitor is connected to the ground and can be used directly. However, its voltage output accuracy is limited, so a reference voltage generation circuit is designed separately [6]. The circuit diagram is shown in Figure 3. Among them, A0, A6, and A7 are the three input pins of the same group of A/D conversion channels. A0 is the input pin of the analog signal to be measured, and A6 and A7 are the input pins of the known voltage signal. In order to minimize the interference of digital circuits on analog circuits, this design separates the analog line of the ADCINxx pin from the digital signal line during PCB layout, and separates the power supply and ground connected to the power pin line of the A/D module from the digital power supply and ground.


Figure 3 A/D sampling calibration reference power supply schematic

3.3 Keyboard and digital tube drive circuit

The human-computer interaction of the weighing controller is realized through a 6-bit LED digital tube and a 3 × 4 matrix keyboard. The 10 keys in the 3 × 4 matrix keyboard correspond to the numbers 0 to 9, plus an "OK key" and a "function key". Too many digital tubes and keys will not be conducive to software control, so the digital tube driver and keyboard control chip CH451 is used to detect the keys and drive the digital tube.

CH451 is a multifunctional peripheral chip that integrates digital tube display driver and keyboard scanning control, and can be easily combined with DSP to form a system.

CH451 regularly inserts keyboard scans into the display driver scan process by multiplexing the DIGx and SEGx pins. The number of digital tubes determines the need to use 8 pins of SEG0-SEG7 and 6 pins of DIG0-5. The structure of the matrix keyboard is 3 rows and 4 columns, and the design uses 4 pins of SEG0-3 and 3 pins of DIG0-2. The DCLK, DIN, LOAD and DOUT pins are connected to the corresponding pins of F2812. The specific hardware connection diagram is shown in Figure 4.


Figure 4 CH451 interface circuit

In order to facilitate remote monitoring, the weighing controller is designed with a serial communication interface [8]. The design is completed using the two full-duplex SCI (Serial Communication InteRFace) built into the main control chip F2812.

The RS232 standard defines that the logic "1" signal is 3V to 25V relative to the ground, and the logic "0" is -3V to -25V relative to the ground. Therefore, an RS232 driver is needed to convert the level. This design uses the MAX3250 chip.

MAX3250 is a serial communication chip that supports 3.0v to 5.5v input voltage and has two serial communication capabilities. This chip is simple to use, so the circuit connection diagram is not given. [page]

4 Software Design

The software design is mainly completed in CCS software using C language. The main program flow chart is shown in Figure 5. The program mainly includes: initialization, calibration program, display program, serial communication program, parameter setting program, calculation quality program, automatic control program and other modules.


Figure 5 Main program flow chart

Software filtering is more convenient and flexible than hardware filtering. Due to performance limitations, the filtering algorithms used by traditional microcontrollers are generally limited filter, median filter, arithmetic mean filter, sliding average filter, etc.

The above method is easy to program and has low requirements on the processor. The disadvantage is that the algorithm is relatively simple and the filtering effect is not ideal. This design uses a digital filter to filter the data. The digital filter is an infinite impulse response filter designed by the filter design toolbox in MATLAB. The software filter program is called as a subroutine of the automatic control program after the weighing control starts.

In the automatic control algorithm, the aforementioned deviation value E comparison method is not used, but the fuzzy control idea is added. In addition to taking the deviation value E as a reference, the deviation change rate Δ E is also introduced into the control. When approaching the threshold of speed switching, the magnitude of the deviation change rate is considered at the same time, and the control rule table is properly compiled in combination with the actual effect, so that the discharge speed can be changed before reaching the threshold, weakening the impact of "flying material" on the control accuracy and optimizing the performance of the controller.

5 Conclusion

This design is based on the characteristics of the original batching system of glass enterprises, and provides a design method for a weighing controller. After field operation, it is known that it can fully meet the working requirements of glass batching, the controller runs fast, and the weighing accuracy is better than the original system. It fully meets the design requirements of the controller and has certain practical value. 4 Software Design

The software design is mainly completed in CCS software using C language. The main program flow chart is shown in Figure 5. The program mainly includes: initialization, calibration program, display program, serial communication program, parameter setting program, calculation quality program, automatic control program and other modules.


Figure 5 Main program flow chart

Software filtering is more convenient and flexible than hardware filtering. Due to performance limitations, the filtering algorithms used by traditional microcontrollers are generally limited filter, median filter, arithmetic mean filter, sliding average filter, etc.

The above method is easy to program and has low requirements on the processor. The disadvantage is that the algorithm is relatively simple and the filtering effect is not ideal. This design uses a digital filter to filter the data. The digital filter is an infinite impulse response filter designed by the filter design toolbox in MATLAB. The software filter program is called as a subroutine of the automatic control program after the weighing control starts.

In the automatic control algorithm, the aforementioned deviation value E comparison method is not used, but the fuzzy control idea is added. In addition to taking the deviation value E as a reference, the deviation change rate Δ E is also introduced into the control. When approaching the threshold of speed switching, the magnitude of the deviation change rate is considered at the same time, and the control rule table is properly compiled in combination with the actual effect, so that the discharge speed can be changed before reaching the threshold, weakening the impact of "flying material" on the control accuracy and optimizing the performance of the controller.

5 Conclusion

This design is based on the characteristics of the original batching system of glass enterprises, and provides a design method for a weighing controller. After field operation, it is known that it can fully meet the working requirements of glass batching, the controller runs fast, and the weighing accuracy is better than the original system. It fully meets the design requirements of the controller and has certain practical value.

Reference address:DSP Implementation in Weighing Controller Design

Previous article:Application of DSP and FPGA in automotive electronics
Next article:Design of DDS Excitation Constant Current Source Based on FPGA

Latest Embedded 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号