Page 1 of 1

Periodic noise on ADC

Posted: Wed Jun 03, 2020 8:37 am
by ithrak
Hi,

I was sent over from the Adafruit forum, since this question seems to concern the chip, not the board. See the original thread here.

I've got an Adafruit HUZZAH32 ESP32 feather board connected to my PC via USB and I'm trying to read from a voltage divider at ADC1 channel 0, powered by the 3V pin. For troubleshooting, I'm using two regular metal-film resistors to be sure the values don't change. What I'm doing in Arduino code is quite straightforward:

Code: Select all

#include <Arduino.h>

void setup()
{
  Serial.begin( 115200 );
}

void loop()
{
  int raw = analogRead( A0 );
  Serial.println( raw );
  delay( 10 );
}
While I would judge the readings as rather noisy (RSD = +/-0.5%) I noticed periodic noise showing up (approx. every 7 seconds), with is quite high (RSD = +/-6%). I was suspecting that the powering via USB could be an issue, but what's strange to me is that on other boards (Arduino Uno, Due, a number of different ESP8622 boards) don't seem to have a problem, the ADC readings are constant.

Here's a plot of what the values look like over a period of 60 seconds:
v6HlD.png
v6HlD.png (59.26 KiB) Viewed 7548 times
I realize the ADC of the ESP32 is not perfect and I can furthermore reduce noise by supersampling, but jitter like this is too much to handle. I tried putting the board into a shielded enclosure, that didn't help. I tried with an external constant voltage source, also didn't help. I measured with an Oscilloscope and it turns out the periodic noise is not present at A0, it seems to come from something inside of the board or chip. I tried different channels of both ADCs, also tried different HUZZAZ32 boards to exclude the possibility of broken HW, it's the same on all boards.

Any ideas where this may be coming from and how to get rid of it? Did I forget to disable something, that's turned on by default? Just like the Adafruit forum moderator, I suspected that something is going on in the background that I'm not aware of, e.g. Wifi periodically scanning or what not.

Re: Periodic noise on ADC

Posted: Wed Jun 03, 2020 2:01 pm
by WiFive

Re: Periodic noise on ADC

Posted: Mon Jun 08, 2020 3:35 am
by Beowulff
How are your grounds?

Re: Periodic noise on ADC

Posted: Mon Jun 08, 2020 2:06 pm
by ithrak
Beowulff wrote:
Mon Jun 08, 2020 3:35 am
How are your grounds?
What do you mean, could you elaborate? Voltage divider is grounded at GND pin. The board is powered and grounded by USB connection to my PC, but I wrote that, so I doubt this is what you're asking.

Re: Periodic noise on ADC

Posted: Tue Jun 09, 2020 2:43 pm
by Beowulff
ADC’s are very sensitive to grounding issues.
Ground bounce caused by high-current digital peripherals will manifest as spurious signals at the ADC. Grounds should be single-point, or ground plane, and not thin, meandering traces.

See: http://www.ti.com/lit/an/sbaa052a/sbaa0 ... 1713714180
And: https://www.analog.com/en/analog-dialog ... unded.html#