Ph-4502c Ph Meter Calibration Notes - Tlfong01.blog
Menu
Uncategorized ph-4502c ph meter calibration notes By tlfong01 on April 26, 2019 • ( 2 Comments )Update:
https://raspberrypi.stackexchange.com/questions/96653/ph-4502c-ph-sensor-calibration-and-adc-using-mcp3008-pcf8591-and-ads1115
Calibrate PH-4502C pH meter Ask Question 0I have a pH meter (DIY-4502C) hooked up with Raspberry Pi. However, the instructions to calibrate is in Chinese and seems outdated.
Does anybody know how to calibrate it for measuring pH4-7?
sensor setup peripherals shareeditflag edited Apr 18 at 10:42Greenonline
2,15141229 asked Apr 18 at 3:23TAO
41 add a comment start a bounty2 Answers
activeoldestvotes 1From How to use a pH sensor with Arduino
shareeditflag answered Apr 18 at 8:41Calibrate the sensor
As we can see that there are two potentiometers in the circuit. Which it is closer to the BNC connector of the probe is the offset regulation, the other is the pH limit.
- Offset: The average range of the probe oscillates between negative and positive values. The 0 represents a pH of 7.0. In order to be able to use it with Arduino this circuit adds an offset value to the value measured by the probe, so the ADC will only have to take samples of positive voltage values. Therefore we will force a pH of 7.0 by disconnecting the probe from the circuit and short-circuiting the inside of the BNC connector with the outside. With a multimeter measure the value of Po pin and adjust the potentiometer to be 2.5V.
- PH Limit: This potentiometer is to set a limit value of the pH sensor circuit that causes the red LED to light up and the Do pin signal to turn ON.
In addition we have to calculate the voltage conversion that will give us the pH sensor so we will need two pH reference value and measure the voltage returned by the sensor on the pin Po. The best thing to do is to use a calibration solution in powders, there are also in liquid but it is easier to preserve the powders. These solutions are sold in different values but the most common are pH 4.01, pH 6.86 and pH 9.18.
Graph of the measured voltage and pH equation. y= -5.70 * x + 21.34
Using the powders with pH 4.01 and pH 6.86 we obtain the voltages on the pin Po 3.04V and 2.54V respectively. The sensor is linear so by taking two points we can deduce the equation to convert the measured voltage to pH. The general formula would be y = mx + b, so we have to calculate m and b since x would be the voltage and y the pH. The result is y = -5.70x + 21.34.
Connection with Arduino
To connect with Arduino we will need an analog input (A0), power (5V) and two GND that actually in the sensor circuit are separated but we can use the same.
Code
The code consists of taking 10 samples of the analogue input A0, ordering them and discarding the highest and the lowest and calculating the mean with the six remaining samples by converting this value to voltage in the variable pHVol, then using the equation that we have calculated with the pH reference values we convert pHVol to pHValue and send it to the serial port to see it in the serial monitor.
const int analogInPin = A0; int sensorValue = 0; unsigned long int avgValue; float b; int buf[10],temp; void setup() { Serial.begin(9600); } void loop() { for(int i=0;i<10;i++) { buf[i]=analogRead(analogInPin); delay(10); } for(int i=0;i<9;i++) { for(int j=i+1;j<10;j++) { if(buf[i]>buf[j]) { temp=buf[i]; buf[i]=buf[j]; buf[j]=temp; } } } avgValue=0; for(int i=2;i<8;i++) avgValue+=buf[i]; float pHVol=(float)avgValue*5.0/1024/6; float phValue = -5.70 * pHVol + 21.34; Serial.print("sensor = "); Serial.println(phValue); delay(20); }
Greenonline
2,15141229 add a comment 0Part 1 – Calibration Procedure
1. Analog output offset procedure
Offsetting meter analog output of 0.0V to + 2.5V for compatibility with ADC such MCP3008, MCP3208 etc. Cheap pH meters are almost always designed for Arduino which has an analog pin A0 to convert analog signal to digital. Rpi, sadly does not have any analog pin, so must use an external ADC moduel. More about this later.)


2. pH limit potentiometer adjustment procedure
Set 2.46V which corresponds to the pH value of tap water as threshold voltage, by adjusting the limit potentiometer so that the red LED just turns on.

Self/Auto Calibration Procedure
So the US10 cheap meter gives 2.46V for water. That is amazing, considering that I was too lazy to clean the glass, which for sure has some faint whisky traces left. My offset to the pH meter ADC is +2.5V, implying that water should read +2.50V. Again I am only using home tap water. Perhaps whisky and heavy metal traces in the tap water balances out. 🙂
Now that I think I should test at the other extremes, very acid and very basic. I have googled the following pH value charat, and see if I can find some more things to test/calibrate.

I just finished lunch. Before eating the desert Chinese mandarin dessert, I toodk a photo, and checked it pH.

And green tea pH again.

Now there is the pH of something that I really want to know, the body wash I am suing every day.
I found the analog voltage. Now I need to calcule the pH value.


Now soy sauce and vinegar

And finally, very acidic bleach and drain pipe cleaner!

The time has come to write the python program
Now I have enough samples, from very acidic to very basic, to get the ph per volt ratio which is used to get from measure analog output in volts to the pH value.
I am making morning coffee with milk, and a selfie!

I updated the Excel worksheet with coffee and tea. Now the average pH/V is recursively self calibrating, meaning that more measurements added, more “accurate” is the average pH/V.
What I found too good to be true is that the measured pH value of the JJ body wash claiming pH5.5 is 5.51!

Now I have drawn the graph to get the values for the Rpi python program to calculate the pH values.

/ to continue, …
Part 2 – Chinese to English Manual Translation and Suggestion for Newbies
Well, give me the link of the Chinese manual, I can translate it into broken English. 🙂

Do you mean the AT instruction set? Or the hardware setup? I guess they are common to all the real and fake boards. I can do the translation if that is what you need.
The basic Hello test is universal. You say “AT\r\n”, and the Ph Board will return “OK”. The general commands are also universal:
Reset, Current Ph value, Temperature, Threshold, Factory default setting, Current operation mode, …

If you wish to translate the names of the pins. Here is one for the J3, J4 pinouts.

You may have already found the location of DS18B20 temperature sensor pin. This is a standard device, so you don’t need to read their instruction.
One other thing is that the vendor recommends to use their CH340 cable. This is important, because other cables using PL23dxx might not work for their board.
You may also find other teething problems. I have a brief suggestion list for the newbies.
- Test Rpi 3V3 signals is OK
- Test Rpi 3V3 signals converted to 5V logcie is OK.
- Test Rpi 3V3/5V0 loopback hardware is OK.
- Test Rpi sending string such as “AT/r/n” is OK
- Test is CH340 cable is OK
One final reminder to USB CH340 newbies: Remember to disable Serial Console at the Rpi Config Menu:

And the plug and play, no library required, minimal, complete, verifiable, UART self test/loopabck, repeat send AT/r/n python program.
UART Self Test Program
# uart_test06 tlfong01 2019apr08hkt1603 *** # Computer = Rpi3B+ # Linux = $ hostnamectl = raspberrypi Raspbian GNU/Linux 9 (stretch) Linux 4.14.34-v7+ arm # Python = >>> sys.version = 3.5.3 Jan 19 2017 # Test 1 - repeatWriteBytes() - UART port repeatedly send out bytes. # Function - Repeat many times sending bytes, pause after each bytes. # Test 2 - loopBackTest() - UART port send and receive bytes. # Function - Send one bytes to TX, wait some time (Note 1), then read bytes back from RX. # Setup - Connet Tx pin to Rx pin to form a loop. # Note 1 # Bolutek BlueTooth BC04 needs at least 10mS to respond from time import sleep import serial serialPort0 = serial.Serial(port = '/dev/serial0', baudrate = 9600, parity = serial.PARITY_NONE, stopbits = serial.STOPBITS_ONE, bytesize = serial.EIGHTBITS, timeout= 1) def setSerialPortBaudRate(serialPort, baudrate): serialPort.baudrate = baudrate return def serialPortWriteBytes(serialPort, writeBytes): serialPort.write(writeBytes) return def serialPortReadBytes(serialPort, maxBytesLength): readBytes = serialPort.read(maxBytesLength) return readBytes def serialPortWriteWaitReadBytes(serialPort, writeBytes, maxBytesLength, waitTime): serialPort.flushInput() serialPort.flushOutput() serialPort.write(writeBytes) sleep(waitTime) readBytes = serialPortReadBytes(serialPort, maxBytesLength) print(' bytes written = ', writeBytes) print(' bytes read = ', readBytes) return readBytes def repeatWriteBytes(serialPort, writeBytes, pauseTimeBetweenBytes, repeatCount): print(' Begin repeatWriteOneByte(), ...') for i in range(repeatCount): serialPortWriteBytes(serialPort, writeBytes) sleep(pauseTimeBetweenBytes) print(' End repeatWriteOneByte().') return def serialPortLoopBack(serialPort, writeBytes, maxBytesLength, waitTime): print(' Begin serialPortLoopBack() [Remember to connect Tx to Rx!] , ...') serialPortWriteWaitReadBytes(serialPort, writeBytes, maxBytesLength, waitTime) print(' End serialPortLoopBack(), ...') return setSerialPortBaudRate(serialPort0, 9600) #repeatWriteBytes(serialPort0, b'AT\r\n', 0.01, 200000000) serialPortLoopBack(serialPort0, b'AT\r\n', 32, 0.030) ''' Sample output tlfong01 2019apr0801 >>> === RESTART: /home/pi/Python_Programs/test1193/uart_test02_2019apr0801.py === Begin serialPortLoopBack() [Remember to connect Tx to Rx!] , ... bytes written = b'AT\r\n' bytes read = b'AT\r\n' End serialPortLoopBack(), ... >>> ''' # EndGood luck to your project! 🙂
References
Ph Testing Theory, Ph board pinout translation
Mar 02, 2016, 07:59 pm Last Edit: Mar 02, 2016, 09:26 pm by LeCyb Reason, Arduino Forum
shareeditdelete (1)flag edited just now answered Apr 18 at 4:11tlfong01
892312- 4 How is this an answer to the question? – Steve Robillard Apr 18 at 5:34
- 1 This is an interesting answer, but does not appear to mention calibration. If you update it to include calibration then it would be a good answer. – Greenonline Apr 18 at 7:31
- Well, I am just a poor hobbyist. Long time ago, I studied in a trade middle school, focusing on metal work and mechanical drawing, hoping to become a car mechanic one day to earn a living. Actually I have never heard about the pH thing until some year ago when TV ads mention about it. I have never seen any pH equipment in school lab. All I know is from Google. So you see at the end of my answer, I added the pH general knowledge post. I read it a couple of times, memorized the strange names by heart, so I can pretend to know some chemistry, and get more respect than I deserve, … 🙂 – tlfong01 Apr 18 at 7:50
- @Steve Robillard Ah, sorry, I did not understand your comment until I read Greenonline’s answer. Originally I thought what the OP wanted is a translation of the manual from Chinese to English, and my job is done. Now after browsing the Arduino forum posts I know even if the OP got the full manual in English, he might not be able to do the calibration which requires subject knowledge in chemistry and pH stuff. I am good in physics but hopeless in chemistry. Anyway, I will try to do some self learning in pH stuff and see if I can improve my answer. – tlfong01 Apr 19 at 9:10
Not the answer you’re looking for? Browse other questions tagged sensor setup peripherals or ask your own question.
Share this:
- X
Related
Categories: Uncategorized
Post navigation rpi recommended software download Next Post2 replies »
-
Hope all is well, I wanted to talk to you about the PH4502C if you’re still messing with it. I’m doing some automation and wanted to see if I could ask you some questions about your results and methods.
LikeLike
Reply - Pingback: Levain – L'Aix paire culinaire…
Leave a comment Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Categories
- 4G (5)
- ACS712 (1)
- ADC (4)
- ADS1015 (2)
- Current Sensor (1)
- DC Motor (6)
- forum (1)
- GPIO (3)
- keypad (1)
- MPU6050 (17)
- MPU9250 (4)
- PIR (1)
- Raspberry Pi (8)
- Raspbian (1)
- Reading Notes (8)
- Relay (6)
- Self Balancing Robot (1)
- Smart Home (1)
- solenoid (1)
- Uncategorized (1,835)
My Calendar
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 |
- Comment
- Reblog
- Subscribe Subscribed
-
tlfong01.blog Join 85 other subscribers Sign me up - Already have a WordPress.com account? Log in now.
-
-
-
tlfong01.blog - Subscribe Subscribed
- Sign up
- Log in
- Copy shortlink
- Report this content
- View post in Reader
- Manage subscriptions
- Collapse this bar
-
Từ khóa » Ph4502c
-
[PDF] How To Use A PH Probe And Sensor
-
DIY PH Meter Arduino With Module Ph4502c, Calibration ... - YouTube
-
Arduino PH-meter Using PH-4502C | Web, Mobile & IoT - CimpleO
-
Ph4502c Liquid Ph Value Detection Detect Sensor Module ...
-
Liquid PH Value Detection Detect Sensor Module - Diymore
-
PH4502C PH Meter –
-
Problem With PH-4502C Sensor Calibration - Arduino Forum
-
PH4502C Liquid PH Value Detection Detect Sensor Module ... - EBay
-
Original Diymore Liquid PH Value Detection Detect Sensor Module ...
-
【100% Original】diymore PH4502C PH Liquid Water Ph Value ...
-
Ph4502c Ph Meter Notes - Tlfong01.blog
-
PH4502C Liquid PH Value Detection Detect Sensor Module
-
PH4502C Liquid PH Sensor Module - Alphatronic
