Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Periodic severe noise on ADC
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Periodic severe noise on ADC

by iko79 on Tue Jun 02, 2020 8:00 am

Hi,

I've got a HUZZAH32 ESP32 feather board connected to my PC via USB and I'm trying to read from a voltage divider via ADC at A0 (GPIO #26), 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 | TOGGLE FULL SIZE
#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 25 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?

iko79
 
Posts: 3
Joined: Tue Jun 02, 2020 7:45 am

Re: Periodic severe noise on ADC

by adafruit_support_bill on Tue Jun 02, 2020 8:33 am

The ESP32 processors do have a reputation for noisy analog and there are a number of posts on the subject around the web like this one: https://www.esp32.com/viewtopic.php?t=7543

Esspressif does have some specific advice on minimizing it here:
https://docs.espressif.com/projects/esp ... alibration

adafruit_support_bill
 
Posts: 77964
Joined: Sat Feb 07, 2009 10:11 am

Re: Periodic severe noise on ADC

by iko79 on Tue Jun 02, 2020 9:50 am

Thanks for your reply.

I am aware of the page at the espressif documentation. Since the source of error does not seem to be the signal itself, filtering it with a capacitor will not help (and in fact it does not, I tried). I do realize that I can multisample and filter in software to reduce the jitter, however the amplitude here is too much to handle, unfortunately. Lowpassing the signal so the introduced lag is still acceptable still leaves me with unacceptable bumps in the signal.

What I am trying here is to get confirmation that this is indeed normal behaviour, so I can move on and make decisions about what HW to use. (Or, in case it is not, to find out what to do about it.) I just want to be sure I didn't miss to turn off something I don't know about, say, some RF module that's frequently scanning and interfering in doing so.

Therefore: would you think this is as good as it gets with the board at hand?

iko79
 
Posts: 3
Joined: Tue Jun 02, 2020 7:45 am

Re: Periodic severe noise on ADC

by adafruit_support_bill on Tue Jun 02, 2020 10:20 am

It would not surprise me if there was some asynchronous WiFi activity in the background that could influence readings in some way. But we don't have much visibility on the internals of the chip. You may find more detail on the subject over at the esp32 forum: https://www.esp32.com/

adafruit_support_bill
 
Posts: 77964
Joined: Sat Feb 07, 2009 10:11 am

Re: Periodic severe noise on ADC

by iko79 on Wed Jun 03, 2020 3:41 am

Alright, thanks!

iko79
 
Posts: 3
Joined: Tue Jun 02, 2020 7:45 am

Please be positive and constructive with your questions and comments.