Measuring pH and ORP with Arduino

2017-07-23 00:40:45 by

Using the phidgets pH probe and adapter board connected to the Arduino UNO R3.

 

Arduino Connection

From the user guide the adapter pin out is simply GND, 5V, and Analog Input:

 

 

I connected the adapter cable to 5V and GND on the Arduino and I used the analog input pin A1.

 

Programming the Arduino to read pH

From the user guide there are formulas you can use and modify to calculate the pH.

 

From phidget user forum site on adapting equation for Arduino connection:

Does it means my formula will be 0.0178*(Vin*200)-1.889 as my input is (0V-5V)?

For obtaining exact ph – sensor value equation you need two standard buffer solutions( buffer 7 and buffer 4).

First put the electrode in buffer 7 then read the sensor value 7 then wash the electrode dry it and put it in buffer 4 solution and read sensor value 4.

With this two point you can write the exact equation for pH -sensor value .

 

From this project site they try to use linear equation to fit 2 data point calibration and phidgets site has basic information on calibrating sensors:

 

 

2 Point Calibration using pH 4 and 7 buffer solution measurements

m = ((7-4)/760-534)) = 3/226 = 0.0133

b= 4 – 0.0133*534 = -3.1022

Final Equation

pH(cal) = 0.0133(RawSensorValue) – 3.1022

 

Temperature Calibration

You need to know the water temperature in order to properly due to the calibration. In our case I’m using the waterproof DS18B20 from Adafruit.

 

 

Connection is 5V, GND, and a digital input pin but you also need to put a 4.7K pullup resistor between VCC and the data pin.

 

 

Found some code for reading just the DHT11 water temp sensor (no humidity) on a different pool monitor project site or you can use the Adafruit library example.

 

Programming the Arduino to read ORP

From the user guide there are formulas you can use and modify to calculate the ORP value from the ORP probe:

 

 

There’s no required temperature calibration for measuring ORP and can be directly calculated on the Arduino using the same equation.

 

Reading pH Probe and ORP Probe with Temperature Calibration on Arduino

Putting this all together I ran some tests first with just the pH probe with calibrated temperature coming from the water temperature probe. (*Probe not working properly so used manual temperature measurement of water for calibration)

Below is the setup that I used with pH buffer solutions of 4, 7, and 10. I also have filtered water.

 

 

Using pH and TDS meter following results for pH and temperature:

 

You can calibrate the pH meter by adjusting a trim:

 

Example measuring the pH and temperature of one of the solutions:

 

 

Example of putting the pH probe in one of the solutions:

 

Running the Arduino code I output the pH values to the serial monitor screen for debugging:

 

Example serial out :

 

Used a thermapen fast thermometer (digital) to measure temperature of solutions to calibrate for pH and verify TDS meter that also measures temperature is working properly:

 

Using temperature compensated equation for original Pool Monitor result and then also tried the 2 point calibration for the Pool Monitor result

 

Filtered Water Test

pH meter result: 7.0

TDS temperature result: 22 C/ 72 F

Thermapen temperature result: 71 F

Pool Monitor result (2 point calibration): 780(raw)/7.27 pH

 

pH Buffer Solution 7.0

pH meter result: 7.0 (after trim calibration)

TDS temperature result: 21 C/ 71 F

Pool Monitor result: 760 (raw)/8.8 pH

Pool Monitor result (2 point calibration): 754(raw)/6.93 pH

 

pH Buffer Solution 4.0

pH meter result: 4.0

TDS temperature result: 20 C/ 70 F

Pool Monitor result: 534 (raw)/5.19 pH

Pool Monitor result (2 point calibration): 504(raw)/3.61 pH

 

pH Buffer Solution 10.0

pH meter result: 10.0

TDS temperature result: 21 C/ 71 F

Pool Monitor result: 965 (raw)/12.4 pH

Pool Monitor result (2 point calibration): 990(raw)/10.06 pH

 

I found that I had to do my own 2 point calibration in order to get an accurate result. Also both the pH and temperature meter seem to be very accurate.

 

With the pH probe calibrated I then hooked up the LCD display and now I measure and display the pH of the solution and the air temperature. I took some pool water and put it in a cup and ran the same measurements again. The pH probe gave me a value of 7.27 which is pretty close to the pH meter value of 7.3

 

 

Some photos of full setup:

 

 

I also used one of the pool chemical strips to get the pH range value:

 

Pool Water Test

pH meter result: 7.3

TDS temperature result: 28 C/ 83 F

Pool Monitor result (2 point calibration): 7.26 pH (after 5 to 10 mins)

Chemical Strip Test Results Range: 7.2 to 7.5

 

Overall the pH probe is working pretty good – next step is to put it in the pool!

0

Read Comments