How do I invert a PH sensors output

I have had som troble with my PH sensor. My ref. is 7 and it is equal to 2,5V.
When my PH selotion is at 5 its writing 9 and the voltage is increased to 3V
The voltage is fine put I need the PH value to fall to 5

is it possible to invert the outcom from the sensor?

Sorry for my english :smiley:

Here is my code:

//PH:
unsigned long int PH_avgValue; //Gem den gennemsnitlige værdi fra sensor feedback
int buffer_array[10], temp;

void setup()
{

Serial.begin(9600);

}
void loop()
{

//PH:
for (int i = 0; i < 10; i++) //PH: 10 prøver for at få en mere præcis værdi
{
buffer_array[i] = analogRead(A0);
delay(10);
}
for (int i = 0; i < 9; i++) //PH Sortere analog fra lille til stor

PH_avgValue = 0;
for (int i = 2; i < 8; i++) //Gennemsnitlig værdi fra 6 center prøver
PH_avgValue += buffer_array[i];
float phValue = (float)PH_avgValue * 4.15 / 1024 / 6; //Konventere analog til Volt og finde summen af de 6 center prøver
phValue = 3.5 * phValue; //Konventere Volt til PH værdi

if (phValue < 6)
{
Serial.print("PH for lav: ");
Serial.println(phValue);
delay(800);
}

else if (phValue > 8)
{
Serial.print("PH for høj: ");
Serial.println(phValue);
delay(800);
}

else
{
Serial.print("PH OK :");
Serial.println(phValue);
delay(800);
}

}

How about subtracting the result you get from fourteen?

1 Like

It works! Thank you! I dont know why i diddint tink of that. so nice and simple

In another few years, you’ll probably be able to get a software patent on that method.

a7

:laughing: :laughing: :laughing:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.