ADC reading degrading over time

DanielPLongo
Posts: 11
Joined: Fri Apr 08, 2022 6:02 pm

ADC reading degrading over time

Postby DanielPLongo » Tue Mar 28, 2023 9:17 pm

I am using GPIO32 as a 12-bit input pin to read a voltage from a sample and hold circuit. I am monitoring the reading with a UART to serial monitor connection. My oscilloscope shows the voltage level does not diminish over time, but the reading from the ESP32 does at a rate of 15 points per minute (eg reading degrades from 3339 to 3263 over 5 minutes with the same input voltage). This degradation continues to a point where at some point GPIO32 begins to put a 1V output on the pin.
The pin is protected by a 3V Zener diode. The hold capacitor from which the reading is taken is fed by a mosfet that is sourced from VDD, such that the pin is protected on both sides of the sample and hold circuit by a 3.0V and 3.3V limit respectively. The degrading signal would suggest some sort of damage or derating is happening at the pin, but there is no obvious cause from the circuit itself. Has anyone seen this behavior?
One mitigation I have tried to use without success was to change GPIO32 to a digital OUTPUT and then set it LOW between readings to protect the pin from any unseen event by sinking the current rather than affecting the ADC with it.
This behavior is also seen if I use an INPUT ONLY pin like GPIO35.
The ADC is no longer functional overnight. I need to resolve this. Any help is greatly appreciated. Thanks!

ESP_Sprite
Posts: 8884
Joined: Thu Nov 26, 2015 4:08 am

Re: ADC reading degrading over time

Postby ESP_Sprite » Tue Mar 28, 2023 11:51 pm

Can you post a schematic of the circuit?

DanielPLongo
Posts: 11
Joined: Fri Apr 08, 2022 6:02 pm

Re: ADC reading degrading over time

Postby DanielPLongo » Wed Mar 29, 2023 1:31 pm

S&HCircuit.png
S&HCircuit.png (131.34 KiB) Viewed 2005 times
LineVADC is connected to GPIO32

ESP_Sprite
Posts: 8884
Joined: Thu Nov 26, 2015 4:08 am

Re: ADC reading degrading over time

Postby ESP_Sprite » Thu Mar 30, 2023 6:32 am

I agree that there isn't anything directly coupling the Vac into the IO-pin... perhaps there's some inductive coupling going on? Are you using a ground plane between the zener and cap and the ground of the ESP32 / AC? Asking because if something coupled into that circuit, the zener and cap have no way of stopping it.

DanielPLongo
Posts: 11
Joined: Fri Apr 08, 2022 6:02 pm

Re: ADC reading degrading over time

Postby DanielPLongo » Thu Mar 30, 2023 2:36 pm

The zener, capacitor, and ESP32 share a common ground plane on a 2-layer PCB. The trace from the zener/capacitor junction to GPIO35 is 4mm. There are no other traces running parallel or close to it. There is one trace running perpendicular to it on the underside of the board, but it is a 3.3V pulse from the ESP32. Given its orientation and low current, I don't see any coupling there. Did I answer your question?

ESP_Sprite
Posts: 8884
Joined: Thu Nov 26, 2015 4:08 am

Re: ADC reading degrading over time

Postby ESP_Sprite » Fri Mar 31, 2023 12:10 am

It does. Unfortunately, that was also the only explanation for what you're experiencing I had left. All I can say is that I have never seen an issue like yours (degrading ADC performance within 24hrs) before at all, so statistically it's likely that what you're seeing is specific to your setup. I have no idea about the mechanism that causes it, though.

vanBassum
Posts: 68
Joined: Sun Jan 17, 2021 11:59 am

Re: ADC reading degrading over time

Postby vanBassum » Fri Mar 31, 2023 6:09 am

Does the same problem occur if you apply a constant voltage to the pin from a regulated power supply? Just to eliminate all possibilities of the hardware.

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 59 guests