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
I meant 100k + 8k + 2k for both 25V and 120V range.When you say 110k I assume you mean R1=100K, R2=10K
indeed it is nA instead of uA.(Input Offset Current 3.8uA)
Three resistors in as string: 100k, 8k, 2k.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
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
I will need to make some changes in my code and see what the results are.
Many thanks!
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 channel-1 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?
Hi,
With your external voltage divider you get an input to output factor of U_Out = U_in *2k / (100k +2k) => U_Out = U_In * 0.01961
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
and after conversion the calculation is simply:
result = ADC_code x ADC_factor
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?