Many ESP32 project utilize a reliable Z reference to correct analog reading. Often, a simple solution utilizes a 1k resistance linked to the Z level output and earth. The provides a well-defined potential, generally https://arduino-uno-r3265544.signalwiki.com/user