Software and hardware design and testing methods of displacement measurement device

Publisher:幸福约定123Latest update time:2023-10-12 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Design requirements

1.1 Task

Design and produce a displacement measurement device, the schematic diagram of which is shown in Figure 1 (the part in the dotted box can be implemented in hardware or software).

Software and hardware design and testing methods of displacement measurement device

1.2 Requirements

(1) Make a sinusoidal signal excitation circuit. The technical specifications are as follows:

①Frequency: 100kHz;

② There is no obvious distortion in the output waveform when driving a linear variable differential transformer.

(2) Design and produce differential signal measurement circuits, including linear variable differential transformers, amplification, rectification, filtering and other circuits, and data processing and display units. At two points A and B in Figure 1, DC voltage signals VA and VB are output respectively.

(3) Use analog or digital methods to calculate and display the actual displacement based on the d value.

(4) The measured displacement range is -20mm ~ +20mm, and the absolute value of the measurement error is not greater than 2mm.

(5) Design a closed-loop control circuit that requires a DC motor to drive the magnetic rod to move, control the magnetic rod to reach the set displacement, and the absolute value of the displacement error is not greater than 2mm.

2 Plan demonstration

According to the topic requirements and the design idea of ​​this system, the system mainly includes an excitation signal module, a mechanical transmission module, a signal processing module, a display module and a keyboard module. The overall block diagram of the system is shown in Figure 2.

Option 1: The excitation signal module uses the function generator chip MAX038 with high precision, high frequency, low output resistance and strong driving capability to generate a fixed frequency of 100kHz; the mechanical transmission module uses straight gears to drive the movement of the magnetic rod, which first requires motor gears. Match the teeth of the straight gear, connect the straight gear to the magnet, and drive the straight gear left and right through the circular gear of the motor, that is, drive the magnetic rod to move left and right in the sleeve; the signal processing module first passes the OP37 The signal on the secondary side of the differential transformer is amplified, and after half-wave rectification and electronic filtering, a stable DC voltage is obtained, which is sent to the AD converter inside the microcontroller for processing. After AD conversion, the voltages at points A and B are The value of d can be calculated to obtain the relationship between displacement and d, which is displayed through the digital tube. At the same time, any value within the allowable range can be set through the keyboard, and the machine can accurately run to the designated location.

Option 2: The excitation signal module uses the DDS chip AD9851, which has stable performance and reliable operation and can generate a stable frequency of 100kHz; the mechanical transmission module uses DC motor control bolts to achieve precise positioning of the ferromagnetic rod. Each time the motor rotates, it can A fixed displacement is generated, and the DC motor can be rotated a corresponding number of turns through microcontroller control to meet the design requirements; the signal processing module first achieves small signal amplification through TI's instrumentation amplifier INAll8, and then undergoes half-wave rectification and electronic Filter to obtain a stable DC voltage, which is processed by the 16-bit 8-channel AD converter ADS8344. After AD conversion, the value of d can be calculated from the voltages at points A and B, thereby obtaining the relationship between displacement and d. After passing The LCD displays, and any value within the allowable range can be set through the keyboard, and it can accurately run to the designated location. Based on the above two options, we adopt option two.

3 Software and hardware design

3.1 Hardware design

This system mainly consists of a DDS module, a broadband low-distortion fully differential amplification module, an energy coupling module of a linear variable differential transformer, an amplification rectifier filter module, and a human-machine interface composed of a 4×4 keyboard and a 128×64 LCD module. The system structure block diagram is shown in Figure 3:

(1) Excitation circuit module

The excitation circuit part sends the control word to AD985l through the microcontroller, and then the low-pass filter filters out the harmonic components and spurious signals to obtain a relatively pure 100kHz sine wave signal. The generated signal forms an excitation signal through a differential circuit, which is implemented using THS4503.

(2) Measurement circuit module

The magnetic rod of the linear variable transformer is a ferromagnetic rod. The coil is wound on a frame made of plastic pipe with 0.13mm enameled wire. The magnetic rod and the coil are contained by an insulating plastic pipe with a larger diameter. . The entire module is fixed on a wooden board; the differential output signal is coupled to L2 and L3 through the magnetic rod through Ll of the linear variable differential transformer, and then the microcontroller controls the forward and reverse rotation of the motor to push the magnetic rod up and down, causing L2 and L3 to move up and down. The voltages of the two signals have corresponding deviations relative to the amplitudes at the center point (where the voltage amplitudes of the two signals are equal and opposite in phase). Since the amplitude of the obtained voltage difference is very small, it is necessary to use a high-precision instrumentation amplifier INA118 to amplify and then process the signal. After half-wave rectification, AC is converted into DC. After rectification, there is mainly power frequency interference, and an n-shaped filter circuit is used to filter the harmonics; the motor drive magnet part adopts the matching principle of motor gear and screw gear, and uses a single-chip microcomputer to control the forward and reverse rotation of the motor to drive the nut to move up and down. The magnetic rod and screw gear are contained by insulating materials, and the magnitude of the coupling energy is controlled by the change of the magnetic flux when the magnetic rod moves in the coil, thereby controlling the amplitude of the output voltage. Before the specific measurement, first mark a zero point on the insulating board. The zero point must be carried out under the condition that the amplitude of the voltage to ground at both ends of L2 and L3 is equal and the phase is opposite and the structure is strictly symmetrical.

(3) Data processing module

After INAll8 amplification, half-wave rectification and electronic filtering, the two voltages are AD sampled by the ADS8344 chip and then converted into digital quantities and stored in the microcontroller. First, the calculation of the d value is implemented through software, and then the displacement is calculated based on the actual measured value. . The entire calculation process is completely implemented in software.

(4) Display module

The display part adopts LCD display. LCD can dynamically display Chinese characters and characters, and has a large display range, which can well realize human-computer interaction interface.

3.2 Software design

The software-controlled parts of the system include the sine wave signal generation and data processing modules. First, the microcontroller uses a serial method to send a 40-bit control word to the AD985l in order to generate the stable 100kHz sine signal required by the question. The data processing part is also completely implemented in software. First, the two voltages are sampled separately, and the ADS8344 is controlled by the microcontroller to collect the voltage values ​​of VA and VB, and the converted digital quantities are sent back to the microcontroller for data processing. Since the amplitude range of AD sampling is limited, we can adjust its voltage value through amplification so that we can collect the corresponding amplitude. The program flow chart is shown in Figure 4:

4 tests

4.1 Instruments used for debugging and testing

Vernier caliper, DS1062C digital oscilloscope, DT930FD digital multimeter, HHl641 function signal generator.

4.2 Test methods

4.2.1 Module testing

In order to improve debugging efficiency, we first test each module of the hardware system separately, and then debug the whole machine after adjustment.

4.2.2 Overall system debugging

The hardware modules and corresponding software are tested as a whole system. According to the design requirements, the output frequency, the peak-to-peak value of the output voltage, and the maximum and minimum displacement of the magnetic rod moving up and down are tested respectively.

When testing the maximum and minimum displacement of the magnetic bar moving up and down, adjust the rotation angle of the motor so that the maximum and minimum displacement of the magnetic bar can meet the requirements of the question.

4.3 Analysis of test results

This system realizes the function of precise step displacement and voltage measurement. It uses a motor to drive the screw, and the number of rotations can be changed through keyboard input to achieve a certain displacement offset. However, there are still certain limitations in terms of higher accuracy, especially in the filtering part, which can continue to be completed.


Reference address:Software and hardware design and testing methods of displacement measurement device

Previous article:Testing the L80C186-10 on the DIC-8032 integrated circuit test system
Next article:ESP8266 automatic download circuit design plan

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