This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS7828 unstable values

Hi,

Im using an ADS7828E in my design and its giving me unstable values. Im driving it with 5V, the Analog Input is 1.6V.


With internal 2.5V Reference, I get around 1.9V as data output, which is wrong. With external 5V I get 1.625V which is still 25mV too high.

Here is my Code:

uint16_t readADC(char sensor) {
  const byte DAT[8] = {0x8C, 0xE4, 0xF4, 0xD4, 0xA4, 0xE4, 0xB4, 0xF4}; // Constant configuration data

Wire.beginTransmission(ADC7828E_I2C_Adress); //Adress with Write Adressing byte at the end
 Wire.write(DAT[sensor]); 
  byte endmessage = Wire.endTransmission(); //Send Transmission Buffer
  if (endmessage == 0) { //Checking if the MCP9808 is available
    LOG("ADS7828E recognized");
  }
    else if (endmessage == 1) { //Checking if the MCP9808 is available
    ERR("ADS7828E data too long to fit in transmit buffer ");}
    else if (endmessage == 2) { //Checking if the MCP9808 is available
    WARN("ADS7828E NACK received  on transmit of address ");}
    else if (endmessage == 3) { //Checking if the MCP9808 is available
    WARN("ADS7828E NACK received  on transmit of data ");}
    else if (endmessage == 2) { //Checking if the MCP9808 is available
    ERR("Failed to recognize ADS7828E"); }
  uint16_t values;
  // Read A/D value
  Wire.requestFrom(ADC7828E_I2C_Adress, 2); 
  byte bytes[2]={0,0};
  int bytesRead;
  while (2 > Wire.available()) {}
  for (bytesRead = 0;  bytesRead < 2; bytesRead++) {
    bytes[bytesRead] = Wire.read();
  }
  values = (int)((bytes[0]<<8) + bytes[1]);
  return (values);
}

Calling it like this:

uint16_t adcvalue1[5];
  uint16_t average1 = 0;
  for (int i = 0; i < 5; i++) {
    Serial.print("Channel 1 First Measurement number ");
    Serial.print(i);
    Serial.print(" : ");
    adcvalue1[i] = readADC(0);
    Serial.println(adcvalue1[i]);
    average1 += adcvalue1[i];
  }
  Serial.print("Channel 1 First average: ");
  Serial.println(average1 /5 );

  uint16_t adcvalue2[5];
  uint16_t average2 = 0;
  for (int i = 0; i < 5; i++) {
    Serial.print("Channel 1 Second Measurement number ");
    Serial.print(i);
    Serial.print(" : ");
    adcvalue2[i] = readADC(0);
    Serial.println(adcvalue2[i]);
    average2 += adcvalue2[i];
  }
  Serial.print("Channel 1 Second average: ");
  Serial.println(average2 /5 );
Serial.println("");

and the result is this:

Channel 1 First Measurement number 0 : 1268
Channel 1 First Measurement number 1 : 1289
Channel 1 First Measurement number 2 : 1304
Channel 1 First Measurement number 3 : 1312
Channel 1 First Measurement number 4 : 1317
Channel 1 First average: 1298
Channel 1 Second Measurement number 0 : 1319
Channel 1 Second Measurement number 1 : 1320
Channel 1 Second Measurement number 2 : 1322
Channel 1 Second Measurement number 3 : 1325
Channel 1 Second Measurement number 4 : 1326
Channel 1 Second average: 1324

As you can see, I even get two different values with the same for loop! Why? Also, it looks like the ADC needs some time to Charge? I do have a capacitor and a Resistor in parallel to CH0

.

On CH0, there is a MPXH6300A6U Pressure Sensor which outputs 1.6V

Any Suggestions?

Thank you!

  • Hi Patrick,

    Yes, the ADC output appears to be settling slowly and this is due to settling problems associated with the ADC input or reference voltage.

    The pressure sensor has an approxiamtely 10kOhm output resistance (4.9V/0.5mA) which is quite high. Not only will the ADC input settle slowly but the DC current through the 51kohm resistor will create an additional 16% (or 266mV) steady state error in the ADC input. So I think reducing the source resistance driving the ADC input will improve ADC accuracy, unless there are gross problems with the ADC reference input as well. Could you please post a schematic of your ADC block?

    As an experiment, could you try replacing the pressure sensor with a 1.5V AA battery? A battery has only an ohm or so of output resistance, so the settling characteristics of the ADC input should be much better. Also, at what speed are you running the I2C bus?

    Regards,
    Harsha