Delta Sigma ADC for AVRs
Version 1.2
Uros Platise, uros.platise@ijs.si, MAPP 7. May 1999 (C)
Copyright
Key features:
- 8 bit precision
- 1/2 LSB INL, <1 LSB DNL
- no missing codes
- over 1 Mohm input impedance
- acquisition time T_a = 10 ms @ AVR clock 8 MHz - 80000 AVR cycles
- ultra low cost
- simple circuit
- very short software - 91 (S1200) or 110 (S*) words
- maximum input slew rate 20 mV/T_a
- no S&H circuit
- ideal for measuring DC and low frequency voltages, temperatures, ...
- supports complete Atmel AVR family MCUs
The introduced Delta Sigma Analog to Digital Converter is
built of only five elements: two resistors, capacitor, analog
comparator which is a part of AVR and voltage reference of
value half of the power supply voltage.
1. Input
High impedance input makes this ADC useful in many low
cost applications. In its present form, the bandwidth
is limited down to 0.3 Hz at AVR clock 8 MHz what makes
it suitable for measuring DC or low frequency voltages.
Frequency range may be extended using the
sample and hold circuit (S&H).
The result is proportional to the
integral of the input voltage by time during conversion.
The input range does not achieve full 8 bit scale but
approximately 8 LSB less on the end of the scale.
This is caused by the two types of error: constant offset
and non-linear characteristics of the converter.
Therefore the input voltage ranges from 0 to 247 what is
97% of the full scale. Inside that range there are
no missing codes and standard deviation is 1/2 of the LSB.
The scale constant equals:
k = Ucc / 255 [V/d]
and measured voltage Ui is then
Ui = k x [V]
where x is ADC result in the range from 0 to 247.
Input noise can increase the non-linearity of
the result over 1 LSB on the borders. That
is why it is important to filter the input signal and limit
the noise under 40 mV. This ADC is intended
for measuring DC and very low frequency voltages so such
a filter is definitely not problematic at all.
2. Schematics
The schematic design shows pin connections and the four
elements with voltage reference.
Resistors R1 and R2 are of 1 Mohm each and trimer P1
is 100 kohm. The optimal value of the capacitor C1
follows the equation:
C1 = -(1/R1+1/R2)*4*dT / log((Urf-eh-Uh)/(Urf-el-Uh))
Substituting the known variables and setting the R=R1=R2 we get:
C1 = 9.5/(R f) [nF]
where R is in Mohm, f in MHz and result C1 in
nF. Some precalculated values for R=1 Mohm:
f = 1 MHz, C1 = 9.5 nF
f = 2 MHz, C1 = 4.7 nF
f = 4 MHz, C1 = 2.3 nF
f = 8 MHz, C1 = 1.2 nF
f = 12 MHz, C1 = 0.8 nF
f = 16 MHz, C1 = 0.56 nF
The value of the capacitor should be rounded to the nearest
available element.
The trimmer resistor P1 is used to eliminate the linear error
caused by the difference between resistors R1 and R2 and by the output
voltages (Voh and Vol) of the digital output pin PB2. The same
parts also produce constant offset which is compensated internally by
the software constant during calibration process.
For testing purposes, voltage reference was built of LM335-2.5
zener diode. But this is not always necessary. At certain conditions
the cost of the voltage reference may be reduced down to simple
resistor network.
3. Calibration
Supply two constant voltage sources to the input. Good choice
is zero volts (0 V) and the voltage close to the
maximum range (for example 4 V when Ucc = 5 V).
Then rotate the trimmer resistor P1 and monitor the results
until you get the constant offsets on both levels. Then check
the other values such as: 2.5 V (128), 1.25 V (64), 3.75 V (192).
Update the constant voltage offset error by means of macro
DS_ADC_OFFSET_VOLTAGE,
rebuild the code and programme the AVR MCU.
Offset value compensates internal systematic error and voltage
reference error. Typical values are 3 to 5 if voltage reference
is inside of the +-1 LSB. By default is set to 4.
4. Test Results
The following two pictures represents test results using the
AVR AT90S8515 running at 8 MHz.
The first graph shows the U_adc(U_in) and the second absolute
error U_adc - U_in. Number of samples per voltage for both
graphs is 1.
The absolute error is under 1 LSB (20 mV) on
full input range from 0 to 4.86 V.
Note: all voltages are in volts.
Home