Hey guys. I have been working on a water quality monitoring system using arduino. But i have not been able to get a proper output from the pH sensor even after using an amplifier circuit using the TLO72 which has been repeatedly suggested on the internet.
I have made the circuit given in this site: arduino ph probe interface - Sparky's Widgets

I have changed the resistor values a little but made sure the gains are almost similar based on this.
I came across some places where they suggested i use a map function for this. But I m not sure how to.
Please correct me where I have gone wrong.
I ve included the code used for this here:
const int analogInPin = A2; //from amplifier circuit.
float avgValue;
float buf[10],temp;
void setup() {
Serial.begin(9600);
}
void loop() {
for(int i=0;i<10;i++)
{
buf*=analogRead(analogInPin);*
_ Serial.print(buf*); // to get a glimpse of what values i m reading._
_ Serial.print(" ");*_
* delay(10);*
}
for(int i=0;i<9;i++)
{
* for(int j=i+1;j<10;j++)*
* {*
_ if(buf*>buf[j])
{
temp=buf;
buf=buf[j];
buf[j]=temp;
}
}
}
avgValue=0;
for(int i=2;i<8;i++)_
_avgValue+=buf;
avgValue/=6;
Serial.print(" pHVol=");_
_float pHVol=avgValue5.0/1024; // ADC_
Serial.print(pHVol);
float phValue = -5.7 * pHVol+21.34; // pHVol to pH conversion. please correct this too if i am wrong.
Serial.print(" pH = ");
Serial.println(phValue);
delay(1000);
}
pHtl072.ino (849 Bytes)

