The first sensor I decided to calibrate is the pH meter, since I figured that pH is a relatively easier concept to grasp than the others. Here is the setup:

DFRobot, the open source creator of these sensors, provides sample code [1] designed to calibrate the pH sensor but it only works on AVR boards, which the IoT boards from Arduino are not. Therefore, I put together a tiny piece of sample code to test out the sensor, we’ll have to calibrate it ourselves:
float phSensorValue;
float phVoltage;
float phValue;
void setup()
{
Serial.begin(9600);
}
void loop()
{
phSensorValue = analogRead(A0);
phVoltage = phSensorValue / 1024.0;
Serial.println(phVoltage, 4);
delay(2000);
}
I took the sensor out of the neutral solution and washed it off in clean water (use distilled water if possible). I then dipped it into the pH-7.0 buffer solution, which stabilized at a voltage of 0.4521 (* 1024) mV. I rinsed the sensor off (be sure to wipe the end of the pH sensor with a cloth in between each reading) and dipped it into the pH-4.0 buffer solution, which in turn stabilized at a voltage of 0.6064 (* 1024) mV. We divide the original voltage by 1024, because usually sensors return a voltage in a range of 0.0 to 1023.0. If we divide by 1024, we are given a percentage of the value on the scale, which is more meaningful than an actual voltage. With this percentage we can more easily analyse and compare the data.
As a result we have two points, therefore we can make a pH value compared to voltage chart. The relation is actually linear, and will enable us to easily return a pH value with the code, instead of a voltage. This gives us the following equation:

This trendline will vary with the temperature of the environment, these readings were taken at 25°C. In colder temperatures (noticeable at ~0°C), acidic solutions will generate a lower voltage, and basic solutions will generate a higher voltage.
As a side reminder, the pH scale is logarithmic, where an increase or decrease of 1 in pH value is actually a tenfold concentration increase or decrease. For example, pH-5.0 is ten times more acidic than pH-6.0. Safe drinking water acidity ranges from pH-6.5 to pH-8.5, which is also a safe healthy range for bodies of water.
Sources
[1] DFRobot, “SEN0161-V2 Gravity Analog pH Sensor Meter Kit V2”, DFRobot-Wiki. [Online]. Available: https://wiki.dfrobot.com/Gravity__Analog_pH_Sensor_Meter_Kit_V2_SKU_SEN0161-V2
