# Range of Offset Value in pH sensor module?

In finding the pH value of a liquid/Soil, what is the range of Offset voltage value that I can use in my code?

Using / calibrating pH sensor module

I considered the above link as a reference. But I didn't come to know the range of Offset Value...

Here is the logic below to find the value of pH right...

``````avgValue = 0;
for (int i=2;i<8;i++)       // take the average value of 6 center sample
avgValue+=buf[i];

phValue=3.5*phValue+Offset;
``````

What is the range of Offset value can I use in the above/my code?

• I think you would need to test it by testing known value solutions with your sensor. It is probably going to be different between different instances of the sensor so each will need calibrating in this way. – Code Gorilla May 19 '16 at 12:13
• I tested it for water of pH 7.0. It's showing a value of 10.5 units. So, I considered -3.5v as an offset value..While considering offset value as -3.5v, I got a doubt that is there any limited range for an offset value to consider – Shiva Teja May 19 '16 at 12:25
• It is doubtful any ADC / sensor combination is exactly linear, of the correct magnitude, slope and w/o noise. How precise / accurate your application needs to be should dictate your efforts. My next steps would be to plot know acid and bases to resolve these questions. – st2000 May 19 '16 at 13:42
• I don't think you mean -3.5v, because the voltage range you are measuring is 0-5v. At the moment all you know is when the variable phValue = 10.5 then the pH of the liquid is 7.0. Like st2000 says you now need to pad out your calibration table what does pH 1 make your device read? pH = 2 ? etc. Then you will get a table that says when the sensor reads 3.9 it means pH = 1, when it read 5.2 it means pH=2, when it reads 4.9 it means about pH 1.8. – Code Gorilla May 20 '16 at 12:04
• Something you may also want to consider is what happens if one reading is massively different to the other 5 readings. It probably indicates a sensor fault for that reading, but it will move your answer towards pH=1. I don't think you should be dividing by 1024. This division will loose some precision in your reading and therefore it will make you calibration table less accurate. – Code Gorilla May 20 '16 at 12:09