Interfacing & Testing PH Sensor with arduino
pH Sensor Calibration:
To calibrate this sensor you will need a wire to short the external part and the center of the probe connector. This causes a 2.5 volts tension on the Po analog output pin. I started off by connecting the external part of the BNC connector with the center of the BNC probe connector.
Now connect the V+ pin with the Arduino’s 5v. Connect the ground pin of the interface circuit with the ground pin of the Arduino, and finally connect the analog output pin Po with the A0 pin of the Arduino. Connect Arduino with the laptop to calibrate the pH sensor using the following Arduino code.
pH Sensor Calibration Arduino Code:
This is a very basic program that we are going to use for calibrating the pH sensor interface circuit. The purpose of this program is to the read the analog output pin Po and display the voltage on the serial monitor. Make sure the Arduino board is selected and also check if the right communication port is selected. Click on the Upload button and wait for a while. After the program has been uploaded. Now the next step is to open the serial monitor.
If you will see a value other than 2.50 then use the trimmer to adjust this value.You know the pH value is from 0 to 14. A pH of 7 means 2.5 Volts. So we are going to set it to 2.5 volts using the trimmer. Now, you can see the value is set to 2.5Volts. The pH Sensor is now calibrated. Disconnect the Arduino board and also remove the wire. Now, it’s time to connect the pH sensor with the interface board.
The small container already has the distilled water, this is how it look after connecting the pH sensor with the Interface board, the wiring remains the same. Now, let’s check its pH value.
Arduino pH meter testing after calibration:
As you can see the Arduino is connected with the laptop, now we will need to upload the following code to find the pH value of the distilled water.
يجب وضع الجهاز قليلا في السائل حتى يتم تفعيل المادة فيه .... وتتم المعايرة بشكل بسيط حسب الكود
After you upload the program, then you can open the Serial monitor to check the pH value of some known liquid. I used the distilled water. Although I did the calibration, but still the value was little off which I then adjusted. The above code is already adjusted. I have explained this in the video tutorial given at the end of this article.
Very pure distilled water that has had little contact with air will have a pH value between 6.9 and 7. After adjusting the value, I was able to get the exact pH value for the distilled water. The pH value is between 6.9 and 7. The pH value can be further adjusted by changing the calibration value.