Noise when activating analog inputs
-
I'm testing the M5stack as a measure of analog signals on the GPIO 35, with good results but I don't know why reason makes a strange noise when measuring.
It's as if the speaker is activated with measurements and makes noise. I can't upload a video to show it. In case anyone has interest I'm measuring the output of a 60k potentiometer, taking 3.3 voltage and Gnd reference. -
I just programmed another ESP32 (Heltec LoRa) with micropython reading analog values from GPIO 34 and observed quite a noise (and drift). Apparently the noise is typical for the ESP32 family microcontrollers due to crosstalk from other components on the chip such as Wifi, Bluetooth, clocks. In their spec Espressif talks about a mean noise of +/- 7 digits on the GPIO ADC channel 1 (GPIO 32-39). In order to improve your readings you should consider two improvements:
- Your 60k potentiometer is quite big. Normally a 10K is used (as in the M5Stack angle unit).
- As described in the Espressif API reference
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/adc.html#minimizing-noise
you can minimize noise for your ADC readings by adding a capacitor between the ADC GPIO input line and GND as well as taking the avarage of multiple readings (multisampling) . Here is the graph of the Espressif document showing the improvement of the ADC readings:
ADC channel 2 (GPIO 0,2,4,12-14,25-27), is supposed to be noisier, because it's also used by the WiFi component. The M5Stack speaker is attached to GPIO Pin 25 (ADC Channel 2).
-
@crami25 Thank you very much for this information. I have improved with the capacitor, without changing the potentiometer (I only have that at hand). I'm using the range adjustment at 1.5 v ( ADC_2_5db) and making analogSetSamples(16) , I get this dispersiĆ³n that would be by 0.2%. It's all right. I'll keep testing, Greetings.