Just a quick one.
On this topic: Fixing the non linear ADC of an ESP32
The user puts an offset on the ADC to get rid of the ADC being unresponsive at the low end. This is fine.
However the ESP docs say the internal voltage reference is also off +/- 10%.
Would you not also need to get a reading of your new virtual ground, and then also a reading of a known value (external reference voltage) to remove the issue with the internal voltage reference being off by so much? Maybe I'm missing something, but I don't see how he's overcoming the other two issues that need to be resolved.
@RIN67630 if you're still about, would you like to comment?
Sticking with the C3. The actual range of the ADC (SAR) is up to 1000 to 1200 mV. So they're already using an attenuation to get the range up to 2500. The thing is, the attenuation isn't great, so using that with the ADC can lead to worse results. I'm bringing my voltages down below 1V so I can turn off the attenuation.
Those figures are discussing how the ADC behaves after factory calibration, which obviously uses the attenuation. While Esperiff I'm sure has done good work in factory to get the best they can from the ADC, this is still going to lead to issues.
On to your next point, about the offset, that's one I cannot get the answer on. I found a thread where someone was reading the C3 ADC and said it had an offset, but I've lost the link. I'd love confirmation that it doesn't have the random offset that the ESP32 has, but I'd imagine it has to, and any links saying it doesn't are referring to unit after calibration.
@jim-p Thanks for your input, but that's not what I'm looking for.
Calibration should be equally valid for attenuation 0db.
According to the documentation I have seen, the offset is problem with "original" Esp32.
Easier to verify with 0.1V voltage source than searching from internet.
Any solution will be unique to the ESP. Also you may not be able to null out zero offset without external circuitry. Realistically from a measurement point of view the ADC is not fit for purpose.
I don't have an ESP32-C to test. I would have thought it was listed somewhere and all I can find are posts saying it's still there...
It'll be fine for me. It would be nice to know if the offset is still there though.
The original post was more about the users method as well! However I appreciate you bringing valid points to the discussion that I may be wasting my time.
The raw readings show that the ESP32-C3 exhibits gain error and slight non-linearity at higher voltage ranges. The calibration scheme corrects the gain error, but a relatively high error still persists at the upper voltage range.
The document referenced by @kmin as far as I can see still shows substantial integral and differentila non-linearity, and there is no indication of the stability of the reference voltage.
@johnerrington Yeah, so I've seen multiple charts which show issues at the high and low end (regardless of offset or whatever) of the ESP32-C3.
I've already done the hardware work that biases the voltage up about 90mV, and caps it at ~800mV (for a 10V input), so I think I'll stick with that.
I fully realise I'm losing nearly 40% of the range with this by the way! I have heavy external filtering, and in software I intend to do multi-sampling. Don't forget, I have an external reference voltage as well. Might get 11 bits of resolution over the 10V range, which will certainly be usable if it works at all
Thanks for your input and help guys!
Quick edit: I have 800 written above, assuming a lower Vref of 1000. I've this wrong in my notes, so will have to correct for this.