#include <ph4502c_sensor.h>
PH4502C_Sensor ph4502c(A0, A1, 7.00); //PH_Pin, TEMP_Pin, ONE POINT CALIBRATION
void setup() {
Serial.begin(9600);
ph4502c.init();
}
void loop() {
float sensor1_val;
// ONE POINT CALIBRATION
sensor1_val = ph4502c.read_ph_level();
// CONVERT 'ONE POINT CALIBRATION' -> 'TWO POINT CALIBRATION' with formula (y = m*x + t)
sensor1_val = 0.3663 * sensor1_val + 4.138205;
Serial.print(sensor1_val);
Serial.println(" PH");
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
int analogValue = ph4502c.read_temp();
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
Serial.print(celsius);
Serial.println(" °C");
Serial.println();
delay(2000);
}
TEMP
PH
6.86
4.01