user61448: I have a 'Capacitive Soil Moisture Sensor' hooked up to my Uno.
Very simple code. AnalogRead(MoistureSensorPin);
This will return a differing value that I can work with.
When applying the same code to an ESP32 with a similar set-up. It always returns '4095' which I understand is the maximum value an analog input can return. But I cannot understand why it does this.
Any help will be much appreciated.

user313: The ESP is a 3.3v device. If your Uno is a 5v device, its A/D converter can measure and report voltages from 0 to 4.9878v (5v minus 1 LSB). If the same signal is presented to the ESP, any value above 3.29919 volts (3.3v - 1 LSB) will read as 4095, i.e., out of range.
(If this isn't your issue, adding wiring diagrams of each system to your question will help us understand it better.)
Update:

Perhaps a different ESP unit would be the ideal solution?

As far as I know, all of the ESP's are 3.3v devices. So the solutions I see are:

Power your sensor with 3.3v (is this an option?) so its output will be within the input range of the ESP's built-in A/D.
Scale the sensor output from it's 0-5v range to the 0-3.3v range the ESP can accept. Whether you can use a simple divider network or would need an op-amp may depend on the sensor, but if, as I suspect, it is a simple resistance device, a voltage divider should work.
Use an external 5v A/D converter. This will require a 5v power supply (which I presume you are using already, to power the sensor) and voltage level conversion between the A/D and input pin(s) of the ESP. The conversion could be a purchased level-converter board or a simple resistor-divider network.


61448: <p>I have a 'Capacitive Soil Moisture Sensor' hooked up to my Uno.
Very simple code. AnalogRead(MoistureSensorPin);
This will return a differing value that I can work with.</p>

<p>When applying the same code to an ESP32 with a similar set-up. It always returns '4095' which I understand is the maximum value an analog input can return. But I cannot understand why it does this.</p>

<p>Any help will be much appreciated.</p>
 313: <p>The ESP is a 3.3v device. If your Uno is a 5v device, its A/D converter can measure and report voltages from 0 to 4.9878v (5v minus 1 LSB). If the same signal is presented to the ESP, any value above 3.29919 volts (3.3v - 1 LSB) will read as 4095, i.e., out of range.</p>

<p>(If this isn't your issue, adding wiring diagrams of each system to your question will help us understand it better.)</p>

<p>Update:</p>

<blockquote>
  <p>Perhaps a different ESP unit would be the ideal solution?</p>
</blockquote>

<p>As far as I know, all of the ESP's are 3.3v devices. So the solutions I see are:</p>

<ol>
<li><p>Power your sensor with 3.3v (is this an option?) so its output will be within the input range of the ESP's built-in A/D.</p></li>
<li><p>Scale the sensor output from it's 0-5v range to the 0-3.3v range the ESP can accept. Whether you can use a simple divider network or would need an op-amp may depend on the sensor, but if, as I suspect, it is a simple resistance device, a voltage divider should work.</p></li>
<li><p>Use an external 5v A/D converter. This will require a 5v power supply (which I presume you are using already, to power the sensor) and voltage level conversion between the A/D and input pin(s) of the ESP. The conversion could be a purchased level-converter board or a simple resistor-divider network.</p></li>
</ol>
