logic behind the coding of soil moisture sensor

i have a soil moisture probe and i connect it with arduino along with a lm393 module and upload the sketch
void setup(){
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
delay(100);
}

and on serial monitor i got the values 1024 for dry soil as the moisture getting on increasing, the value 1024 starts decreasing towards 0...
so i just want to know that what is the logic or any formula to calculate these values like 1024 and what we are using in this logic or formula - capacitance, voltage, resistance or any thing else ???
please tell me

The Analog to Digital Converter (ADC) measures the voltage on the analog pin. If the voltage is 5v it gives a value of 1023 and if it is 0v it gives a value of 0. A voltage of 2.5 volts will give 512.

Without a link to the datasheet for your moisture sensor I cannot say why it should output 5v for dry etc.

Note that the Arduino ADC CANNOT produce an output of 1024 because that would require 11 binary digits. Computers count from 0 to 1023.

...R

thank you for ur reply
.
.
yahh sorry it is 1023 but my question is what we are using here resistance/voltage/capacitance? to measure the moisture value of the soil and what is the logic or any formula to find this value???

ajrajput0995:
but my question is what we are using here resistance/voltage/capacitance? to measure the moisture value of the soil and what is the logic or any formula to find this value???

I already asked you to post a link to the datasheet for your sensor. Without that I can't help further.

...R
Planning an Implementing a Program Several things at a time Serial Input Basics Stepper Motor Basics
Python-Arduino Comms Python GUI demo EzScrn