Hi Guys,
Im having trouble trying to work out how to scale my input to read correctly.
I have a PH probe circuit which im reading on an analog input.
When the probe is PH7 the voltage from the circuit is 2.00V, when the probe is PH10 the voltage reads 2.50 volts. So i can deduce that the circuit outputs 167mV/PH.
But how do i adjust my code to read from 0PH to 14PH using these 2.00v and 2.50v as my reference???
Here is the code im trying to modify:
int pin = 3;
int tempc = 0,tempf=0;
int samples[8];
int i;
void setup()
{
Serial.begin(9600);
}
void loop()
{
for(i = 0;i<=7;i++)
{
samples[i] = ( 5.0 * analogRead(pin) * 100.0) / 1024.0;
tempc = tempc + samples[i];
}
tempc = tempc/8.0;
tempf = (tempc * 9)/ 5 + 32;
Serial.print("{TEMP:");
Serial.print(tempf,DEC);
Serial.print("}");
tempc = 0;
delay(1000);
}
Any help rewriting this code would be of great help!!
VR.