On-chip ADC/DAC to implement precision adjustable ADC solution

Publisher:DataExplorerLatest update time:2012-10-29 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Schematic diagram of implementing 17-bit ADC

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.

Reference address:On-chip ADC/DAC to implement precision adjustable ADC solution

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

STC12C5A60S2 AD conversion C language sample program (ADC query mode)
STC12C5A60S2 C language sample program (ADC query mode) #include "reg51.h"  #include "intrins.h"  #define FOSC    18432000L  #define BAUD    9600 typedef unsigned char BYTE;  typedef unsigned int WORD;  /*Declare SFR associated with the ADC */  sfr ADC_CONTR   =   0xBC;           //ADC control register  sfr ADC_RES   
[Microcontroller]
AVR MCU Learning ATmega16 ADC
Conversion rate: The number of samples taken per second. Common units: SPS (times per second) KSPS (kilosamples per second) MSPS (millionsamples per second). The faster, the better. Conversion precision: The number of significant digits (in binary) of the conversion result. Unit: bit AVR's on-chip ADC: Maxim
[Microcontroller]
AVR MCU Learning ATmega16 ADC
Automatic digital voltmeter based on 51 single chip microcomputer and ADC0808 ADC0809
Preface: Previously, we talked about the automatic digital voltmeter based on the digital tube display. Next, let’s talk about the related designs based on LCD1602 display, which use TI’s ADC0808 and ADC0809 respectively. Hardware and software design Based on 51 MCU + ADC0808 + LCD1602, the test voltage range is 2.1
[Microcontroller]
Automatic digital voltmeter based on 51 single chip microcomputer and ADC0808 ADC0809
STM8 study notes---ADC multi-channel sampling
The STM8S003 microcontroller has a total of 5 ADC sampling channels, from AIN2 to AIN6. When sampling multiple channels, the ADC conversion needs to be set to single conversion mode. Each time the sampling channel is switched, the ADC needs to be reinitialized and the sampling results are read in the interrupt. IO p
[Microcontroller]
STM8 study notes---ADC multi-channel sampling
ATmega32 ADC Noise Suppression Mode
When SM2..0 is 001, the SLEEP instruction will put the MCU into noise suppression mode. In this mode, the CPU stops running, while the ADC, external interrupts, two-wire interface address configuration, timer/counter 0 and watchdog continue to work. This sleep mode of ATmega32 only stops clkI/O, clkCPU and clkFLASH, a
[Microcontroller]
Challenges of ADC Technology in SDR Implementation
This article mainly discusses the challenges of analog-to-digital conversion in SDR implementation and what breakthroughs in ADC can promote the practical application of software radio. Problems For telecommunications companies, SDR can meet the needs of a wide range of radio frequencies and standards with
[Analog Electronics]
Challenges of ADC Technology in SDR Implementation
STM32 ADC input channel configuration
There are up to 3 ADC modules in STM32, and the channels corresponding to each module do not completely overlap. The figure below is the lower left corner of the general block diagram in the STM32F103CDE data sheet. It can be seen from the figure that 8 external ADC pins are connected to 3 ADC modules, 8
[Analog Electronics]
STM32 ADC input channel configuration
STM8S ADC self-study notes 1
Because the chip is stm8s105c6t6, the internal ADC is ADC1. I looked at some registers of ADC1 a few days ago and wrote a simple single conversion program. Using 1602 display, the last 2 digits of the displayed voltage value jump a lot. The 10-bit AD accuracy to mV level should be no problem. I don't know if it is rel
[Microcontroller]
Latest Analog Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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号