+ Post New Thread
Results 1 to 11 of 11

13th July 2015, 15:48 #1
 Join Date
 Jan 2010
 Location
 SA
 Posts
 6
 Helped
 0 / 0
 Points
 1,711
 Level
 9
Voltmeter scaling resistor frontend and ADC calibration coefficients
I'm designing a voltmeter and current measurement system that forms part of a electronic load. Lets tackle the volt meter first.
I'm using a 16BIT ADC (AD7708) and want to measure the following voltages see below, the ADC is pretty neat for DC applications and is used in the BK8500 instrument.
Here us what I want to achieve.
0.1V to 25V ( A resolution of 1mV with an accuracy of 0.05%)
0.1V to 120Vmax ( A resolution of 10mV with an accuracy of 0.05%)
I've written the painful driver code (based on the datasheet) that does all initialization startup routines like zero calibration, internal DSP filtering, ADC gain and single ended operation mode. So far so good, it works, as I can measure good accuracy against my Fluke 87V from 1mV to 2.5V (ADC FSD)
Note: The ADC is using a external precession 2.5 Volt Reference (ADR421) and powered using a low noise power supply (DP832).
http://www.analog.com/media/en/techn...21_423_425.pdf
Question 1
I'm confused as to how to design a scaling resistor frontend with a suitable gain amplifier for the 25V range and 120V range.
so far my attempts are failing, the resistor divider ratio I used to scale for 25V are 100uV per 1mV for R1 = 18K and R2 = 2K (Where R1 and R2 presents a simple resistor divider)
Are there any good examples I can use as a guide for this sort of design?
Question 2
How does a design incorporate calibration coefficients, is there a standard design for this?
How much ADC coefficients are required to influence a measurement? Is it across the entire measurement range or only for low resolution readings.?

Advertisement

13th July 2015, 19:16 #2
Awards:
 Join Date
 Apr 2014
 Posts
 15,759
 Helped
 3590 / 3590
 Points
 77,782
 Level
 68
Re: Voltmeter scaling resistor frontend and ADC calibration coefficients
Hi,
wow, you´re one of the fewe that ask for help and give the specifications at the same time. Well done.
****
A 16 bit ADC uses 65536 equal voltage steps to decode teh analog voltage.
So with an input range of 25V you get a resolution of 0.381mV. The desired 1mV is well within.
For an accuracy of 0.05% you need a reference voltage matching this accuracy or better.
Also your 120V range should be no problem.
A1:
Depending on your needs you could choose a total input resistance.
The lowest i´d choose is about 100k. (Giving a max power dissipation of 144mW)
> Using lower ohmic resistors is good if your ADC input stage draws current or if you need fast settling time.
> using higher ohmic resistors decreases power dissipation = heating.
I´d use three resistors in a string. 100k, ca. 8k and 2k, each with a precision of 0.05% or better.
The 100k is your voltage input, the 2k at GND, the 8k inbetween.
With a CMOS switch you can choose two ranges: either use the connection between 2k and 8k (=25V range) or the connection between 100k and 8k (=120V range)
One range is 2.5V * (100k / (2k + 8k)) +1 = 27.5V
The other is 2.5V * ((100k + 8k) / 2k +1) = 135V
You could protect from overvoltage with lowleakage current diodes. Mind to use a switch capable to work with >12V signal voltage.
Depending on your sampling rate or desired reaction time you should add a capacitor at the ADC input acting as a low pass filter.
Q2:
You said you already have the offset and gain calibration done. You need to do this again for both input ranges independently.
with the rest m not sure what you mean. Could you please describe a bit detailed.
Klaus
1 members found this post helpful.

13th July 2015, 21:03 #3
 Join Date
 Jan 2010
 Location
 SA
 Posts
 6
 Helped
 0 / 0
 Points
 1,711
 Level
 9
Re: Voltmeter scaling resistor frontend and ADC calibration coefficients
Hi im glad someone replied, I am glad my effort for clarity was noticed, I understand taking someone else`s time to help me requires effort, which I appreciate.
Anyway.
I will play with those values, I have attempted a simple test using r1=100K and R2=1K which equates to 9.9uV per 1mV step, however as you pointed out a 16Bit resoultion will give 0.381mV/381uV steps unless I use some type of precession amplifier to bump the gain.. However, it looks like I can skip a frontend amplifier all together and correctly scale for 1mV steps for a 25VDC and 10mV steps for 120VDC
The CMOS switch I assume you mean a multiplexer they normally have internal resistance of +/100 ohms there about..
The voltage protection will be a secondary but important part low priority at the moment.
Depending on your sampling rate or desired reaction time you should add a capacitor at the ADC input acting as a low pass filter.
I have low pass filter buffers in place at 1kHz, and the ADC has an internal filter software selectable to filter noise as well, note this is a slow ADC and sampling is performed at CHOP = Enabled, fADC=5.35 (Hz), tADC=186.77 (ms) so its designed for low frequency measurements external high frequency noise is hardly an issue at this point. (I do see a 2mV offset when zeroing the input to ground which I need to manually null out later)
Q2
You said you already have the offset and gain calibration done. You need to do this again for both input ranges independently.
with the rest m not sure what you mean. Could you please describe a bit detailed.
Yes, the internal design of the ADC momentary performs zero calibration(basically connects to ground and zeros the output) this seems to be working well this is all done in software and its done for up to 8channels in single ended mode (of which I only use two one for current and voltage), however as you mentioned, further calibration seems to be required to compensate for resistor errors and design tolerances.

14th July 2015, 06:53 #4
Awards:
 Join Date
 Apr 2014
 Posts
 15,759
 Helped
 3590 / 3590
 Points
 77,782
 Level
 68
Re: Voltmeter scaling resistor frontend and ADC calibration coefficients
Hi,
A frontend amplifier for sure has benefits. Higher input impedance, lower input capacitance, adjustable gain, lower output impedance.
With this you can achieve fast settling time / higher bandwidth...
But it has disadvantages. Additional noise, unlinearity, distortions, current consumption. And limited output voltage. Since you wants to measure down to GND, even with a rail to rail opamp there are some tens of mV unreachable. If you can't live with that you need a negative power supply for the opamp.
Is a passive resistive divider with 110k Ohms ok for you?
In your software you need to multiply the ADC value to get the correct voltage value.
Do you use LSB value for it or full scale value?
Don't be afraid of using values like 0.9567 instead of 1.0000 ... The software doesn't care... just use the desired format to output your results.
CMOS switch, yes CMOS multiplexer, usually you don't have to care about 100 Ohms of on resistance. The voltage divider makes the precision and the 100 Ohms are in series to ADC, which introduces no significant errors...
Klaus

14th July 2015, 07:45 #5
 Join Date
 Jan 2010
 Location
 SA
 Posts
 6
 Helped
 0 / 0
 Points
 1,711
 Level
 9
Re: Voltmeter scaling resistor frontend and ADC calibration coefficients
Hi I have a few unused OP07 instrumentation opamps laying around, they look good for (DC applications) with low offset figures.
(Input Offset 75uV)
(Input Offset Current 3.8uA)
(ClosedLoop Bandwidth 600Khz)
I might just use them depends how well they perform, you are definitely correct with "some" opamps unable to reach the tens of mV figure, im thinking more brain work is required to fit an opamp in front end circuits, cost vs flexibility. Hey I think I should actually put a separate test rig to test this theory and performance figures for piece of mind.
Is a passive resistive divider with 110k Ohms ok for you?
When you say 110k I assume you mean R1=100K, R2=10K (I'm lazy, I use ElectroDroid`s potential divider calculator its fast and simple ;)
At 110k (R1+R2), 1mV = 90.909uV per step value, 27.5 VDC (max), output equates to a ADC full scale of 2.5V, so this is fine with me.
Also I dont get this part.
"2.5V * ((100k + 8k) / 2k +1) = 135V" Is it? R1= 108K (108+8), R2=3K(2+1) ?
10mV= 270uV per step, Max 120V=3.243V FSD
A R1=470K, R2=10K at 120v gives a FSD of 2.5v and 10mV= 208.333uV per step.
Thank you for the help thus far, sometimes just writing these things and explaining to someone can spark the idea and solution a problem.

Advertisement

14th July 2015, 10:19 #6
Awards:
 Join Date
 Apr 2014
 Posts
 15,759
 Helped
 3590 / 3590
 Points
 77,782
 Level
 68
Re: Voltmeter scaling resistor frontend and ADC calibration coefficients
Hi,
When you say 110k I assume you mean R1=100K, R2=10K
For OP07 you need at least 3V and +6V supply to be able to output 0...2.5V
Is there the need for an OPAMP?
(Input Offset Current 3.8uA)
Also I dont get this part.
"2.5V * ((100k + 8k) / 2k +1) = 135V" Is it? R1= 108K (108+8), R2=3K(2+1) ?
10mV= 270uV per step, Max 120V=3.243V FSD
If the ADC is between 100k and 8k, then the upper resistor is 100k, the lower is 8k +2k
If the ADC is between 8k and 2k, then the upper resitor is 108k and the lower is 2k
Klaus
   Updated   
Hi,
i just took a look into the datasheet...
It has a buffered input with PGA. So there is no need for an external OPAMP. And there is no need for a three resistor voltage divider and a CMOS switch. All is inside.
Just connect a simple two resistor voltage divider for 120V to 2.5 V (in fact your input range is 2.56V with a 2.50V Ref).
A 100k and a 2k should do the job. Add a 1uF film capacitor in parallel to the 2k.
now you have a 2.56V * (100k / 2k + 1) = 130.56V input range. (gain of 1)
or you have a 103.56V / 4 = 32.64V input range (gain of 4)
You can choose gain = 1, 2, 4, 8, 16, 32, 64, 128
With a gain of 128 you get an input range of 103.56 / 128 = 1.02V
Error: with 1nA input current and an input impedance of about 2kOhms you may expect about 2uV of additional offset error.
Klaus
1 members found this post helpful.

14th July 2015, 11:04 #7
 Join Date
 Jan 2010
 Location
 SA
 Posts
 6
 Helped
 0 / 0
 Points
 1,711
 Level
 9
Re: Voltmeter scaling resistor frontend and ADC calibration coefficients
I think I now understand your previous solution, I have made some DC sweep simulations and it came to me what I think you were suggesting.
The idea is to keep the first range on the 25V/1mV range scale, this is done by the micro basically if VIN < High_Range (where High_Range > 25V) the "auto range select" then selects the voltage nodes based on the measure condition.
25V range has a FSD of 2.5054234V @ 27.559657V
120v range has a FSD of 2.1818182V @ 120.000V
The OP07 I will save for the current sense amp.. (leave that for later)
Now, I saw your update, it makes my life better, but it means I need to change some parts of my C code. sorry I didn't notice and understand the PGA,I should have picked this up (but im a newbie), the PGA is smoking gun here.
I miss understood this, you just cleared it up in your example.
Programmable Gain Amplifier
=====================
The output from the buffer is applied to the input of the programmable
gain amplifier (PGA). The PGA gain range is programmed
via the range bits in the ADCCON register. The PGA has eight
ranges. With an external 2.5 V reference applied, and a PGA
setting of 128, the unipolar analog input range is 0 mV to 20 mV,
while the bipolar analog input range is ±20 mV. With a PGA
setting of 1, the unipolar and bipolar input ranges are 2.56 V.
When operating with chop mode enabled (CHOP = 0), the ADC
rangematching specification of 2 μV (typ) across all ranges
means that calibration need only be carried out on a single
range and does not have to be repeated when the PGA range is
changed. This is a significant advantage when compared with
similar ADCs available on the market. Typical matching across
ranges is shown in Figure 25. Here, the ADC is configured in
fullydifferential, bipolar mode with an external 2.5 V reference,
while an analog input voltage of just greater than 19 mV is forced
on its analog inputs. The ADC continuously converts the dc
voltage at an update rate of 5.35 Hz, i.e., SF = FFhex, 800
conversion results in total are gathered. The first 100 results are
gathered with the ADC operating with a PGA setting of 128.
[quote]
i just took a look into the datasheet...
It has a buffered input with PGA. So there is no need for an external OPAMP. And there is no need for a three resistor voltage divider and a CMOS switch. All is inside.
Just connect a simple two resistor voltage divider for 120V to 2.5 V (in fact your input range is 2.56V with a 2.50V Ref).
A 100k and a 2k should do the job. Add a 1uF film capacitor in parallel to the 2k.
now you have a 2.56V * (100k / 2k + 1) = 130.56V input range. (gain of 1)
or you have a 103.56V / 4 = 32.64V input range (gain of 4)
You can choose gain = 1, 2, 4, 8, 16, 32, 64, 128
With a gain of 128 you get an input range of 103.56 / 128 = 1.02V
[quote]
I will need to make some changes in my code and see what the results are.
Many thanks!

14th July 2015, 17:47 #8
 Join Date
 Jan 2010
 Location
 SA
 Posts
 6
 Helped
 0 / 0
 Points
 1,711
 Level
 9
Re: Voltmeter scaling resistor frontend and ADC calibration coefficients
Hi
So im using R1=100K, R2=2k with a ADC GAIN= of 1, 130V= 129.23vdc = 2.53V fsd, 1mV=19.0607uV per step.
I made changes to my code it looks like this.
Code C  [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
// Setup ADC SPI. adc_cfg_channel( ADC_CH1  ADC_CTRL_UNIPOLAR  ADC_GAIN1 ); /* Note: ADC adc_read() function obtains code, the conversion speed is based on settling time in ms, ADC the "SF word" controls Data Update Rate fADC (Hz) VS Settling Time tSettle (ms) see AD7708 Datasheet. */ // Obtain channel1 ADC code value. (Voltage) adc_code = adc_read(); // Convert from ADC Voltage Code to Volts. adc_voltage = adc_code_to_volts( adc_code); ADC_FS_CODE = 65536; ADC_VREF = 2.500; ADC_GAIN = 1.000; float adc_code_to_voltage(long adc_code) { float result = 0; result = ( adc_code * 1024 / ( ADC_FS_CODE / ( ADC_VREF / ADC_GAIN ))); return result; }
It works but how do I calculate the voltage with scale correctly?Last edited by BradtheRad; 14th July 2015 at 17:58. Reason: Added code formatting

14th July 2015, 19:00 #9
Awards:
 Join Date
 Apr 2014
 Posts
 15,759
 Helped
 3590 / 3590
 Points
 77,782
 Level
 68
Re: Voltmeter scaling resistor frontend and ADC calibration coefficients
Hi,
It works but how do I calculate the voltage with scale correctly?
Now you need to calculate this back with 1/0.01961 = 51
the formula now should be : result = 51 x adc_code *1.024 * ADC_VREF / ( ADC_FS_CODE * ADC_GAIN)
but you could safe processing power when you fist calculate a fixed ADC_factor
ADC_factor = 51 * 1.024 * ADC_VREF / ( ADC_FS_CODE * ADC_GAIN)
(calculate this only once)
and after conversion the calculation is simply:
result = ADC_code x ADC_factor
Klaus

16th July 2015, 21:54 #10
 Join Date
 Jan 2010
 Location
 SA
 Posts
 6
 Helped
 0 / 0
 Points
 1,711
 Level
 9

Advertisement

17th July 2015, 05:59 #11
Awards:
 Join Date
 Apr 2014
 Posts
 15,759
 Helped
 3590 / 3590
 Points
 77,782
 Level
 68
Re: Voltmeter scaling resistor frontend and ADC calibration coefficients
Hi,
When you do as I told you, then result is 13.56.
What should it be?
Code:and after conversion the calculation is simply: result = ADC_code x ADC_factor
+ Post New Thread
Please login