3
\$\begingroup\$

I'm using an NAU7802 ADC which has a built in amplifier. I'm trying to use it to read a strain gauge but it keeps giving me weird readings.

Eventually I resorted to shorting the two differential inputs together so that it should read 0, however these are the readings I actually get (at 80 Hz, gain = 128):

ADC result

As you can see, most of the time the reading is correct, but every 0.4s or so it has a burst of nonsense.

I am pretty sure that my code is correct (I can't post it, sorry). Note that I am polling the device for DRDY (data ready) rather than interrupting on it. That shouldn't make a difference but I'm kind of at a loss as to what is causing this.

Does anyone have any suggestions? I've added capacitors to just about everywhere I can and put everything in a metal box so I don't think it is EMI.

I am going insane.

Update, it gets weirder

So I changed my code a bit so that it uses the DRDY interrupt, like this (I couldn't get I2C to work within the ISR for some reason, hence the boolean):

    // In setup()
    attachInterrupt(1, adcIsr, RISING);
}

volatile bool dataReady = false;

void adcIsr()
{
    dataReady = true;
}

loop()
{
    if (dataReady)
    {
        Serial.println(adc.readADC());
        dataReady = false;
    }
}

And now I get this graph. The magnitude of the triangles is independent of the gain!

mystery triangles

I seriously have no idea what is going on now. It seems like some kind of timing issue but the data sheet says whenever you read the ADC output it latches and gives you the last one.

\$\endgroup\$
2
  • \$\begingroup\$ Troubleshooting some ADC problems, someone else on this website suggested feeding a known, fixed voltage to the input. See what that nets you \$\endgroup\$
    – HL-SDK
    Nov 19, 2013 at 15:01
  • \$\begingroup\$ A schematic of your circuit and a photo showing your construction techique could help us understand what's going on. \$\endgroup\$
    – The Photon
    Nov 19, 2013 at 18:03

2 Answers 2

2
\$\begingroup\$

Aha, I finally found the answer in this code!

The datasheet mentions a couple of "choppers" - ADC chopper and PGA chopper, but doesn't really say what they are and at least in the case of the ADC chopper there is only one value that isn't reserved (off). It turns out the non-reserved value isn't the default! If you turn off the ADC chopper it gets rid of the weird triangle wave. A small amplitude sine wave remains, but if you turn off the PGA chopper that goes too. Here is the relevant code (writeReg is the obvious implementation).

writeReg(OTP_B1, 0x30);
writeReg(PGA, PGA_OUTPUT_BUFFER_ENABLE | PGA_PGACHPDIS);

Stupid datasheet.

\$\endgroup\$
1
\$\begingroup\$

Without more information, it is difficult to diagnose a specific issue, but there are a few things you can try:

  • If you have an oscilloscope, you could directly measure the input signal to the ADC to determine whether the noise is in your circuit (and thus the ADC is working properly), or internal to the ADC.
  • Is your design powered from a supply external to the box? If so, you could be coupling noise into your system through the power supply system.
  • There is a reference circuit on page 26 of the datasheet you provided. How close is your circuit to that, especially with respect to the placement of capacitors?
  • 128 is a huge amount of gain to be using; if you drop it down, how does the signal level change?

  • You said you tied the diff inputs together; did you tie them to a specific circuit point? Without that, it's possible that you're having common-mode rejection issues.

Noise is a really tricky problem to solve; unless you can isolate its source, you're a little bit stuck. Look for any signals running at around 1 or 2 Hz, or even higher frequency signals that are bursting at that rate, or could be rectified to it. Finally, assuming that your y-axis labels are the 24-bit integer values you're getting out of your ADC, it looks like your noise floor is still at ~-55dBFS; I don't know what your signal levels are, but have you tried using a nice, quiet op-amp on your input signal, instead of the internal PGA? Depending on the noise source, that could make your life easier.

EDIT: New idea: you don't say whether you've calibrated the ADC. The datasheet includes a fairly sizeable chapter on calibration procedures, which would be worth running through to clear up some potential internal errors. Moral of the story: when in doubt, reread the datasheet.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ See my updated question. It looks like some kind of weird timing issue, or I2C issue... At any rate I'm fairly confident it isn't noise or calibration now given the shape of the graph and its independence from gain. \$\endgroup\$
    – Timmmm
    Nov 19, 2013 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.