The video was shot in an interference-free laboratory environment (measured 200 sheets).


Hardware Part:
1) The verification and selection of the clamping device for the plates.
According to the given instructions and requirements of the problem, Plate A and Plate B need to be parallel and clamped to each other. Therefore, we preliminarily obtained the following two methods.
Plan 1: Use clamps to clamp the two plates together. This method has a simple structure, is easy to make, and is flexible to use. However, there are many shortcomings, such as uneven force between the plates, clamps are prone to loosen, and the relative position of the plates is not fixed, which can affect the equivalent capacitance and cause measurement errors.
Plan 2: Use heavy objects to press down, with positioning holes around and bolts inserted to keep the relative area basically unchanged. This method is slightly more complicated to make, but the force between the two plates is more uniform, debugging is convenient, and stability is better.
After comparing the above two plans, it was found that Plan 1 has many defects, such as the difficulty in ensuring the relative area between the two plates, uneven force from the clamps, and difficulty in pressing the plates well. Moreover, the clamps will weaken their clamping force after multiple uses. Plan 2 does not have these issues. Finally, we chose Plan 2 for this design.
2) The verification and selection of the measurement plan.
Plan 1: Oscillator frequency measurement method. Using TI’s NE555 chip to build a multivibrator circuit, replacing the original C1 oscillating capacitor with Plates A and B. The oscillation frequency output from pin 3 of the NE555 will change with the capacitance of the plates. By measuring this frequency with a microcontroller and validating the data multiple times, we can complete the measurement of the sheets.
Plan 2: FDC2214 capacitive measurement chip. Using the FDC2214 produced by TI to complete this design. This is a high-resolution, high-speed capacitive-to-digital converter. The excitation frequency of the chip can range from 10 kHz to 10 MHz, with a resolution of up to 28 bits, which can fully meet the requirements of this design. The chip exchanges data with the microcontroller via I^C communication protocol, making it user-friendly and easy to wire.
Among the above two plans, although Plan 1 is simple, it has shortcomings, such as imprecise voltage divider resistors, and the generated excitation source’s signal frequency and amplitude are difficult to stabilize. Moreover, the AC signal produced can lead to incomplete sampling by the microcontroller.
Plan 2, while having a relatively simple circuit structure and principle, outputs TTL signals that are stable in frequency and amplitude. The characteristic of the capacitance change at the measuring plates is that frequency is a parameter, making it easier to analyze and write programs. However, the disadvantage is that the NE555 has a frequency limitation, and the highest working frequency of this device is known to be 500KHz.
In Plan 2, the FDC2X1X series chip has high sensitivity and resolution. Therefore, this plan has issues with external interference and power supply interference. Moreover, at high excitation frequencies, electromagnetic interference can be strong over long lines (500mm), and the conditions for making this design are limited, making it impossible to add shielding covers or nets to mitigate interference.
In summary, we decided to choose Plan 1.
3) Selection of the main control chip.
Plan 1: Use the Arduino series Mage2560.
The Mage2560 is an 8-bit microcontroller from the Arduino series AVR ATmega, with a processing core of ATmega2560. It has 54 digital input/output ports, 15 10-bit AD analog input ports, 4 UART interfaces, and uses a 16MHz crystal oscillator as the input clock, with a processing speed of 8MHz.
Plan 2: Use STM32F103 from ST.
The STM32 series is a mid-to-low-end 32-bit ARM microcontroller based on the Cortex-M3 core, with a maximum working frequency of up to 72MHz. It has rich high-speed and high-precision timers. By configuring its clock source to an external clock, it can count external pulse signals and also has single-cycle multiplication and hardware division.
Plan 3: Use high-precision floating-point DSP.
The DSP has high-speed real-time data processing capabilities and is good at complex data processing. Since the discharge pattern of the capacitance shows an exponential function change, it can be inferred that the change in oscillation frequency due to capacitance changes should also follow a similar exponential change pattern. The floating-point DSP has the ability to perform exponential calculations. (Using MATLAB data fitting to determine the function model).
Note: I am not very skilled at using floating-point DSP, so I abandoned this optimal main control scheme.
In summary, the Mage2560 has a processing speed that is still lower than that of the STM32 in terms of timer sampling speed and accuracy. To ensure the accuracy of the system’s measurements and the time constraints of the problem, we decided to choose Plan 2.
Software Part:
In this problem, our core is to detect the RC oscillation frequency. By using different numbers of sheets corresponding to different capacitance values, the RC oscillator generates different frequencies. Based on the frequency change pattern, we determine the number of sheets.
The key part is to first create a high-precision frequency counter. I won’t go into much detail about the specific implementation method; after all, everyone here is an expert!
Self-calibration completion: By accurately recording the frequency of each sheet, a verification table is generated, with the table number incrementing by 1 indicating the number of sheets.
One-click measurement: Record the frequency value of the currently measured sheets, then compare it with the verification table. By taking the absolute value of the difference, we can determine the number of sheets corresponding to the current frequency and print the output as required by the problem.
At this point, the program design is basically complete. However, to test a larger number of sheets within the specified time, we added a power-off retention feature for the calibration data and a modification feature for the calibration data. Before testing, we confirm whether the previous calibration data is still valid. If valid, we will not modify the calibration data; otherwise, we will modify the abnormal calibration data. The specific implementation involves simple internal FLASH storage read/write operations, which I won’t elaborate on here.
Simple process flow is as follows:

1. Reasonable planning and efficient use of time;
2. Reasonable division of labor; software and hardware should belong to a whole, with more communication between software and hardware;
3. Always perform short-circuit detection before powering the circuit to prevent damage;
4. Detect the resistance values of special points in the circuit; it is a habit to predict and prevent major circuit failures..

Problem D: Simple amplifier circuit characteristic tester, not simple to win the national first prize (Nanjing University of Posts and Telecommunications)
Darlwen 2019 Electric Competition Training and Problem Guessing Highlights
Darlwen has prepared the following courses for students participating in the electric competition:
Measurement of MOS switch waveform overshoot, power isolation, and power ripple
Quickly adjust PID controllers from the time domain perspective!
Immediate supplementation of inverter knowledge! Prediction of the electric competition checklist “power analyzer”

Graduation design class is starting! Darlwen’s autumn event
Darlwen, in collaboration with global distributor Digi-key, brings you a series of 17 online courses for graduation design.
Instructor: Graduation design mentors, doctoral/master’s degree from prestigious schools, senior engineers, Zhihu experts, Bilibili UP owners
Course content: From topic selection, basic knowledge supplementation, breakdown of graduation design topics to sharing of graduation design cases.
Time: September 2019 – December 2019
Benefits: Rich graduation design materials, project plans, free development boards, etc. Reserve your spot now:
Method 1: Graduation design – Digi-key exchange QQ group: 657307701
Method 2: Scan the QR code below for WeChat communication. If the group is full, you can add Sister Ni’s WeChat: 459888529