Abstract: In order to improve the accuracy of capacitance measurement, a capacitance measurement module based on the PICl6LF874 single-chip microcomputer is designed according to the working principle of the capacitive sensor. The application background and current research status of the capacitance measurement circuit at home and abroad are briefly explained, and the characteristics of the PICl6LF874 single-chip microcomputer of Microchip Corporation of the United States are introduced. The dynamic weak capacitance signal output by the capacitive sensor is converted into digital data through the PS02l capacitance-to-digital converter, and the measured data is processed, displayed and saved by the PICl6LF874 single-chip microcomputer application. The experimental results show that the relative error of the measured value of the fixed capacitance with a nominal value of 10-20 pF is within 1%. At the same time, it can be seen that the larger the capacitance value of the measured capacitance, the smaller the relative error between the measured value and the nominal value.
Keywords: PICl6LF874; capacitance sensor; PS02l; test
Capacitive sensors have been widely used in industry, medicine, military and other fields. However, most of the current capacitance measurement methods have low integration level and low precision, so accurate measurement of capacitance, especially small capacitance, has always been a very important content. The oscillation method has a simple circuit structure and poor anti-interference ability, and the capacitance between the plates affects the measurement results; the bridge method uses the bridge balance principle to measure capacitance, and the measurement results are greatly affected by the performance of the bridge arm capacitance. This article uses the PICl6LF874 microcontroller from Micmchip Company in the United States. The microcontroller adopts RISC reduced instruction set, Harvard bus structure, and pipeline instruction mode. It has the characteristics of strong anti-interference ability, low power consumption, high performance, and low price.
1 PICl6LF874 MCU
The PICl6 series MCU adopts Reduced Instruction Set Computer (RISC) structure, breaking through the natural structural dependence of traditional MCU on PC; coupled with the Harvard bus memory structure, two-stage pipeline instruction structure, single-cycle instruction and other technologies, it has taken a unique approach in the hardware structure of the MCU, greatly improving the efficiency of system operation. In addition, in view of the characteristics of MCU applications, PIC MCU also has some unique features in terms of power consumption, driving capability, peripheral module design, etc., making PIC a convenient and practical MCU with high cost performance.
The PICl6LF874 series MCU includes a series of different models of devices. The main features are:
1) Reduced Instruction Set Technology The PIC instruction system is specially designed according to the characteristics of small computers, striving to achieve higher efficiency for each instruction and reduce the duplication of instruction functions. The number of instructions for high, medium and low-end PIC MCUs is 58, 35 and 33 respectively. This brings two benefits. On the one hand, it can greatly improve the utilization rate of the code and help improve the execution speed. On the other hand, it brings great benefits to users' learning, memory and application. Programming and debugging are relatively easier, and the same function requires less coding, saving development time.
2) Harvard bus structure Harvard structure is that the program memory and data memory are independently addressed, that is, the two are located in different physical spaces. The PIC series of microcontrollers not only adopts the Harvard architecture, but also adopts the Harvard bus structure, thus giving full play to the potential advantages of the Harvard structure. It greatly improves the system's operating efficiency and data reliability.
3) Single-byte instructions Single-byte instructions are an innovative change to the microcontroller system. The instruction bits of high, medium and low-end PIC microcontrollers are 16 bits, 14 bits and 12 bits respectively. The addressing of ROM and RAM is relatively independent, and all instructions are realized in single bytes, which not only makes data access safer, but also significantly improves its operating speed.
4) Two-stage pipeline instruction structure Due to the use of the Harvard bus structure, the data bus and instruction bus are separated inside the device, and different bus widths are used. When an instruction is executed, the next instruction is fetched at the same time, so that higher efficiency can be achieved in each clock cycle.
5) Register group structure All registers of PIC, including I/O ports, timers and program counters, are in RAM structure, and only one instruction cycle is needed to complete access and operation.
6) One-time programmable (OTP) technology OTP can achieve zero time to market for products, and can be customized according to users to meet specific needs. Product customization can significantly improve the product life cycle and enhance the market competitiveness of products.
7) Low power consumption The power supply voltage is 2.0~5.5V. When using a 4 MHz crystal oscillator and a power supply voltage of 3V, the typical current consumption does not exceed 6 mA: when using a 32 kHz crystal oscillator and a power supply voltage of 3V, the typical current consumption is 20 mA, and the current consumption in sleep mode is less than lμA.
8) Complete variety and convenient selection The PIC series of microcontrollers has now formed a large family with more than 50 models in three grades of high, medium and low. The functions are flexible and diverse, and can meet the different needs of various applications.
2 Working principle of capacitance measurement module
The overall design principle block diagram of the capacitance measurement module is shown in Figure 1, which includes power management circuit, PIC16LF874 microcontroller, capacitive sensor, signal conditioning circuit, PS021 capacitance digital converter and interface circuit connected to the computer.
The working principle of the capacitance measurement module is as follows: the capacitance sensor outputs a weak capacitance signal, and the capacitance signal passes through the signal conditioning circuit and enters the PS02l capacitance-to-digital converter. The capacitance measurement range of this device is from 0 to tens of nF (unlimited). After the internal conversion of the device, the required value is obtained by setting the internal register of PS02l; the data is transmitted to the PICl6LF-874 microcontroller through SPI, and the measured data is then sent to the host computer (computer) through the asynchronous serial communication interface USART of the microcontroller. Finally, the host computer application displays the measurement results and saves the test data.
3 System Hardware Connection
This measurement circuit requires a control device to control the reading and writing of data. The PICl6LF874 microcontroller with simple structure, powerful functions and compatible with SPI serial interface is selected. Since the peripheral interface of PS02l is SPI, the microcontroller can control the operation of PS02l very well, and the measurement data can be sent to the host computer through the USART serial interface. The connection of the microcontroller is shown in Figure 2, and the connection diagram of PS02l is shown in Figure 3.
4 Implementation of system software functions
The application software designed based on PS021 includes programs such as detection, control, data processing, database management and system interface. Under the conditions of program running speed and storage capacity, try to use software to implement the hardware functions of traditional instrument systems and simplify hardware configuration. In addition, the interface is the "window" of the test system and virtual instrument, and is the main way for the system to display functional information. Software design should not only realize functions, but also have a beautiful interface. After determining the hardware platform of the test system, the key is to choose a suitable software development tool to write the corresponding application software. The test module is developed in a graphical programming language. The development environment can provide an integrated development environment, which is easy to connect to the instrument hardware and has a good user interface. According to the principle of host computer application design, the software of the test system is obtained. By setting some parameters on the main interface of the software, the hardware circuit is connected to the host computer, and the measurement results can be displayed. The measurement results are displayed on the data display interface, as shown in Figure 4.
5 Experiment and results
The above software was used for measurement. Before measurement, the measurement system must be calibrated. During calibration, PS02l requires that the reference capacitor Cref and the measured capacitor Cmeas are in the same capacitance range, that is, to ensure that the Cmeas/Cref ratio does not exceed 25% (PS02l limit value). The reference capacitor is a very important part and has a direct impact on the quality of measurement and the temperature stability of measurement. Recommended capacitor materials: CFCAP (multilayer ceramic capacitor of Taiyo Yuden) series, COG or NPO ceramic capacitors. The discharge resistor Rdis is closely related to the discharge time. The discharge time τ=0.7R(C+20 pF), and the time constant τ ranges from 2 to 10μs (5μs is recommended). The discharge resistor value is calculated according to the formula.
In the experiment, fixed capacitors of 1, 2, 3, 5.1, 6.8, 8.2, 9.1, 12, 13, 15, 16.5, and 18 pF were selected as the measured capacitors. Determine the size of the reference capacitor according to the range of the measured capacitance, then determine the discharge resistor value according to the measured capacitance and the reference capacitance value, combined with the discharge time, and finally select the appropriate measurement mode for measurement. Under the calibrated system, connect a reference capacitor to the reference end and the measured end respectively. At this time, the value displayed on the data display interface is the sum of the reference capacitance value and the parasitic capacitance value (the data displayed by Sensor 1 in Figure 3); then connect the measured capacitance in parallel based on the measured end reference capacitance. At this time, the measured data is the sum of the measured capacitance value, the reference capacitance value and the parasitic capacitance value. The subtraction of the measured values in the above two steps is the measured capacitance value. The final measured capacitance value statistics are shown in Table 1.
Table 1 reflects the relative error between the measured value and the nominal value of the measured capacitance. It is also known that the larger the capacitance value of the measured capacitance, the smaller the relative error between the measured value and the nominal value. Since the measured capacitance is affected by factors such as ambient temperature, the amount of solder, and the quality of the measured capacitance, there is a certain error. Multiple measurements are averaged to obtain a more stable capacitance value. Under the calibrated system, the fixed capacitance is measured to verify the accuracy of the measurement module. The measured value and the nominal value are very close. It can be considered that the error of the measured capacitance nominal value is small, and it is further known that the capacitance measurement module has a high measurement accuracy.
6 Conclusion
The PlCl6LF874 single-chip microcomputer can well control the capacitance measurement module, which has a good role in promoting the research of capacitive sensors. The single-chip microcomputer simplifies the circuit design and makes the measurement results reach a higher accuracy; at the same time, this measurement module can reduce the volume of the circuit board, thereby reducing the volume of the entire device; it greatly simplifies the circuit design process, reduces the difficulty of product development, and is of great significance to accelerate product development and reduce production costs. The experimental results show that this measurement module has good practicality.
Previous article:PIC microcontroller A/D conversion data storage and serial port efficiency
Next article:Design of Programmable Cryptographic Processor Using EPIC Technology
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- When the comparator output is connected to the logic OR gate input, it cannot generate a high voltage signal (logic "1"), how to solve it?
- [NXP Rapid IoT Review] "Smart Home Control System Based on Rapid IoT" - Review Summary
- Advantages of TI's multi-channel PA controller AMC7932 in MIMO systems
- 555 classic circuit diagram: DC-AC converter diagram composed of 555 circuit
- Is there any mobile phone positioning software that you would recommend?
- TI Live: A detailed discussion of a candidate solution for "electric vehicle on-board charger". Will it be popular among engineers?
- DSPC6678 on-chip storage space allocation mechanism
- EEWORLD University Hall ---- Computer Control Devices Zhang Guangxin of Zhejiang University
- The most worrying thing happened: ARM complies with new US regulations and stops cooperating with Huawei
- Summary of remote firmware upgrade for MSP430, STM8L, cortex-M0 core