1. Question requirements and content
Use A and B electrode plates (size: square with side length 50mm±1 mm), wires a and b (size: length 500mm±5mm) and measuring circuit to measure the number of papers between the two plates. The number of measurements is 1 to 30, and the circuit has functions such as self-calibration and short-circuit detection.
2. Design ideas
Measuring the number of papers is actually measuring the capacitance composed of paper and two-pole plates. The number of papers can be measured indirectly by measuring the equivalent capacitance.
3.Principle analysis
The circuit consists of the following parts:
1) The power supply part provides +3.3V (microcontroller) and ±9V voltage (operational amplifier);
2) The waveform generates electricity. Generate positive waves to provide signal source for the measurement circuit;
3) Detection circuit. Detect the ratio of plate capacitance to reference capacitance (operational amplifier principle);
4) Filter circuit. Filter out power frequency interference (very important);
5) Amplitude detection circuit. Convert the detection circuit output into the corresponding voltage;
6) Main control circuit. Perform ADC detection, button detection, buzzer control, display control, etc.
Specific principle: Use the operational amplifier detection principle in the capacitance detection principle to convert the capacitance value of the plate capacitor into the corresponding voltage.
Since the distance between the two plates in the formula is proportional to the number of papers, the output voltage increases linearly with the number of papers, and has very good linearity, which is convenient for actual measurement and conversion.
All the premise is that the capacitive reactance of Cf is greater than the resistance of Rf.
4. Physical picture display
The soldering flying wire is an AC signal wire; the red thin flying wire is a DC signal wire (the original IO for detecting AD was burned out, so I replaced it); the black thin flying wire is useless.
5. Debugging process
1) The first step is to debug the output of the positive wave generating circuit. Its output amplitude depends on the power supply voltage of the subsequent operational amplifier (generally around 0.05~0.1), and the frequency is preferably greater than 100khz;
2) Debugging the detection circuit. Select the size of capacitor C0 (reference capacitor). The principle is to make the output voltage equal to the maximum reliable output voltage when the number of sheets of paper is 30, in order to obtain the maximum resolution (the amount of output voltage change consisting of a single sheet of paper). If conditions permit, you can first measure the size of the plate (one side is about 200pf), and then select according to the actual circuit;
3) Adjust the filter circuit. (Basically no problem) Its purpose is to filter out the interference of power frequency signals;
4) Debug the peak detection circuit to achieve the minimum error. If conditions permit, it is recommended to use the effective value detection circuit, and its accuracy will be greatly improved.
5) Debugging the program. It is relatively simple and can be written according to your own habits, mainly for ADC detection problems.
6. Video demonstration
Video address: https://www.bilibili.com/video/BV1Xi4y1N7gE/
7. Source code attachments
See attachment at the end of the article
Attachment 1: Program source code
Attachment 2: Existing problems and solutions (some problems have been solved on 2021-3-17).
Attachment 3: Instructions (some notes)
Note: This project has been updated.
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet