accuracy of adc

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
eliassh
Level 1
Level 1
10 sign-ins 5 sign-ins First reply posted

Hello I want to display the output value of adc on LCD and I encounter the problem that the accuracy varies between high input salts and low voltages, for example if the input value is 4.9195[V] it shows me 4.9988 on the screen, if the input value is equal to 1.6314 it shows 1.6856 on the screen.... Does it make sense that the error changes? I'm attaching my code, if anyone has encountered this problem and can help? Thanks.

uint16 enteros[3];
float voltages[3];
char str[2];

ADC_Start();
LCD_Start();
CyDelay(2000);

CyGlobalIntEnable;

for(;;)
{

ADC_StartConvert();
ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);
enteros[0]=ADC_GetResult16();
ADC_StopConvert();

voltages[0]=ADC_CountsTo_Volts(enteros[0]);
sprintf(str,"%.4f ",voltages[0]);
LCD_Position(0,0);
LCD_PrintString(str);

}
}

0 Likes
1 Solution

@eliassh ,

There are many reasons why your voltage reading on the LCD is different than what you might see on a DMM.

  • Your analog front-end is simple and minimal, so that's not a significant source of inaccuracy.
  • I'm assuming you are using VSSA to VDDA as the voltage reference for the ADC (please correct me if I'm wrong).   I'm also assuming your are using the USB programming/debugging cable as a source of your KIT-050 power.   If true this means VDDA is about 4.6V to 4.8V and not 5V.  Therefore the ADC will calculate ratiometrically to the actual VDDA voltage and not the expect 5V.  This will yield a different ADC counts per mV.   Suggestion: Use the bandgap reference as the ADC reference.  It is more stable and predictable.
  • You're using the potentiometer on the KIT-050 board.    Pots can be notorious for being noisy.  Suggestion:   Inject a known voltage.
  • If you are using VSSA to VDDA as the voltage reference and input near or above VDDA will yield a non-linearly incorrect value.  4.9988V will be above VDDA.
  • You DMM may not be very accurate under some conditions.   For example where are you placing the '+' probe?  Where are you placing the '-' probe?   If you place either probe on the wrong node, your reading may be off.   For example, if you place the '-' probe on VSSD instead of VSSA, it might be off by about 0.1V due to one is the digital GND (VSSD) and the other is the analog GND (VSSA) which is being used by the ADC as a '-' reference.

PS:  You may want to ask the moderator of this forum to move this thread to the "PSoC5, 3 & 1" forum since the CY8CKIT-050 is a PSoC5 and not a PSoC4.

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

3 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

@eliassh 

Are you using a PSoC kit?

Can you provide a schematic of the analog input front end circuit? 

In general there is some non-linearity in ADC readings. (For the PSoC4 the INL is about +/- 2ADC counts)  My observations is that they tend to show up at the extreme ends of the full-scale readings.

However depending on the analog front-end design (resistor divider network), it can be induced by some non-linear effects in the external components or in analog bus routing resistances.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

elias123_0-1678809804973.png

Hello and thank you for answering. Yes I am using the CY8CKIT-050 kit.

I connected the analog input with an external potentiometer.

I'm new to the field, do you have an example of how to connect a resistor network that will help reduce the accuracy? Or any source on the internet that explains but they do it. Thank you again...

0 Likes

@eliassh ,

There are many reasons why your voltage reading on the LCD is different than what you might see on a DMM.

  • Your analog front-end is simple and minimal, so that's not a significant source of inaccuracy.
  • I'm assuming you are using VSSA to VDDA as the voltage reference for the ADC (please correct me if I'm wrong).   I'm also assuming your are using the USB programming/debugging cable as a source of your KIT-050 power.   If true this means VDDA is about 4.6V to 4.8V and not 5V.  Therefore the ADC will calculate ratiometrically to the actual VDDA voltage and not the expect 5V.  This will yield a different ADC counts per mV.   Suggestion: Use the bandgap reference as the ADC reference.  It is more stable and predictable.
  • You're using the potentiometer on the KIT-050 board.    Pots can be notorious for being noisy.  Suggestion:   Inject a known voltage.
  • If you are using VSSA to VDDA as the voltage reference and input near or above VDDA will yield a non-linearly incorrect value.  4.9988V will be above VDDA.
  • You DMM may not be very accurate under some conditions.   For example where are you placing the '+' probe?  Where are you placing the '-' probe?   If you place either probe on the wrong node, your reading may be off.   For example, if you place the '-' probe on VSSD instead of VSSA, it might be off by about 0.1V due to one is the digital GND (VSSD) and the other is the analog GND (VSSA) which is being used by the ADC as a '-' reference.

PS:  You may want to ask the moderator of this forum to move this thread to the "PSoC5, 3 & 1" forum since the CY8CKIT-050 is a PSoC5 and not a PSoC4.

Len
"Engineering is an Art. The Art of Compromise."