GROVE PH sensor explain code

On https://wiki.seeedstudio.com/Grove-PH_Sensor/ there is an example of Arduino code. I’ts not explained well. Maybe somebody can help me understand.

There is a formula:

7-1000*(sensorValue-372)*Vref/59.16/1023);

What i understand is:
Vref = the running voltage of the Arduino device
1023 = the steps of the 10 bits adc
Vref / 1023 = the calculation from step to mv
59.16 = the 1 ph/mv theoretical slope

7 = reference ph on 0mv??
Why is minus 1000?
Why is sensorvalue minus 372?

Hope to hear.

Greets, Red

Hi @Reddie
Vref = the running reference voltage of the Arduino device.
7= the neutral PH value
372 = Reference value of ADC measured under neutral pH
When the read sensor value is greater than 372, the detected PH value is less than 7, which is acidic.
59.16=Conversion method to convert the output voltage value to PH value.
Because the unit of Vref is V, and the unit of 59.16 is (mV/PH), it is necessary to multiply by 1000 for the unit to be consistent.
I hope this explanation can help you.

Thank you for you’re explanation

Hi @Reddie
It’s my honor. If you have any questions, please feel free to contact us.