Note that when programming micro-controllers, specifically those supported by Arduino such as the Expressif/ESP chips, when reading analog signals, that sensors have to have a common ground with the controller or all readings will be completely out of whack.
The common "mistake" that is very easy to make, is to plug in one of these controller boards to the PC via the USB socket, thereby powering the controller up, then powering the sensors separately (for example, from an already existing PCB) and then reading the analog signal from the sensor which will be completely nonsensical. To correct the issue, simply connect the ground to the same ground that the sensor is powered with.