Linear displacement measuring device and method based on capacitance sensing

文档序号:1902748 发布日期:2021-11-30 浏览:25次 中文

阅读说明:本技术 一种基于电容感测的直线位移测量装置及方法 (Linear displacement measuring device and method based on capacitance sensing ) 是由 黄健 于 2021-09-01 设计创作,主要内容包括:本发明公开了一种基于电容感测的直线位移测量装置及方法,利用电容感测原理,上、下各放一个金属薄片,间隔固定的距离。下面的薄片固定不动,当上层金属薄片移动时,上、下两个金属薄片的重合面积将会发生变化,会导致金属薄片上的寄生电容发生改变。用高精度、数字式电容数字检测器FDC2214感知这种微弱变化,将其转换为高达28位二进制数的数字量输出。然后采用硬件抗尖峰滤波和软件抗尖峰滤波算法,通过微处理器进行计算后得到准确的位移信息。本发明解决了现有直线测量技术中量程和精度无法兼顾的难题,克服现有测量技术复杂、加工难度大等缺点,实现对移动物体的精密位移测量。(The invention discloses a linear displacement measuring device and method based on capacitance sensing. The lower sheet is fixed, and when the upper layer metal sheet moves, the overlapping area of the upper and lower metal sheets will change, which will cause the parasitic capacitance on the metal sheets to change. This weak change is sensed by a high precision, digital capacitive digital detector FDC2214, which converts it to a digital quantity output up to a 28-bit binary number. And then, calculating by a microprocessor by adopting a hardware anti-spike filtering algorithm and a software anti-spike filtering algorithm to obtain accurate displacement information. The invention solves the problem that the measuring range and the precision can not be considered in the existing straight line measuring technology, overcomes the defects of complex measuring technology, large processing difficulty and the like, and realizes the precision displacement measurement of moving objects.)

1. A linear displacement measuring device based on capacitance sensing, comprising: the device comprises a variable capacitor, an inductor (4), a capacitor (5), a capacitance digital detector (6) and a microprocessor (7); the variable capacitor, the inductor (4) and the capacitor (5) are all connected in parallel on the capacitance digital detector (6) and are all grounded; the capacitance digital detector (6) is connected with the microprocessor through an IIC interface; and the microprocessor is connected with the intelligent terminal through a serial port.

2. The capacitance sensing-based linear displacement measurement device of claim 1, wherein the variable capacitor comprises: a first metal sheet (1), a second metal sheet (2) and a fiber board (3); the fiberboard (3) is arranged between the inner sides of the first metal sheet (1) and the second metal sheet (2); the outer sides of the first metal sheet (1) and the second metal sheet (2) are respectively connected with two ends of the inductor (4) and two ends of the capacitor (5).

3. The linear displacement measuring device based on capacitance sensing of claim 2, wherein the first metal sheet (1) and the second metal sheet (2) are both single-sided copper-clad plates; the fiber board (3) is a glass fiber board, and the dielectric constant is 4.5; the fiberboard (3), the first metal sheet (1) and the second metal sheet (2) have the same area.

4. Capacitive sensing based linear displacement measuring device according to claim 3, characterized in that the second foil (2) is fixed in position and the first foil (1) is parallel displaceable from the leftmost end to the right.

5. The capacitive sensing based linear displacement measuring device according to claim 1, characterized in that the capacitive digital detector (6) employs an FDC2214 capacitive sensing sensor.

6. The capacitance sensing-based linear displacement measuring device according to claim 1, wherein the microprocessor (7) employs an STM32H743IIT6 single chip microcomputer.

7. A linear displacement measurement method based on capacitance sensing is characterized by comprising the following steps:

s1, carrying out data monitoring on the variable capacitor through the capacitance digital detector (6), and collecting the monitored data by adopting the microprocessor (7);

s2, initializing timers in the capacitance digital detector (6), the IIC interface and the microprocessor (7);

and S3, reading the numerical value of each channel of the capacitance digital detector (6) by adopting the initialized IIC interface, removing interference through a peak filtering algorithm, analyzing and processing the filtered monitoring data by adopting the microprocessor (7), and calculating to obtain horizontal displacement data.

8. The linear displacement measurement method based on capacitance sensing according to claim 7, wherein the S1 is specifically:

s1.1, carrying out data monitoring on the oscillating circuit through a capacitance digital detector (6), and calculating to obtain the oscillating frequency variation range of the oscillating circuit;

s1.2, calculating the reference working frequency of the capacitance digital detector (6);

s1.3, based on the S1.1-S1.2, carrying out numerical value conversion on the oscillation frequency of the oscillation circuit to obtain a 28-bit binary number range corresponding to the variation range of the oscillation frequency;

s1.4, the microprocessor (7) carries out data acquisition on the converted 28-bit binary number range through an IIC interface.

9. The capacitive sensing based linear displacement measurement method according to claim 7, wherein initializing the capacitive digital detector (6) comprises: setting register configuration, IIC interface connection relation and spike filtering processing.

10. The linear displacement measurement method based on capacitance sensing according to claim 7, wherein the S3 further comprises:

initializing a serial port and an SPI (serial peripheral interface), sending the filtered monitoring data to a cloud end through the initialized serial port for data analysis, drawing a curve and displaying the curve on a display screen; then obtaining a linear relation between the measured value and the linear displacement distance according to the drawn curve; and finally, obtaining linear displacement distance information according to the linear relation.

Technical Field

The invention relates to the field of linear displacement detection, in particular to a linear displacement measuring device and method based on capacitance sensing.

Background

With the rapid development of electronic information technology and intelligent manufacturing technology, linear displacement measurement has become one of the important requirements in the measurement field, and not only needs to pursue the performance of large size, high precision and the like, but also needs to consider the factors of cost, processing and installation complexity and the like.

The currently common linear displacement measurement methods include: optical measurement methods, magnetic field measurement methods, metal strain gauge measurement methods, and the like. The laser interferometer (optical measurement method) can measure within 5 meters, the precision reaches 1nm, but the laser interferometer is greatly influenced by objective light and is expensive in manufacturing cost. The metal strain gauge (metal strain gauge measuring method) is based on the piezoelectric resistance principle, and can measure linear displacement, but is greatly influenced by temperature. The magnetic field type measurement method utilizes a traveling wave magnetic field generated by a magnetizer cutting magnetic lines to measure, but requires to establish a constant-speed motion coordinate system, and the constant speed of the object is just a difficulty, and the non-constant speed motion brings great errors. The method needs to process a large amount of data, and has the advantages of high algorithm complexity, low recognition rate, complex equipment and high cost.

Therefore, a measurement method which can solve the problem that the measurement range and the precision cannot be considered at the same time and overcome the defects of complex measurement technology, high processing difficulty and the like is called as a hot topic nowadays.

Disclosure of Invention

The invention aims to provide a linear displacement measuring device and method based on capacitance sensing, which solve the problem that the measuring range and the precision cannot be considered simultaneously in the existing linear measuring technology, overcome the defects of complexity, high processing difficulty and the like of the existing measuring technology, and realize the precision displacement measurement of a moving object.

In order to achieve the above object, the present invention provides a linear displacement measuring device based on capacitance sensing, comprising: variable capacitors, inductors, capacitors, capacitance digital detectors and microprocessors; the variable capacitor, the inductor and the capacitor are all connected in parallel on the capacitance digital detector and are all grounded; the capacitance digital detector is connected with the microprocessor through an IIC interface; and the microprocessor is connected with the intelligent terminal through a serial port.

Preferably, the variable capacitor includes: a first metal sheet, a second metal sheet, a fiber board; the fiberboard is arranged between the inner sides of the first metal sheet and the second metal sheet; the outer sides of the first metal sheet and the second metal sheet are respectively connected with two ends of the inductor and two ends of the capacitor.

Preferably, the first metal sheet and the second metal sheet are both single-sided copper-clad plates; the fiber board is a glass fiber board, and the dielectric constant is 4.5; the fiberboard, the first metal sheet and the second metal sheet are the same in area.

Preferably, the second foil is fixed in position and the first foil is capable of parallel movement from the leftmost end to the right.

Preferably, the capacitive-digital detector employs an FDC2214 capacitive sensing sensor.

Preferably, the microprocessor adopts an STM32H743IIT6 singlechip.

A linear displacement measurement method based on capacitance sensing specifically comprises the following steps:

s1, monitoring data of the variable capacitor through the capacitance digital detector, and collecting the monitored data by adopting a microprocessor;

s2, initializing the capacitor digital detector, the IIC interface and a timer in the microprocessor;

and S3, reading the numerical value of each channel of the capacitance digital detector by adopting the initialized IIC interface, removing interference by adopting a peak filtering algorithm, analyzing and processing the filtered monitoring data by adopting the microprocessor, and calculating to obtain horizontal displacement data.

Preferably, the S1 is specifically:

s1.1, carrying out data monitoring on the oscillating circuit through a capacitance digital detector, and calculating to obtain the oscillating frequency variation range of the oscillating circuit;

s1.2, calculating the reference working frequency of the capacitance digital detector;

s1.3, based on the S1.1-S1.2, carrying out numerical value conversion on the oscillation frequency of the oscillation circuit to obtain a 28-bit binary number range corresponding to the variation range of the oscillation frequency;

and S1.4, the microprocessor acquires data in the converted 28-bit binary number range through the IIC interface.

Preferably, initializing the capacitance-to-digital detector comprises: setting register configuration, IIC interface connection relation and spike filtering processing.

Preferably, the S3 further includes:

initializing a serial port and an SPI (serial peripheral interface), sending the filtered monitoring data to a cloud end through the initialized serial port for data analysis, drawing a curve and displaying the curve on a display screen; then obtaining a linear relation between the measured value and the linear displacement distance according to the drawn curve; and finally, obtaining linear displacement distance information according to the linear relation.

Compared with the prior art, the invention has the following technical effects:

according to the invention, by utilizing a capacitance sensing principle, one metal sheet is respectively placed at the upper part and the lower part at a fixed interval, the lower sheet is fixed, and when the upper layer metal sheet moves, the superposed area of the upper metal sheet and the lower metal sheet changes, so that the parasitic capacitance on the metal sheets changes. This weak change is sensed by a high precision, digital capacitive digital detector FDC2214, which converts it to a digital quantity output up to a 28-bit binary number. And then, a hardware anti-peak filtering algorithm and a software anti-peak filtering algorithm are adopted, accurate displacement information is obtained after calculation is carried out through a microprocessor, the problem that the measuring range and the precision cannot be considered in the existing linear measurement technology is solved, the defects of complexity, high processing difficulty and the like in the existing measurement technology are overcome, and the precise displacement measurement of the moving object is realized.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.

FIG. 1 is a schematic structural diagram of an apparatus according to an embodiment of the present invention;

FIG. 2 is a flow chart of a method of an embodiment of the present invention;

FIG. 3 is a schematic structural diagram of a variable capacitor according to an embodiment of the present invention;

FIG. 4 is a schematic diagram of a capacitance sensing circuit according to an embodiment of the invention;

FIG. 5 is a schematic diagram of a single channel data acquisition embodiment of the present invention;

FIG. 6 is a clock diagram of capacitive-to-digital detector FDC2214 in an embodiment of the present invention;

FIG. 7 is a timing diagram illustrating an embodiment of an IIC read data;

FIG. 8 is a pictorial view of an apparatus according to an embodiment of the present invention;

FIG. 9 is a measurement at any point of an embodiment of the present invention;

FIG. 10 is a histogram of arbitrary points for an embodiment of the present invention;

FIG. 11 is a graph comparing pre-and post-filtering waveforms according to an embodiment of the present invention; wherein, (a) the waveform prior to filtering; (b) is a waveform diagram after filtering;

FIG. 12 is a histogram comparison before and after filtering according to an embodiment of the present invention; wherein, (a) the histogram before unfiltered; (b) is a filtered histogram;

FIG. 13 is a waveform of a 1.4cm continuous acquisition interval for an embodiment of the present invention;

FIG. 14 is a graph of the mean values at intervals of 1.4cm for an embodiment of the present invention;

FIG. 15 is a waveform of a 5cm interval continuous acquisition according to an embodiment of the present invention;

FIG. 16 is a graph of 5cm mean interval curves for an embodiment of the present invention;

FIG. 17 is a waveform of a 7cm interval continuous acquisition according to an embodiment of the present invention;

FIG. 18 is a graph of 7cm mean interval curves for an embodiment of the present invention;

in the figure, 1-first metal sheet, 2-second metal sheet, 3-fiber board, 4-inductance, 5-capacitance, 6-capacitance digital detector, 7-microprocessor.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.

Example 1

Referring to fig. 1, the present invention provides a linear displacement measuring device based on capacitance sensing, including: a variable capacitor, an inductor 4, a capacitor 5, a capacitance digital detector 6 and a microprocessor 7; the variable capacitor, the inductor 4 and the capacitor 5 are all connected in parallel on the capacitance digital detector 6 and are all grounded; the capacitance digital detector 6 is connected with the microprocessor through an IIC interface; and the microprocessor is connected with the intelligent terminal through a serial port.

Wherein the variable capacitor includes: a first metal sheet 1, a second metal sheet 2, a fiber board 3; the first metal sheet 1 and the second metal sheet 2 are arranged up and down at a fixed interval, and a fiber board 3 is arranged between the inner sides of the first metal sheet and the second metal sheet; the position of the lower second metal sheet 2 is fixed, the upper first metal sheet 1 can move in parallel along a straight line from the leftmost end to the right, and when the upper metal sheet moves, the overlapping area of the upper metal sheet and the lower metal sheet changes, which causes the parasitic capacitance on the variable capacitor to change. The outer sides of the first metal sheet 1 and the second metal sheet 2 are respectively connected with two ends of an inductor 4 and a capacitor 5.

The metal sheets selected by the invention are single-sided copper-clad plates, and are 15cm long, 10cm wide and 35um thick; the fiber board 3 is a glass fiber board with the thickness of 1.4cm and the dielectric constant of 4.5; the fiberboard (3), the first metal sheet (1) and the second metal sheet (2) have the same area.

The invention is based on a non-contact capacitance sensing technology, two single-sided copper-clad plates are placed together in an opposite mode, the middle of the two single-sided copper-clad plates are isolated by an insulating layer, and the spacing distance is fixed. The lower copper-clad plate is fixed and does not change, the upper copper-clad plate can move along a straight line, the superposed areas of the upper surface and the lower surface are different in different positions, and the size of the parasitic capacitance generated on the copper-clad plate can change. Because the change is weak, the invention adopts an FDC2214 capacitance digital detector to sense the weak change, converts the weak change into a digital quantity of a binary number of up to 28 bits, and outputs the digital quantity to a high-performance embedded microprocessor STM32F103ZET6 for data processing through an SDA (data line) and an SCL (clock line) of an IIC interface to obtain accurate linear displacement information.

The FDC2214 capacitance digital detector is a novel capacitance digital detector of TI company, and has the following characteristics: (1) an anti-electromagnetic interference (EMI) architecture; (2) the highest output rate of the IIC interface is 13.3 KSPS; (3) maximum input capacitance: 250nF (10kHz frequency, 1mH inductance) (4) sensor excitation frequency: 10kHz to 10 MHz; (5) the number of channels is 4; (6) resolution ratio: up to 28 bits; (7) root Mean Square (RMS) noise: 0.3fF (100SPS, and f)Sensor with a sensor elementAt 5 MHz); (8) power supply voltage: 2.7V to 3.6V; (9) power consumption: 2.1mA (active). FDC2214 is a non-contact sensing technology with low power consumption, low cost and high resolution, and is suitable for various applications such as proximity detection, gesture recognition, water level detection and the like. The high-precision FDC2214 capacitance digital detector is utilized to sense the weak change, and the weak change is converted into high-precision digital quantity to be output, so that the measurement precision is improved.

Based on this, referring to fig. 2, the present invention provides a method for measuring linear displacement based on capacitance sensing, which specifically includes the following steps:

s1, monitoring data of the variable capacitor through the capacitance digital detector 6, and collecting the monitored data by the microprocessor 7;

wherein, the calculation expression of the capacitance is as follows:

wherein A represents the area of one plate electrode and the unit is m2(ii) a d represents the distance between the plates in m; c is capacitance, and the unit is F; ε is the dielectric constant with respect to air. In addition, the relative dielectric constants of common dielectrics are shown in table 1:

TABLE 1

From the equation (1), the capacitance C is proportional to the dielectric constant ∈ and the area a of the plate electrodes, and inversely proportional to the distance d between the plate electrodes. For the linear displacement detection device, the dielectric constant and the distance are fixed, and at the moment, the variable capacitor can be obtained only by changing the contact area A between the two single-sided copper-clad plates.

Referring to fig. 3, the metal sheets selected by the invention are all single-sided copper-clad plates, and have the length of 15cm, the width of 10cm and the thickness of 35 um; the fiber board 3 is a glass fiber board, the thickness d is 1.4cm, and the dielectric constant is 4.5; the above parameters are substituted into formula (1), so as to obtain the size of the capacitor C, as shown in formula (2):

that is, C is 2.845 × 10-9×A…………(2)

In the formula (2), C is the capacitance, and A is the overlapping area of the upper copper-clad plate and the lower copper-clad plate; as can be seen from the formula (2), the capacitance C is proportional to the overlapping area a of the two single-sided copper-clad plates. When the first copper-clad plate moves from the leftmost end to the right in parallel, 1um is moved every time, the overlapped area of the upper copper-clad plate and the lower copper-clad plate is increased by 10cm by 15cm by 1um every time, and the increased capacitance C + is as shown in formula (3):

C+=2.845×10-10×10×10-2×15×10-2×1×10-6

i.e., C + 4.267 × 10-17…………(3)

In formula (3), C + is the capacitance value of the first copper-clad plate that changes after each parallel movement of 1 um.

Since a variable capacitance value is generated during such continuous movement, the capacitance capacity is also continuously increased as the overlapping area is increased. When the overlapping area is changed from 0 to 10cm 15cm at maximum, the change range of the capacitance is 0 to 4.267 x 10-11If 1um is stepped each time, the capacitance changes 4.267 x10 each time-17. Therefore, the present invention adoptsThe high-precision FDC2214 capacitance digital detector senses the weak change and converts the weak change into high-precision digital quantity output.

Referring to fig. 4, when FDC2214 is used to detect the change in the external capacitance, 4 channels, each of which is 0 to 3, are used, and the operation principle of each channel is the same as that of Cap Sensor0 to Cap Sensor3 in fig. 4, and fig. 5 illustrates the operation principle of FDC2214 for detecting the change in the capacitance of the variable capacitor by taking channel 0 as an example.

C in FIG. 5xThe capacitor is a variable capacitor, and is a parasitic capacitor generated by the variable capacitor to a virtual ground, and the parasitic capacitor is connected with C, L in parallel to form an oscillating circuit; wherein, CxThe variation range of (A) is calculated by the formula (2), and the value range of A in the formula (2) is from 0 to 0.015m2Thus CxFrom 0 to 4.267 x10-11

Then, the oscillation frequency f of the oscillation circuit is calculatedsThe expression is as follows:

in the formula (4), l is inductance and takes the value of 18 uH; c is capacitance and takes the value of 33 pF; cxIs a parasitic capacitance; f. ofsIs the oscillation frequency of the oscillating circuit. As can be seen from equation (4), after l is fixed at 18uF and C is fixed at 33pF, the oscillation frequency fsAnd CxThe square root of (a) is inversely proportional. The parameters l, C and C are combinedxSubstituting into formula (4) to calculate fsIs in the range of 0-6.5335MHz.

In practical measurements, the reference operating frequency of the capacitive-digital detector FDC2214 is set, and is expressed as:

in the formula (3), frefIs a reference frequency; f. ofclkIs the number of capacitorsThe input frequency of the word detector FDC2214 is increased by connecting the FDC2214 with a 40MHz active crystal oscillator for improving the acquisition rate and accuracy. CHx _ FREF _ DIVIDER is f after frequency division by selecting two division factorsrefIs 20 MHz;

finally, dividing the frequency frefAnd converting the digital quantity output into a binary number with 28 bits, wherein the expression is as follows:

in the formula (4), frefThe reference frequency after frequency division is 20 MHz; f. ofsIs the oscillation frequency, DATA, of the oscillating circuitxIs the corresponding 28-bit binary number after conversion. Thus, after the channel 0 detects a weak capacitance change, the weak change of the external parasitic capacitance is converted into a binary digital quantity of up to 28 bits inside the FDC2214, and then the binary digital quantity is output to the high-performance embedded microprocessor STM32F103ZET6 for acquisition processing through the SDA (data line) and SCL (clock line) of the IIC interface. (the working principle of the other 3 channels is the same as that of channel 0, and the description is omitted here.)

S2, initializing the FDC2214, the IIC interface and a timer in the microprocessor 7;

when the IIC is initialized, the pin of an SDA of the IIC interface data line is PB11 of STM32F103ZET6, and the pin of an SCL of the IIC interface clock line is PB10 of STM32F103ZET 6. Then, the IIC initialization is completed after the device ID number 0x3055 of the FDC2214 is successfully read in the time sequence shown in fig. 7. And configures the FDC2214 internal registers in detail.

After the front end acquires the changing capacitance, it is processed internally in the FDC2214, as shown in fig. 6. For each channel, a corresponding register is configured.

Taking channel 0 as an example, first, CH0_ FIN _ SEL (0x14) is configured, as shown in Table 2:

TABLE 2

CH0_ FIN _ SEL is used to set the acquisition frequency range for channel 0. According to fsIs 0-6.5335MHz, so CH0_ FIN _ SEL in table 2 can be configured as 01: 0.01MHz to-8.75 MHz. In fig. 6, not only the sampling frequency CH0_ FIN _ SEL but also the reference clock division coefficient CH0_ FREF _ divder for channel 0 are to be configured, since the input clock tclkin of the entire design is 40MHz, CH0_ FREF _ divder in table 2 is set to 0000000010 for tclkinAnd (3) frequency division is carried out by 2, the reference working frequency of the capacitance digital detector FDC2214 is calculated by adopting a formula (5), and the FDC2214 is externally connected with a 40MHz active crystal oscillator for improving the acquisition rate and the accuracy. CHx _ FREF _ DIVIDER is f obtained by selecting a frequency division coefficient to divide by two and calculatingrefIs 20 MHz;

the CHx _ FREF _ DIVIDER value in the formula is CH0_ FREF _ DIVIDER, and f is obtained after calculationrefThe clock frequency of (2) is 20 MHz. The configuration of the final channel 0 register CLOCK _ DIVIDERS _ CH0 is 0001000000000010, i.e., 0x 1002.

MUX _ CONFIG (0x1B) is next configured, as shown in table 3:

TABLE 3

First, RR _ SEQUENCE is set to 10, and channels 0, 1, 2, and 3 of the transition are selected. AUTOSCAN _ EN is set to 1 and the 4 channels are scanned consecutively. The DEGLITCH is selected to be 101, filtered after being greater than the oscillation frequency by 10MHz bandwidth, and the others are default values. The final MUX _ CONFIG register value is 1100001000001101, i.e., 0xc20 d. In this way, anti-spike filtering is employed in the detection device, and software anti-spike filtering algorithms continue to be used in subsequent microprocessor settings to ensure the smoothness of the acquired signals.

The CONFIG register is set as follows, as shown in table 4:

TABLE 4

Because MUX _ config.rr _ SEQUENCE is set to 10 in table 3, ACTIVE _ CHAN is default 00, SLEEP _ MODE _ EN is 0, and normal operation MODE is set to sense _ ACTIVE _ SEL being 1, which is the normal operation MODE;

REF _ CLK _ SRC ═ 1, external active crystal oscillator 40MHz is selected, INTB _ DIS ═ 1, non-interrupt mode, HIGH _ CURRENT _ DRV ═ 0, normal operating mode, and the rest set as default values. The configuration of the final CONFIG register is 0000001010000001, i.e., 0x 0281.

After the register of the FDC2214 is configured, the FDC2214 can convert the weak capacitance variation Cx in the channel 0 into the variation frequency fs through a formula (4); then the reference working frequency of the capacitive digital detector FDC2214 is set through formula (5); wherein CHx _ FREF _ DIVIDER is a frequency division coefficient, and x can be 0, 1, 2, 3, which respectively represents channels 0, 1, 2, 3. Setting method as described with reference to table 2, for channel 0, the setting value is 0000000010, achieving a frequency division of two. After frequency division frefIs 20 MHz. The remaining channels are the same as this calculation. Finally, this varying frequency will be converted to a 28-bit digital output according to equation (6), where DATAxIs a 28-bit binary number corresponding to the converted signal, and x can be 0, 1, 2, 3, which respectively represents channels 0, 1, 2, 3. F is calculated by equation (4)sIs in the range of 0-6.5335MHz and is measurable in equation (6)Calculating DATAxIs in the range of 0-87691152. Therefore, the weak change of the external parasitic capacitance can be converted into binary number output of 28 bits, and the IIC interface can be connected with various microprocessors for acquisition and processing.

And S3, reading the numerical value of the FDC2214 channel 0 by using an IIC interface, removing interference by using a peak filtering algorithm, analyzing and processing the filtered monitoring data by using the microprocessor 7, and calculating to obtain horizontal displacement information.

The microprocessor reads the 28-bit binary system of the FDC2214 by adopting a standard IIC interface and following a standard IIC read-write protocol. In fig. 7, a timing chart of IIC read data is shown, and in order to increase the stability and reliability of data transmission, pull-up resistors with a resistance of 10K Ω are connected to SDA and SCL. Meanwhile, in order to reduce power supply interference, two filter capacitors are connected near 3.3V, wherein the two filter capacitors are respectively 0.1uF and 1 uF. The SCL issues successive clock signals and the SDA issues address, data or control signals in each different cycle. In fig. 7 the SDA first issues 7-bit addresses a0-a6, waits for slave replies, and upon success, reads 16-bit data D0-D15.

When STM32F103ZET6 communicates with FDC2214, the ID number of slave FDC2214 is 0x3055 when read correctly, the 32-bit transform values for channel 0-channel 3 can be read via Table 5. And stored as a 28-bit binary number after processing. The internal register table 5 corresponding to the channels 0-3 is shown.

TABLE 5

It can be seen from table 5 that each channel has 16 upper bits and 16 lower bits, which can store a total 32-bit binary number, and actually, the effective bit has only 28 bits, which can be implemented in a low alignment manner, i.e., the 16 lower bits and the 12 upper bits are combined into 28 lower bits, taking channel 0 as an example, and the following codes are used in the software processing.

((DATA_CH0&Ox0FFF)<<16)|(DATA_LSB_CHO)

That is, the logical AND operation is performed on the value in the high 16 bits DATA _ CH0 of the channel 0 and 0x0FFF, the high 4-bit value is cleared, the obtained 12-bit binary number is shifted to the left by 16 bits, and then the logical OR operation is performed on the value in the low 16 bits register DATA _ LSB _ CHO to obtain a 28-bit binary number.

Secondly, in data acquisition, the measured values are inaccurate due to the presence of interference. Therefore, a software filtering process is necessary, and a specific software filtering algorithm is described below: through hardware filtering at the front end, setting the RR _ SEQUENCE in the register MUX _ CONFIG (0x1B) to 10, selecting the DEGLITCH to 101, and performing hardware spike filtering when the oscillation frequency is greater than 10MHz bandwidth. When the data is collected and processed by software, the data interference is small. But there are also interferences present, so software filtering (using spike filtering algorithms) is also performed.

When the displacement measurement is carried out, the measured value is fixed for a fixed position, and if the measured value is subjected to severe jump, the measured value is filtered by a peak filtering algorithm. The specific algorithm is as follows:

step 1: for each measurement, a plurality of points are acquired.

Step 2: and comparing the difference values of the adjacent values to estimate the change range of the difference values in the whole measuring process.

And step 3: find out the point that the difference changes and exceeds the range of variation n (generally greater than 10) times, remove it.

And 4, step 4: and (4) repeating the steps 2-3, and gradually reducing the value of n until the data curve is smooth.

After multiple times of filtering, all peaks in the whole curve can be filtered out, and the smoothness of data is guaranteed.

The invention can also initialize a serial port, an SPI interface and the like, wherein the SPI interface is used for connecting the STM32F103ZET6 and the display screen, and the horizontal displacement information obtained after measurement and calculation is displayed. The information can also be sent to a computer through a serial port and analyzed and processed under MATLAB, so that the test is convenient.

The MATLAB software compiling environment is KEIL5.0, and the program is written in C language. After the compilation is passed, the program is downloaded to the STM32H743IIT6 processor chip for testing.

The software compiling environment is KEIL5.0, and the program is written in C language. After the compilation is passed, the program is downloaded into the STM32F103ZET6 processor chip for testing.

After the device of the present invention was debugged and the program was written, a test sample was produced as shown in fig. 8. The microprocessor in fig. 8 is an STM32F103ZET6 module, the middle is an FDC2214 module, and the display screen is a 1.44-inch true color liquid crystal screen, and is connected with an SPI interface with an STM32F103ZET 6. The thin copper plate is a 15 cm-10 cm single-sided copper-clad plate, is divided into an upper copper plate and a lower copper plate, is aligned and overlapped, the upper copper plate is moved, the overlapping area of the upper copper plate and the lower copper plate can be changed, and the moving distance is measured by a vernier caliper.

During testing, the upper copper plate and the lower copper plate are as shown in fig. 8, one overlapping position is selected at will, the STM32F103ZET6 is used for reading the converted 28-bit data, the data is sent to a computer through a serial port, and the data is analyzed under MATLAB to obtain a curve as shown in fig. 9.

As can be seen from fig. 9, the measured values are mostly distributed at 6.9 x107-6.97*107But there is some spike interference. The data is further analyzed and the probability density of the occurrence of different values is counted to obtain a histogram as shown in fig. 10.

As can be seen from FIG. 10, there were a total of 3942 measurements, with the leftmost highest column totaling 2160, ranging from 6.9 x107-6.93*107The proportion is 54.8%; secondly, the value range is from 6.93 to 107-6.97*1071730 total, the proportion is 43.8%; the remaining points are 52, and the proportion is 1.4%.

As can be seen from fig. 9 and 10, the spike data with abrupt change obviously exists, and the above-mentioned anti-spike filtering algorithm is adopted to perform multiple filtering to obtain the waveform shown in fig. 11, and the waveform before filtering (fig. 11(a)) and the waveform after filtering (fig. 11(b)) are compared, so that the filtering effect of the invention is obvious, and most of the convex spike signals are removed.

Statistical analysis of the waveforms shown in FIG. 11 was then performed to obtain the histogram shown in FIG. 12. Fig. 12(a) shows the same graph as fig. 10, and fig. 12(b) shows the post-filtering histogram. As can be seen from FIG. 12, there are 3900 points in total, consisting of 2 segments, each of which has 2240 columns in total, and the range of values is 6.91 x107-6.93*107The proportion is 56.1%; secondly, the value range is from 6.93 to 107-6.95*1071660 accounts for 43.9%; compared with the waveform without filtering in fig. 12(a), 42 peak signals are removed, the interference signal is effectively removed, and the filtering effect is obvious.

And finally, solving the average value of the 3900 filtered data to serve as the acquired data value corresponding to the current position.

By using the filtering algorithm, the data of different points on the linear displacement can be continuously acquired. For the 15cm x10 cm single-sided copper-clad plate shown in fig. 8, the upper and lower parts are aligned and overlapped, and are the starting 0 point, the starting 0 point is separated by a glass fiber plate with the thickness of 1.4cm, the upper copper plate 1um is moved each time, 350 points are collected at each position, and 301 points are obtained after filtering processing. The 8um data was collected continuously, resulting in the waveform shown in fig. 13.

As can be seen from fig. 13, after the filtering process, the measured value at each position remains horizontal, and as the distance increases, the whole data increases regularly, and presents a regular trapezoid, the value range is 2400-.

As can be seen from fig. 14, the distance and the measured value have a linear relationship, and the relationship shown in formula (7) is obtained by fitting the linear relationship.

y=288.6×x+2164…………(7)

As can be seen from equation (7), the distance and the measured value exhibit a good linear relationship. After the measured value of any point in the range of 8um is obtained, the corresponding position value can be obtained through a formula (7), and the range of 1um of the interval is further subdivided, so that the precision can reach 10 nm.

The distance between the upper and lower copper plates was further increased, and the copper plates were separated by 5 cm-thick teflon, and the area of the copper plate was kept constant, to obtain data as shown in fig. 15.

It can be seen from fig. 15 that, after the distance is increased, the value range is from 4000-.

The slope shown in fig. 16 is fitted to obtain a linear relationship as shown in equation (8).

y=174.9×x+3926…………(8)

As can be seen from equation (8), the measured distance and the measured value show a linear relationship.

The areas of the upper and lower copper clad laminates were increased to 20cm by 30cm, and separated by a 7cm thick cardboard to obtain the data shown in fig. 17. As can be seen from FIG. 17, after increasing the distance, the value ranges from 2900-.

The slope shown in fig. 18 is fitted to obtain a linear relationship as shown in equation (9).

y=16.85×x+2928…………(9)

It can be seen from equation (9) that the measured distance and the measured value are still linear in the first order.

The test result shows that: the method can be used for rapidly detecting the linear displacement of the moving object, the precision in the 8um measurement range reaches 10nm, and the theoretical measurement precision reaches 1 nm.

In conclusion, the invention solves the problem that the measuring range and the precision can not be considered in the existing straight line measuring technology, overcomes the defects of complex measuring technology, high processing difficulty and the like, and realizes the precise displacement measurement of the moving object. Meanwhile, the invention collects a large amount of measurement data and carries out hardware and software spike filtering on the measurement data, thereby effectively removing interference and ensuring the smoothness of the measurement data. Through a large number of experiments, the linear relation between the linear displacement and the measured value is determined, and the fact that the linear displacement can be accurately measured is verified. The range can be further enlarged if the copper plate is selected properly. The whole system has the advantages of simple hardware circuit, strong anti-interference capability, high recognition rate, high precision, low cost and the like, has certain practical value, and can be used for measuring the linear displacement of the machined part of the machine tool or precisely measuring other linear displacements.

The above-described embodiments are merely illustrative of the preferred embodiments of the present invention, and do not limit the scope of the present invention, and various modifications and improvements of the technical solutions of the present invention can be made by those skilled in the art without departing from the spirit of the present invention, and the technical solutions of the present invention are within the scope of the present invention defined by the claims.

25页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种输电线路交叉点距离监测方法、装置及系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!