In data acquisition systems, the zero drift of the preamplifier is the main source of detection errors, especially under harsh environmental conditions. For example, the infrared probe used for railway axle temperature detection must work reliably within the range of ambient temperature from -40℃ to +55℃. The temperature drift range of its zero point is very large, and it is difficult to completely solve it with simple software correction and hardware compensation technology. This article introduces the use of C8051F007 microcontroller to automatically adjust the zero point of the preamplifier through the on-chip DAC while performing temperature data acquisition and processing. The closed-loop adjustment method of "soft and hard" is used to compensate for the zero drift of the system.
According to the characteristics of this topic, since the ambient temperature changes very slowly, when the acquisition time is relatively short relative to the ambient temperature change, it can be considered that the zero drift amount during the acquisition process is relatively fixed. Then, when the zero drift occurs at the input end of the sensor differential amplifier, we can dynamically adjust the output reference point of the amplifier during the non-data acquisition time to offset the impact of the zero drift.
This method can also be used in other situations where the zero drift range of other sensors is large and the signal changes slowly.
Generation
of zero-point error
The sensor output voltage VS
consists
of
the zero-point voltage VZ
and
the signal voltage VR
.
VS
=
VZ
+
VR
VR
is
a
voltage directly related to the measured physical quantity and needs to be converted into a digital quantity through ADC.
VZ
is the zero-point potential. From a long-term perspective, VZ
tends
to change slowly with the ambient temperature, but in a shorter acquisition time, it can also be approximately regarded as unchanged.
In order to
amplify and collect
only VR
,
we will provide a compensation voltage
VN
separately
, and make VN
=
VZ
,
and
input
VS
and
VN
into the two input ends of a differential amplifier. Assuming the gain of the amplifier is G, the output of the amplifier is (VZ
+
VR
-
VN
)
G. If VN
=
VZ
,
the output is VRG
,
and the voltage we need is directly obtained. But in reality, VZ
will
change slowly over time, and we cannot always achieve VN
=
VZ
.
Once VN
≠
VZ
,
the output will produce a zero-point error (VZ
-
VN
)
G, especially when G is very large, the error will be very obvious.
According to the actual situation of the detection site, when there is no train passing and the probe stops collecting data, we can use ADC to continuously capture zero-point drift and output compensation voltage V
N
through DAC
to remove zero-point error at any time. When the train passes through the probe, the microcontroller stops the correction and latches the DAC zero-adjustment output. The probe starts working with the output state adjusted by the DAC at this moment as the detection zero point.
Introduction to main components
Instrumentation amplifier AD620
instrumentation amplifier is a dual-end input differential amplifier. In addition to the characteristics of high precision and high stability, its output zero reference voltage can be arbitrarily set through the voltage of REF pin, which makes it possible for us to adjust zero drift.
The input end of AD620 has an input impedance of up to 10
9
Ω; input offset voltage is 30uV, and output offset voltage is 400uV. The input bias current is very low, usually within 0.5nA and not more than 2nA; when the gain is 100, the gain error is 0.15%; when the gain is 100, the common mode rejection ratio is as high as 130dB; input noise
, output noise
. In addition, the temperature stability of AD620 is also excellent: when the gain is greater than 1, the temperature coefficient of gain is -50ppm, and the average temperature coefficients of input offset voltage and output offset voltage are 0.3uV/℃ and 5.0uV/℃ respectively.
Unlike general-purpose op amps, which use external resistors connected between input and output to control their closed-loop gain, instrumentation amplifiers use internal feedback networks. Their gain control resistors are not connected to the input and output terminals, and there are pins specifically used to connect gain setting resistors. The AD620 sets the gain by connecting a resistor between pins 1 and 8. The relationship between gain G and gain setting resistors is shown in Formula 1.
(1)
The
output of general-purpose op amps is relative to ground, while the output of instrumentation amplifiers is relative to the output reference pin potential of the amplifier. By applying different voltages to the output reference pin, the output zero point of the output voltage relative to ground can be set. The formula for the output voltage relative to ground of the instrumentation amplifier is shown in Formula 2.
V
O
=G(V
+
-V
-
)+V
REF
(2)
C8051F007 microcontroller
This design requires a high-speed MCU and high-precision ADC and DAC. Silicon Laboratories' high-performance microcontroller C8051F007 meets this need. The microcontroller integrates the 8051 core, but has a higher clock frequency and stronger processing power. The chip integrates 8 channels of 12-bit ADC and 2 12-bit DACs. In addition to completing the acquisition and processing tasks, there are also enough analog components for zero drift adjustment. Compared with using separate components, it not only improves reliability, simplifies the circuit, but also reduces costs.
· On-chip integrated DAC
The two DACs integrated on the C8051F007 chip are very simple to use. The DAC can use the 2.43V reference voltage provided by the microcontroller internally or externally. We use the internal reference voltage here. The reference voltage configuration register is REF0CN, and the address is 0xD1. Whether using DAC0 or DAC1, the 0 and 1 positions of the register need to be "1".
In this application, bit2 to bit0 are set to "000", that is, the MSB to LSB of the 12-bit conversion value are stored in bit3 of DAC0H to bit0 of DAC0L.
The setting process of DAC1 is the same as that of DAC0, so it will not be repeated.
Table 1
Table 2
· On-chip integrated ADC
The C8051F007 integrates an 8-channel 12-bit ADC. The 8 channels can be set as single channels individually or as double-ended differential acquisition in pairs. There is also a front-end amplifier at the input end of the ADC, and the amplification factor can be programmed. The ADC reference voltage can be provided externally or the internal reference voltage can be used. The internal reference voltage is 2.43V. Multiple ADC conversion start signals can be selected.
Before using the ADC, the reference voltage must also be set first. The setting process of the internal reference voltage can refer to the DAC.
Then set the ADC input mode register AMX0CF (address 0xBA) and channel selection register AMUX0SL (0xBB). The 8 input channels are divided into a group of two (channel 0 and channel 1, channel 2 and channel 3, channel 4 and channel 5, channel 6 and channel 7). Bits 0 to 3 of AMX0CF can set the mode of these four groups of inputs respectively. Setting "1" sets the two inputs in this group to double-ended input mode, and clearing 0 sets the two channels in this group to single-ended input mode. Bit3 to bit0 of AMUX0SL are input port selection bits, which control the multiplexer to connect an external input port to the ADC. For specific settings, please refer to the data sheet of C8051F007.
Register ADC0CF is used to set the conversion rate and input gain of the ADC. Address 0xBC, reset initial value 0x60, Table 1 gives the configuration description of register ADC0CF.
Bit7-Bit 5: ADC conversion clock setting, by setting 000 to 1xx to control the ADC conversion cycle to 1, 2, 4, 8 and 16 times the clock respectively. Bit4-
Bit 3: Unused
Bit2-Bit 1: ADC internal preamplifier gain setting, by setting 000 to 1xx to control the amplifier gain to 1, 2, 4, 8 and 16 times respectively.
ADC0CN register is used to control various conversion functions of the ADC. Address 0xE8, reset initial value 0x00, Table 2 gives the configuration description of ADC0CN register
Bit7: ADC start bit
0: ADC enters power-down state
1: ADC enters active state and can be converted at any time
Bit6: Sampling tracking mode setting
0: ADC is always tracking before the next sampling
1: Track ADSTM1-0 (Bit3-2) in the way set by ADSTM1-0 (Bit3-2)
00: Start tracking when writing 1 to ADBUSY, which requires 3 conversion cycles
01: Timer 3 overflows to start tracking, which requires 3 conversion cycles
10: Pin CNVTS rising edge starts tracking, which requires 3 conversion cycles
11: Timer 2 overflows to start tracking, which requires 3 conversion cycles
Bit5: Conversion completion interrupt flag
0: No conversion has been completed since the last interrupt flag was cleared
1: ADC completes a conversion
Bit4: ADC busy bit
Read:
0: Conversion completed or no conversion since reset; when the interrupt is enabled, this bit changes from 1 to 0 to trigger an interrupt
1: ADC is busy converting
Write:
0: No effect
1: If ADSTM1-0 (Bit3-2) = 00b, trigger a conversion
Bit3-2: Conversion trigger mode:
00: Write 1 to ADBUSY to trigger conversion
01: Timer 3 overflow trigger
10: Pin CNVTS rising edge trigger
11: Timer 2 overflow trigger
Bit1: Window comparison interrupt flag (software cleared)
0: Window comparison does not meet the match condition
1: Window comparison meets the match condition
Bit0: Data register left alignment setting bit
0: Data register right alignment
1: Data register left alignment
Zero drift correction process
First, we set the probe output to have no zero drift in a certain environment. Then, according to formula 2, we get the initial state instrument amplifier output as (V
+
-V
-
?)G+V
REF
. The midpoint potential of DAC0 output is 1.2V, that is, V
REF
=1.2V. We can adjust the adjustable potentiometer at the inverting input of the amplifier to make the amplifier output voltage V
C
, which is between zero and the maximum acquisition voltage of the ADC, slightly higher than 0V, so that the ADC can collect the situation where the amplifier output changes above and below this voltage. Since the ADC cannot collect voltages below 0V, the voltage cannot be selected as 0V. Here we choose 0.5V. If it is too high, the voltage acquisition range will be reduced. At this time,
(V
+
-V
-
)G+V
REF
=V
C
(V
C
=0.5) (3)
When the environment changes, assume that the sensor generates zero drift at this time
. Amplifier output
, zero drift
. At this time, the amplifier output voltage is collected through ADC. If the output is greater than V
C
, the output of DAC0 is reduced, that is, V
REF
is reduced
; on the contrary, if the output is less than V
C
, the output of DAC0 is increased, that is, V
REF
is increased
.
In this way, collect->adjust->collect... to stabilize the amplifier output voltage.
(4)
Comparing equation 3 and equation 4, we can see that we completely rely on the change of DAC0
to
offset it. Eliminating zero drift is a gradual approach process. The step size of each approach can be set by software, but due to the influence of DAC resolution, the minimum step size is the voltage represented by 1LSB of DAC, so we can only control the zero drift between 0 and the minimum step size. Limited by the output range of DAC, DAC0 outputs 1.2V at the beginning. If the zero drift at this time is set to V
D
(usually we think it is zero), then the maximum zero drift range we can adjust is [V
D
-1.2/G, V
D
+1.2/G]. When the system clock of the microcontroller is 16M, it takes at most hundreds of uS to complete a collection and adjustment cycle. The train passing time is generally less than ten minutes, and the data collection completed within this time will have little impact on the slow zero drift.
Hardware and software implementation
The hardware schematic diagram of the amplifier zero-point correction is shown in Figure 1.
Figure 1 Hardware schematic diagram of amplifier zero-point correction
The non-inverting input of the instrument amplifier is connected to the output voltage of the infrared sensor; the zero adjustment voltage is input to the inverting input. The gain setting resistor is connected between the 1st and 8th pins of the amplifier. The reference voltage input of the 5th pin is connected to the output of DAC0 on the microcontroller C8051F007, and the zero point of the amplifier is automatically corrected through the output of the DAC. In the actual circuit, VREF can also be adjusted by the potentiometer voltage divider to improve the adjustment fineness. The output voltage of the amplifier is sent to the ADC on the microcontroller through AIN0 and converted into a digital quantity.
The block diagram of the microcontroller C language programming is shown in Figure 2.
Figure 2 MCU C language programming block diagram
When the system is not collecting the output voltage of the sensor, it will adjust the system zero by itself. First, the reference voltage of the amplifier is set to 0.5V, that is, DAC0 outputs 0.5V. Then the output voltage of the amplifier is collected. If the output voltage is greater than 0.5V, the reference voltage can be reduced to offset the drift. On the contrary, if the output voltage is less than 0.5V, it means that there is a negative zero drift, and the reference voltage should be increased to offset the drift.
Conclusion
According to the output formula of the instrumentation amplifier, we can see that when the amplification factor is very high, the zero drift will also be amplified at the same time. In this way, if the zero drift range itself is too large, it may exceed the adjustment range of the DAC. Usually, the span of effective zero drift adjustment is slightly smaller than the output range of the DAC. A data area can be marked at both ends of the DAC output range as an over-limit mark. After each adjustment of the DAC0 output in the program, the size of the converted digital quantity must be checked at any time. Once the DAC output value is found to exceed the adjustment range, an over-limit warning can be issued in time.
In actual design, the adjustment of the zero point only solves one problem of this sensor. Other problems such as nonlinearity under different ambient temperatures need to be solved separately. Fortunately, the C8051F007 high-performance microcontroller is used, and its functions and speed can meet the above requirements at the same time.
Previous article:Design of Hydraulic Integrated Acquisition System Based on C8051F020
Next article:Design of remote power supply monitoring system based on c8051f020
- 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
- Has anyone tried the baud rate adaptation of LIN communication?
- Analog Electronics Design
- Will adding a nonlinear link to the RC bridge sine wave oscillation circuit cause waveform distortion?
- Introduction to TI_DSP link command file (*.cmd)
- [N32L43x Review] 2. Turn on the lights, blink, blink, blink...
- EEWORLD University Hall - Talking about the development creativity of electronic products and using network resources to help development
- The output of the op amp in the active integrator circuit oscillates. What should I do?
- Developing Minitel Applications with ESP32 and MicroPython
- CircuitPython controlled snowy Christmas tree
- When replying, just press CTRL+Enter to post directly. Details determine success or failure. You must be like Master Qiao.