桂花蒸

[Electronic Design Competition Solicitation Order] 2019 H-Title Paper Counting Display Device (Save Money Version)

 
Overview

Preface

The compilation of this article did not use the standard e-sports format, so the layout will be relatively free and easy. At present, the FDC2214 module is commonly used on the Internet as a capacitance acquisition sensor. It is true that its measurement accuracy is more accurate. However, this article is more of a certain exploration of this problem and seeks another way to solve the problem, so this design uses , high-precision impedance measurement chip AD5933.

AD5933

Official website link

AD5933 is a high-precision impedance measurement chip that integrates a frequency generator with a 12-bit AD converter with a sampling rate of up to 1MSPS. This frequency generator can generate a specific frequency to excite an external resistor. The response signal obtained on the resistor is sampled by the ADC and discrete Fourier transformed by the on-chip DSP. This article designs a system that uses a microcontroller to control AD5933 to implement impedance measurement. The ADμC848 of Analog Devices is chosen as the microcontroller. The microcontroller and AD5933 communicate through the serial port. The microcontroller controls the working mode setting of the AD5933 , controls the measurement process, reads the measurement results, and transmits them to the PC through the serial port.

Source: http://www.elecfans.com/dianlutu/app/20141217360937.html



According to the current measured data, the measurement values ​​of AD5933 are relatively accurate. However, because our mechanical structure does not use more complex ones, but uses simple clamps, there are certain problems in improving some data measurements.










According to information online:



AD5933 can be widely used in electrochemical analysis, biological electrode impedance measurement, impedance spectroscopy analysis, complex impedance measurement, corrosion monitoring and instrument protection, biomedical and automatic control sensors, non-invasive detection, raw material performance analysis, fuel and battery status monitoring, etc. Field. It provides great convenience for impedance measurement. Monolithic integration technology greatly reduces the size of the instrument, making it more convenient to use. The simple I2C communication method facilitates user operation and reduces the difficulty of user programming. Since it directly gives the real and imaginary part data of the transformed impedance, it greatly simplifies the user programming process and saves development time.

Source: https://www.dzsc.com/data/2011-8-29/95341_3.html



You have to admit that the functionality and adaptability of AD5933 far exceed that of FDC2214 (I don’t mean to say it is bad). For example, the signal question also in 2019 can also use this chip. But why is there not such an easy-to-use chip open source platform?

impedance

In a circuit with resistance, inductance and capacitance, the obstruction to alternating current is called impedance. Impedance is often represented by Z, which is a complex number. The real part is called resistance and the imaginary part is called reactance. The effect of capacitance on alternating current in the circuit is The hindering effect played by the capacitor and the inductor on the alternating current in the circuit is called capacitive reactance. The hindering effect caused by the capacitor and the inductor on the alternating current in the circuit is collectively called reactance. The unit of impedance is ohms.

In the calculation of impedance, because the AD5933 has a 27-bit DDS on-chip to provide an output specific frequency excitation signal. If you want to measure the value of the same frequency point multiple times to make the measurement results more accurate, just write the repeat current frequency command word in the control register after the measurement is completed.

The following is a well-written analysis of AD5933 measurement that I think. If you are interested, you can take a look. If you are not interested, you can directly look at the program in the attachment.

Give an example of calculating the gain coefficient. When the output voltage range is 2V, the calibration resistance is 200kΩ, the programmable amplifier is set to 1, the current-voltage conversion amplifier gain resistance is 200kΩ, and the excitation frequency is 30kHz, what is obtained at this frequency point The real part and imaginary part values ​​are F064 and 227E respectively, which are -3996 and 8830 respectively when converted to decimal. Then the modulus value after Fourier transform =, then the gain coefficient is the reciprocal of the calibrated resistor divided by the calculated modulus value, that is (1 /200kΩ)/9692.106=515.819E-12.

  Here is another example of calculating the resistance of the measured resistor with known gain coefficient, real part and imaginary part values ​​of the measured resistance. Assume that the measured resistance is 510kΩ, the excitation frequency is 30kHz, and the measured real part and imaginary part values ​​are are -1473 and 3507 respectively, then the calculated module value is 3802.863. Resistance value = 1/(gain coefficient × module value) = 1/(515.819E-12×3802.863) =509.791kΩ.

  The gain coefficients are different for different measurement frequency points, so the gain coefficients must be calculated separately at different frequency points.

  During the measurement process, the measurement performance can be optimized by limiting the measurement range of the resistance. Table 4 gives 6 different impedance ranges as a reference. Their selected output voltage ranges are all 2V, and the programmable gain amplifier is set to 1.

Screenshot 2021-04-19 115317.png

Selection of pressure structure

I believe everyone should be familiar with this picture. Most of the questions use this structure, although some research reports point out that " heavy object pressure structure. As shown in Figure 1-1, use heavy objects as much as possible Eliminate the gaps between the copper plate and the paper and between the papers, and ensure the uniform thickness of the paper. However, the structure has poor stability and requires high requirements for the placement of heavy objects and the balance of the template. "However, it is indeed During the competition, they are the most "practical", so we list them here for everyone to discuss.

1.png

For this picture, there is also a rich version,

2.png

Obviously this price has nothing to do with our topic. . .

Therefore, in this money-saving version, we used large clips that many students wanted to use, but were afraid to use.

3.jpg

Sorry, I misplaced it. This is a small clip.

Thumb~thump~thump~thump~

src=http___www.t-jiaju.com_tujjJDAxJDIyLzEwOTM1MTc2NjcvVEIyTm12U1g2ZnlRZUJqeTBGcFhYY1hDRlhhXyEhMTA5MzUxNzY2NyQ5.jpg&refer=http___www.t-jiaju.jpg

It's this big clip.

Convenient, simple and practical.

Because it was considered that it would tilt due to gravity, we used the most commonly used glue gun to fix it on a huge board, using gravity to keep the clip itself from changing.

Please see attachment 1: VID_20210413_212350.mp4


Data measurement

What I have to admit is that if the appropriate module is used for this question in 2019, all problems will be solved. The algorithm is still a very simple brute force function fitting. What is even more violent is that in this test, manual hand-pointing was used to read the values ​​of different numbers of serial ports at three frequencies, and some simple analysis was done.

Screenshot 2021-04-13 214742.png

Like other common materials,


1-30 sheets can be easily achieved. The main reason is that after 30 sheets, as the number of sheets increases, the capacitance difference between adjacent numbers is very small. Therefore, the stability of the reading is very high at this time. During calibration and measurement, Values ​​for the same reference point cannot differ by more than 0.3%.

But because it doesn’t cost money , the structure is simple and we can’t pass it.

The pole pieces are compacted with heavy objects to squeeze out the air between the papers in the pole pieces as much as possible to reduce the impact.

Therefore, we thought about it. Because the thickness of the paper changes, the pole pieces are forced to tilt up. As long as we set certain ranges for separate measurements, will the data I get be the most real and effective?

So, another series of violent solutions... (worksheet:?, MATLAB:?, spss:?)

After careful study, we found a small loophole in the performance requirements of the question. We added a judgment in the program. As long as my measurement value is within a certain range, we will switch to the "warp up" mentioned above. "Looks like" corresponding to the frequency.

measurement accuracy

In the overall calculation process, due to problems with the mechanical structure, part of the performance can only be said to be mediocre. In different frequency calculations, some problems occurred when I measured 40 pages of paper, and the accuracy was around 50 pages. It will take off, and the recognition rate will fluctuate around 50%. It is optimistically estimated that if the relevant mechanical structure is replaced, the effect will be better.


program analysis

calibration

Calibration is a rather euphemistic way of saying it. It is essentially a simple data collection. Because different papers will have different "wrinkles" during measurement, which will lead to different data collected by the serial port. Just classify the data collection and select different corresponding frequencies.

paper count

After calibration, put the paper into the data collection, press the button, the microcontroller will find the corresponding paper quantity under the current serial port value, display it on the serial port screen, and perform voice broadcast at the same time.

Short circuit alarm

When the two plates are in direct contact, the data read by AD5933 is 0, and the microcontroller triggers a buzzer to alarm. At the same time, because it measures capacitive reactance, there is no need to consider the short circuit that will damage the circuit in traditional designs.

Voice broadcast

Voice broadcasting is actually to complete and play part of the "other". In this design, the TTSMR628 serial text-to-speech module is used. Because the price is relatively cheap, the sound quality is average.

Accuracy

For this question, the most important thing is the accuracy test.

For parallel plate capacitors, the influencing factors of capacitance are nothing more than area, spacing, medium, temperature, etc.

The best thing to say is the medium. The lightest and most direct impact is the newness of the paper. New paper is smoother and has a smaller surface area; old paper is rougher and has a larger surface area than new paper.

The second is the temperature,

> In order to suppress temperature drift, some participating teams also built temperature detection circuits. It can be seen that they have good intentions and the cruel impact of the environment on the measurement results.

Of course, we have temporarily ignored this influencing factor, because in actual data measurements, our measured effects at different frequencies are less affected by temperature.

Then there's the spacing,

> You will find that some groups place some heavy objects on the upper plate to ensure the stability of the spacing. Because paper is a micro-elastic material, there is a certain difference between flattening and not pressing, and this gap will cause a jump in the capacitance value, which is fed back to the circuit as a jump in frequency.

Because this design uses a clip that most people only dare to think about, during the design process, the choice of this clip took a long time. When testing within 30 pictures, this clip basically "clamped" The size of the "force" will not have much impact, because we are using completely new paper taken out of the packaging, and the impact of this aspect has been ignored as much as possible.

Finally, there is this area, which is also one of the highlights of this design. We made full use of the phenomenon that the clip will "cock up" when clamping too many things. We tried repeatedly and selected different frequencies. Frequency tables that are best suited for different papers.

filter

There isn’t much innovation in this position, so I’ll just quote the boss’s explanation.

> If you understand Kalman filtering, you should use more advanced filtering algorithms. I use weighted average here, and the core idea is also borrowed from the Kalman filter algorithm. Because the weights of the Kalman filter can be artificially specified, this is the case here.

> According to observation, it can be found that the frequency value of the next second is always more accurate than the frequency value of the previous second (when only considering the distance), so the frequency weight value that can be assigned to the next second is larger than that of the previous second. The weight is smaller. In the algorithm, I collect a total of 5 data in one second (collected regularly every 200ms), then these 5 data must have different weight values. I artificially set the weight for the first second to be 0.1; the weight for the second second to be 0.1; the weight for the third second to be 0.2; the weight for the fourth second to be 0.3; the weight for the fifth second to be 0.3, and the total weight is 1. Then this new data must be the weighted average of these five data. Use the new data as the final frequency value for the current paper.

> The advantage of this algorithm is that it does not blindly average the sum of five data. Rather, it is judged whether it should be fully trusted based on the current time period of the data. The understanding reflected in reality is: the state of the pressed paper in the next second will definitely be more real than the state of the pressed paper in the previous second, the data will be more credible, and the state will be stronger.

Updated on April 22, 2021

At present, the measurement accuracy has been able to fully realize the detection of 63 pictures.

Because the storage capacity of AT24C02 is 256, a float occupies 4 bytes, 63x4=252.

According to theory, in principle, the storage can continue to be expanded, and the measured value can be the maximum number of papers that the clip can hold, and the estimated estimate is 80+.

Will update it if there is time.

About attachments

Attachment 1: Side view of the measurement process

Attachment 2: Serial port value measured by AD5933 at 25kHz

Attachment 3: AD5933 program

Appendix 4: Basic part test

Attachment 5: Play Part Test 1

Appendix 6: Accuracy distortion

Appendix 7: Determining the short circuit condition of the circuit

Attachment 8: Complete program code

Attachment 9: Updated on April 22

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-11 03:47:31

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

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号