Here is a method to use the ADC and DAC built into the MCU, and combine them with components such as operational amplifiers, capacitors, and resistors to build peripheral hardware circuits to achieve an ADC with adjustable 10-20 bit measurement accuracy.
1 High-precision ADC design principles
The input voltage is divided by resistors to generate a voltage Uin, which is sent to the non-inverting terminal of the subtraction circuit composed of an op amp and a resistor. The reason for the voltage division is that the maximum value of the input voltage is greater than the maximum input voltage of the op amp. The DAC output of the MCU is amplified by the in-phase proportional circuit to generate a voltage Un close to Uin, which is sent to the inverting terminal of the subtraction circuit. The function of the in-phase proportional circuit is to expand the output voltage range of the DAC so that the maximum values of Uin and Un are approximately equal. The voltage difference Ud after the subtraction circuit is sent to the ADC of the MCU through the clamp circuit, and the value of Ud can be obtained by reading the value of the ADC register. The clamp circuit prevents the input voltage of the ADC from exceeding the range, which may burn the MCU.
During measurement, the software controls the change of the DAC register value, thereby changing the DAC output voltage value, so that the voltage value of U difference is within the range (0-3 V). At this time, by reading the values of the DAC and ADC registers, the value of the DAC output voltage and the voltage U difference sent to the ADC can be obtained. The U near voltage value can be obtained according to the DAC output voltage and the in-phase proportional operation circuit formula, and the input voltage value can be obtained according to the subtraction circuit formula, the U difference and the U near value.
The system hardware block diagram is shown in Figure 1.
2 System Hardware Design
Figure 2 is a schematic diagram for implementing a 17-bit ADC. U101, R100, R101, R102, and R103 form a subtraction circuit, and U102, R108, R109, and R116 form a common-phase proportional operation circuit. VD100
The clamp circuit is formed. VR is a 3 V reference voltage generated by a reference voltage source. R117 and R118 form a voltage divider circuit. The voltage on R118 is 45 mV, which can offset the zero drift of the op amp. ADO is the input terminal of ADC channel 0 of the MCU.
Although the circuit shown in Figure 2 only implements a 17-bit ADC, the input voltage range and ADC measurement resolution can be adjusted by modifying the resistance values of several specific resistors. By modifying the ratio of R109 and R116 in the in-phase proportional operation circuit, the input voltage measurement range can be adjusted; by modifying the ratio of R103 and R100 in the subtraction circuit, the ADC resolution can be adjusted. The following is a circuit diagram for implementing a 17-bit ADC hardware design to specifically explain how to implement a 17-bit high-precision ADC, adjust the input voltage range, and implement an ADC with 10 to 20-bit adjustable precision.
2.1 Implementation process of 17-bit ADC
For an n-bit ADC, its resolution is the ratio of the maximum measurable input voltage value to 2n. Therefore, the number of bits of the ADC that can be implemented by this circuit diagram can be calculated by the maximum value of the input voltage and the resolution.
1) Method for calculating the input voltage measurement range As shown in Figure 2, the ADC input voltage calculation formula is as follows:
Where VIN is the input voltage, VDAOUT is the DAC voltage when the ADC input voltage is within the range, and VDAO is the ADC input voltage.
From formula (2), we can see that when the output voltage of the DAC and the input voltage of the ADC just reach the maximum value of 3 V, the input voltage is 59.1 V, which is the maximum input voltage value that the system can measure. It can be seen that the measurement range of the input voltage is 0 to 59.1 V.
2) Calculation method of ADC resolution When the output of the DAC is zero, that is, VDAOUT=0, the relationship between the input voltage VIN and the voltage of VADO can be obtained from formula (2):
VIN = VADO / 10. The ADC bit number of the MCU is 10 bits and the maximum input voltage is 3 V. Therefore, the ADC resolution is 0.292 mV.
3) Realize 17-bit ADC Calculate the number of bits of the ADC implemented by this circuit diagram based on the ratio of the maximum input voltage to the ADC resolution. From 59.1/(0.292x10-3)=202 397=217.6, it can be seen that this circuit realizes a 17-bit ADC.
2.2 Methods for adjusting the measurement input voltage range
Because the maximum values of VADO and VDAOUT are both 3 V, it can be seen from formula (2) that the maximum measurable input voltage value is determined by R100, R103, R116, and R109. Changing the ratio of R100 to R103 will affect the measurement accuracy of the ADC. Therefore, the measurement input voltage range is mainly adjusted by adjusting the ratio of R116 to R109. It is easy to see from formula (2) that when R116 increases, the measurement voltage input range increases, and when R109 increases, the measurement voltage input range decreases.
2.3 Methods for Implementing 10-20-bit Adjustable Precision ADC
From the implementation process of 17-bit ADC, we can know that the number of bits of ADC implemented by this circuit is determined by the maximum value of the measured input voltage and the resolution of ADC. Therefore, when changing the number of bits of ADC, we need to change the measured input voltage range or ADC resolution. However, the system measurement input voltage range is fixed. Therefore, the number of bits of ADC can be changed by changing the ADC resolution.
1) Method for adjusting ADC resolution When the output voltage of the DAC is zero, equation (2) is simplified to equation (3):
From formula (3), we can see that when the MCU's ADC changes a voltage scale value, VIN changes by 6R100/R103. The ADC bit number is 10 bits and the maximum input voltage is 3 V. Therefore, the ADO resolution is 3 V/1 024=2.92 mV, and the ADC resolution is 2.92x10-3x6R100/R103. It can be seen that when R100 increases, the resolution decreases; when R103 increases, the resolution increases.
2) Realize 10-20 bit precision adjustable ADC The resolution of ADC can be calculated by the maximum measurable input voltage and the number of bits of ADC to be realized, and then the proportional relationship between R100 and R103 can be calculated by formula (3). Modify the resistance value according to the proportional relationship between R100 and R103 to achieve the desired number of bits of ADC. For example, if this system is modified to 20 bit ADC, the ADC measurement accuracy should be 59.1 V/220=0.056 mV. From formula (3), it can be seen that 0.056=6x0.292xR100/R103, so the ratio of R103 to R100 is modified to 312.8, that is, a 20 bit ADC can be realized. This method can realize 10-20 bit precision adjustable ADC.
2.4 Hardware Design Description
U100 is a voltage follower composed of op amp OPA177F, which has the characteristics of high input impedance and low output impedance. Its role in this system is to match the input resistance of U101 and improve the accuracy of input voltage division. R101 and R100 are the input matching resistors of the second-stage subtraction circuit, and their resistance should not be less than 10 kΩ. Too small resistance will affect the measurement accuracy of ADC. R104 is a current limiting resistor to prevent the current from exceeding the maximum rated current of VD100.
R117 and R118 form a voltage divider circuit. The voltage on R118 is 45 mV, which can offset the zero drift of the op amp. If this voltage divider circuit is not added and the DAC output is zero, the voltage at TP102 is about 120 mV after actual measurement. This is caused by the zero drift of the op amp, which will affect the measurement accuracy of the ADC. A 0.1 μF capacitor is added to each op amp input to remove high-frequency signals and improve the stability of the input signal.
3 System Software Design
The main function of the software part is to measure the input voltage. Because there are errors in the parameters of the operational amplifier and the resistor itself in the hardware design, there are errors in the amplification factor of the amplifier circuit composed of them, which causes errors in ADC measurement. Therefore, the input voltage value calculated by the traditional method directly using the calculation formula of the amplifier circuit composed of them (Formula (2)) has a large error and obvious voltage jump. Therefore, before the system measures the input voltage for the first time, the input voltage correction table is first established through software design to reduce the error.
The correction table is a data table established before the first measurement. Its function is to observe what kind of curve relationship is satisfied between the input voltage value and the measured value through this table. When measuring the input voltage, the Lagrange interpolation algorithm is selected according to the obtained curve relationship, and the measured value is substituted into the selected Lagrange interpolation formula to calculate a more accurate input voltage value.
3.1 Software Implementation Process
The software design process mainly includes initializing the ADC of the MCU, establishing the input voltage correction table, calculating the value of expression (5), calculating the input voltage by Lagrange interpolation, and displaying the input voltage value. The software design process is shown in Figure 3.
Let X be the decimal value of the MCU's DAC digital quantity, and Y be the decimal value of the MCU's ADC digital quantity.
From formula (4), we can get formula (5):
3.1.1 Initialize ADC
It mainly initializes the ADC of the MCU, including ADC register configuration, selecting the working mode of the I/O port, selecting the ADC channel, and starting the ADC.
3.1.2 Calibration
The calibration is to first input multiple reference voltage values using a reference voltage source before measuring the input voltage, and record the corresponding digital values by reading the ADC register value of the MCU, and save the values of these two items in the calibration table. When measuring the input voltage, the obtained digital value is substituted into the calibration table using the Lagrange interpolation algorithm to obtain the accurate input voltage value.
1) Correction table content The correction process is mainly to establish the connection between the actual input voltage value and the measured input voltage value by establishing a correction table. The correction table stores two items of data. One is the integer voltage value of 1 to 59 V, and the other is the sum of formula (5). Because the input voltage value measured by the system is an approximate value that only retains 2 decimal places, and the decimal digital value of the measured ADC and DAC in formula (5) is more accurate. It can be seen from formula (4) that the value of formula (5) is proportional to the measured input voltage value, so they have the same curve relationship with the actual input voltage. Therefore, the content of the other item stores the sum of formula (5).
2) The process of establishing the correction table is to input the voltage from 1 to 59 V every 1 V using a voltage source, and record the decimal value of the ADC and DAC digital quantity each time by reading the values of the ADC and DAC registers of the MCU. Substitute the recorded ADC and DAC values into formula (5) to calculate their sum and save it in the correction table.
3.1.3 Calculating the sum of formula (5)
The output voltage value of DAC is changed by changing the value of DAC register of MCU through program. When changing the value of DAC register, the value of ADC register is observed to determine whether the input voltage value of ADO is within the range. When the input of ADO is within the range, the digital decimal values of DAC and ADC of MCU can be obtained by reading the register values of DAC register and ADC respectively. Substituting the obtained values into formula (5) can get their sum.
3.1.4 Calculating Input Voltage
The function of calculating the input voltage is to calculate the input voltage using the Lagrange interpolation formula. By observing the data in the correction table through the coordinate axis, the actual input voltage value and the measured value satisfy a linear relationship. In the input voltage correction table, find the two points closest to the value of formula (6), and then substitute the Lagrange linear interpolation formula to calculate the input voltage.
3.2 Experimental Results
The accuracy of the input voltage measured by the traditional method directly into the ADC is ideally up to 59.1/1024=57.7mV. Due to hardware parameter errors and interference, the measurement error will be greater than 20mV, which cannot meet the measurement accuracy and accuracy requirements of the system. The measurement accuracy can be reduced to 0.45mV by using the 17-bit high-precision A/D measurement method proposed in this article, and the measurement error can be controlled within 10mV by software correction, which meets the design requirements. Through the method of improving measurement accuracy described in this article, a 20-bit ADC can be achieved at most, and the measurement accuracy can be reduced to 0.056 mV.
4 Conclusion
This method is easy to implement and can be applied in many data acquisition fields, such as sensor data acquisition, voltage signal measurement, etc. As long as the selected MCU has its own ADC and DAC, the method in this article can be used to achieve a high-precision and adjustable-precision ADC with a maximum accuracy of 20 bits.
Previous article:Efficiency Analysis of Class F/Inverse Class F Power Amplifiers
Next article:Analysis of technical characteristics of loudspeaker system
Recommended ReadingLatest update time:2024-11-17 02:38
- Popular Resources
- Popular amplifiers
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
- 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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- Summary of basic issues of ADC
- The design application of TGA2509 is not particularly ideal
- Analysis of the problem that the program cannot run after F28004x online debugging reset
- Share a PD fast charging power deception chip CH224 is very practical
- Alloy sampling resistor series
- TI's Class AB car amplifier chip recommendations
- I am majoring in measurement and control, and am planning to work in the embedded system industry. Could you please tell me if this is the right major for me?
- MSP432E401Y MCU intelligent car speed measurement function
- Motor drive video
- Guys, please help me, I've been stuck for 3 days and can't figure it out