ADC.SPIN inconsistent readings
william chan
Posts: 1,326
Hi All,
I have been getting reading inaccuracies with ADC.SPIN on a commercial double sided PCB and have been wondering why nobody else has complained so far.
First I use a 12k and 5k voltage divider to get a sample voltage of a 2 cell Li-Ion battery down to Propeller's 3.3v range.
Then I use 100k for the detecting resistor and also 100k for the feedback resistor.
All parts are placed very close to the Propeller pins.
The Propeller chip is running at 40Mhz and the ADC is set for 8 bit sampling.
The thing is, when I use 10nF adc capacitor to ground only, I get about 7% error or inconsistency in readings.
When I change it to 1nF, the error improves to about 4%.
It seems, that the lower the capacitance value, the more consistent the readings get, so much so until I should be using about 10pF to get less than 1% error rate.
I don't mind going with 10pF capacitance but I worry because the recommended value is 10nF.
Anybody?
I have been getting reading inaccuracies with ADC.SPIN on a commercial double sided PCB and have been wondering why nobody else has complained so far.
First I use a 12k and 5k voltage divider to get a sample voltage of a 2 cell Li-Ion battery down to Propeller's 3.3v range.
Then I use 100k for the detecting resistor and also 100k for the feedback resistor.
All parts are placed very close to the Propeller pins.
The Propeller chip is running at 40Mhz and the ADC is set for 8 bit sampling.
The thing is, when I use 10nF adc capacitor to ground only, I get about 7% error or inconsistency in readings.
When I change it to 1nF, the error improves to about 4%.
It seems, that the lower the capacitance value, the more consistent the readings get, so much so until I should be using about 10pF to get less than 1% error rate.
I don't mind going with 10pF capacitance but I worry because the recommended value is 10nF.
Anybody?
Comments
Is this 12 bit ADC or are you going for higher resolution. 16bit was recently discussed as being rather unnecessary.
I have to take a look at he ADC.SPIN object and stop guessing what you are doing.
2. At the summing junction, there should be caps to both Vss and Vdd. This is to ensure that noise on the power rail does not shift the logic threshold relative to the voltage at the summing junction.
-Phil
I wish to report that changing the input resistor to 150k and capacitor value of 22pF to Vss, I managed to get about about 0.5% accuracy which is good enough for my application of detecting Li-Ion battery voltage.
It seems like beau's ADC.SPIN code requires a much lower capacitance value than recommended. This fact has been confirmed 3 times on 3 different projects.
-Phil
I'd say that 0.5% accuracy is excellent.