3114123,737 AM.
&
PH-4502C pH Sensor Calibration and ADC using MCP3008, PCF8591,
and ADS1115
Asked 3 years, 11 months ago Modified 2 years, 10 months ago Viewed 20k times
setup - PH-4502C pH Sensor Calibration and ADC using MCP3008, PCF85S1, and ADS1115 -Raspoerry Pl Stack Exchange:
Ihave a pH meter (DIY-4502C) hooked up with Raspberry Pi. However, the instructions to
calibrate is in Chinese and seems outdated,
3
Does anybody know how to calibrate it for measuring pH4-7?
sensor setup peripherals
Share Improve this question Follow edited dct 7, 2019 at 1139 asked Apr 18, 2019 at 323,
tifongOt Sg TAO
4527 3 9 24 391013
Sorted by:
3 Answers Highest score (default) = &
I recommend this repository for ADS1115 for RPi in Python and for Arduino.
3 1. Calibration
2. Reset
3. Read the values
https://github.com/DFRobot/DFRobot PH
You can adapt to your project and works properly.
hitpssraspberrypstackexchange.com/questions/96063/ph-4502c-ph-sensor-calibration-and-ade~sing-mcp3008-pcf8591-and-ads 1118 4213114123,737 AM. ‘setup - PH-4502C pH Sensor Calibration and ADC using MCP3008, PCFASS1, and ADS 1115 - Raspoerty Pi Stack Exchange
rn
* @brief Init The Analog pH Sensor
7
void begin();
6
= @brief Convert voltage to PH with temperature compensation
* @paran voltage +: Voltage value
. temperature : Anbient temperature
* @return The PH value
”
Float readPH(float voltage, float temperature);
* @brief Calibrate the calibration data
* @param voltage —_: Voltage value
+ temperature : Anbient tenperature
nd : enterph -> enter the PH calibration mode
calph -> calibrate with the standard buffer solution, two buffer
solutions(4.0 and 7.0) will be autonaticlly recognized
. exitph => save the calibrated paraneters and exit fron PH calibration
node
7
void calibration(float voltage, float temperature, char* cmd);
Share Improve this answer Follow edited Jun 8, 2019 at 9:12 answered Jun 8, 2019 at 8:27.
Greenonline Ac
29 4 22 35 ar 2
Your recommendation is very good. Rpi uses python to control ADS1115 to do ADC of PH4502C analog
‘output. Rei without any analog input pin must use an ADC module to help daing ADC. ADC1115 is a good
choice. tifong01 Jun 11, 2019 at 535 °
How to use it? just run the py fle? or ?- Rikudlo Pain Oct 1, 2020 at 20:42
From How to use a pH sensor with Arduino
Calibrate 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 Ii
* 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
-nps:traspberryp.stackexchange.com/questions/9605Siph-4602c-phi-sensor-calbration-and-ade-tsing-mep3008-pc1859 -and-ads 1115 2213114123,737 AM.
‘setup - PH-4502¢ pH Sensor Calibration and ADC using MCP3008, PCF85S1, and ADS1115 -Raspbery Pi Stack Exchange
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 for (-5.7)*x+21.34
es
=
Ea
vecbapasreae 75 Tane68
Ca
8
os 1 4s 2 25 2 3 |
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 (AO), power (SV) 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 AQ, 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
-nlps:traspberrypstackexchange.com/questions/96059iph-4602c-p-sensor-calbraion-and-ade-tsing-mep3008-pc1859 -and-ads 1115 iat34128, 7.37 AM ‘setup -PH-4502¢ pH Sensor Calibration and ADC using MCP3008, PCFBSE1, and ADS1%15 -Raspbery Pi Stack Exchange
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 analogrnPin = AQ;
Ant sensorValue = 0;
unsigned long int avgValue;
Float bj
int buf[10], temp;
void setup() ¢
Serial. begin(960);
y
void loop() (
for(int i=0;i<10;i++)
«
buf i
delay (10)
x
for(int i=0;i<9;i++)
«
for(int j=it;}<1055++)
«
i#(bufLi}>butl3])
nalogRead(analoginPin) ;
FLL
buf [A]-butJ15
buff i]etemp;
y
y
y
avgvalui
for(int 1251685144)
avgValuer=buf{i];
float plvol=(Float )avgvalue*5.0/1024/6;
float phValue = -3.78 * pHVol + 21.345
Serial. print("sensor = *);
Serial. printIn(phvalue);
delay (29);
x
Share Improve this answer Follow edited Jun 16,2020 at 10:47 answered Apr 18, 2019 at 841
Bot Greenonline
29 4 2 35
any chance you could elaborate or walk a person through how you derived y = -5.70x + 21.34. from your
voltage and pH readings? — xandercrews Oct 15, 2019 at 1:35
Check the link, this is a quote from the link - Greenonline Oct 15, 2019 at 9:27
Update 20190ctO7hkt1128
2 Newbie FAQ
-nps:raspberryp.stackexchange.com/questions/96059iph-4602c-p-sensor-calbration-and-ade-tsing-mep3008-pc(859 -and-ads 1115 az3114123,737 AM. ‘setup - PH-4502C pH Sensor Calibration and ADC using MCP3008, PCFASS1, and ADS 1115 - Raspberty Pi Stack Exchange
QI. How to adjust offset?
1. Following Part! Section 1,
(1) Power supply 5V to module,
(2) Do the 3 offset calibrating steps until your multi-meter read about 2.5V.
Notes:
(@) For offset calibration, you don't use any liquid sample. You just short the BNC plug
input (centre) to ground (outside sleeve), using to clips, so that the input to pH sensor is
zero.
Part 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
0 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)
Calibrating pH meter for Rpt
‘Analog output setting
41. Short BNC (A) input to ground
2. Adjust potentiometer 8 (nearest ENC socket)
‘3. Until multimeter (C) connecting pH meter output 0)
reads +2.5V
2.pH limit potentiometer adjustment procedure
-nlps:traspberrypstackexchange.com/questions/96089/ph-4602c-ph-sensor-calbration-and-ade-tsing-mep3008-pc1859 -and-ads 1115 62134128, 7.37 AM ‘setup -PH-45026 pH Sensor Calibration and ADC using MCP3008, PCFBSE1, and ADS1%15 -Raspbeny Pi Stack Exchange
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,
Setting PH Limit potentiometer threshold
1. Find anaigo value corresponding to tap water = 246V
2. Adjust pH limit potentiometer for red LED just turning on
for wator pH value of 7.0 (2.46V)
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 | am only using home tap water. Perhaps
whisky and heavy metal traces in the tap water balances out. :)
Now that | think I should test at the other extremes, very acid and very basic. | have googled the
following pH value charat, and see if | can find some more things to test/calibrate.
\just finished lunch, Before eating the desert Chinese mandarin dessert, | toodk a photo, and
checked it pH.
-nps:lrespberrypstackexchange.com/questons/96059iph-4602c-ph-sensor-calbration-and-ade-ising-mep3008-pc1859 -and-ads1115 6213114123,737 AM
And green tea pH again
Coo
Now there is the pH of something that | really want to know, the body wash | am suing every day.
| found the analog voltage. Now | need to calcule the pH value.
peMete MessuremantResute v1 tongO? 2018p 25607
Ouiput Googled pH per Meas
Sample
oa
cor
Coeer is | 208 | a
cent | es [ee
soars 277
te
Me
one
Now soy sauce and vinegar
um,
280
vot
210
199
101
200
215
pH
6a
6a
55
tor
oo
0
ey
ey
@
0
‘htpsraspberryp slackexchange.comiquestons/96658/ph-4502c-ph-sensor-calbration-and-ade-sing-mcp3008-poI65O1-andadst115
‘setup - PH-4502C pH Sensor Calibration and ADC using MCP3008, PCFASS1, and ADS1115 - Raspoerty Pi Stack Exchange
213114123,737 AM setup - PH-4502C pH Sensor Calibration and ADC using MCP3008, PCF85S1, and ADS1115 -Raspoerry Pl Stack Exchange:
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.
1am making morning coffee with milk, and a selfie!
| 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 | found too good to be true is that the measured pH value of the JJ body wash claiming
pHS.S is 5.51!
hitpssraspberryp slackexchange.comiquestions/96063/ph-4502c-ph-sensor-calibration-and-ade~sing-mcp3008-pcf8591-and-ads 1115 a23114123,737 AM. ‘setup - PH-4502C pH Sensor Calibration and ADC using MCP3008, PCFASS1, and ADS1115 - Raspoerty Pi Stack Exchange
E on ar
Pi Meter MessuementResuts v0 HoegO1 2018epZeNO3CS
‘usu | Googled pH perv Mesauee so
Ss om ow)
$5 °
2 am
oat 2
Now I have drawn the graph to get the values for the Rpi python program to calculate the pH
values.
Ni Meson Res 03 Mo 2cOMI
ant Gosh pe Mew Err
sore
ES 27S sy
Sysue 2a so) a
re ee
Vimar Sar ae a
ie 1am sae
Me a m2
nooo 258) oe
pH meter temperature compensation calibration procedure
I read more references and found a problem. That is Arduino has ADC pins to read the pHmeter's
analog signals Po and To, but Rpi has no built in ADC pins, and must use external ADC to do the
conversion.
PH-4502C pH Meter Pinout v0.1
1. To - Temperature output (analog)
2. Do - Threshold limit output (cial
3. Po- pH meter output (analog)
ital Ground
5. Power Ground
6.Vec=+8V
Warning -To and Po are analog signal, can be read by
‘Arduino ADC pins. Rp has no ADC pins,
therefore must use external ADC such as
‘McP3008 or POFass1 te
-nps:traspberrypstackexchange.com/questions/96089iph-4602c-ph-sensor-calbration-and-ade-tsing-mep3008-pc(859 -and-ads 1115 92134128, 7.37 AM ‘setup - PH-4502¢ pH Sensor Calibration and ADC using MCP3008, PCF85S1, and ADS1115 -Raspbery Pi Stack Exchange
Coca Cola is pH 2.2
Coca Cola Original Taste =
220
measured pH = 7+ (V-2.5)"(-5.5) = 2.22
‘pH of Cola drinks compared to critical pH
i 5S chat
+
fs
; t I LE
S25 4.32
Tota
PCF8591 ADC for pH meter
Now | am thinking of using PCF8591 to do ADC of pH meter for Rpi to read
New Pct8S91 kd / Da Conversion Of To Dial gtato- Converter
Temperature luminaton
oP US $0.88 — Aligxpress
PCFOS9L 12C 8-bit ADC/ORC Therwistor/Photoresistor/Potentioneter Module
4 analog inputs single-ended or differential, 3 address pins,
Analog input range VSS to VOD
Input = AINO, AINA, AIN2,_AIN3
‘Qutput __- Theraistor (PA), Photoresistor (P5), Potentioneter (P6)
Status LED - Power indicator light, analog output status
Temperature Calibration Notes
The PCF8591 ADC will be used to convert two analog out signals - Ao, voltage proportional to pH,
and To, NTS 103 thermistor temperature output.
So | am reading the following notes to learn how to calibrate the temperature reading To,
Designing With pH Electrodes, Application Notes AN1852 - Tl 2013April
Recalibration and ADC Calculation Notes
Now I have moved both the ph meter and PCF5891 ADC module to a protoboard. This time | did
a recalibration using tap water. | found the reading is off by about 3%. The PCF8591 8bit ADC is
1/256 ~= 4%. So | think it is OK for now as a feasibility study to use a 8-bit ADC. Later I think |
-nlps:traspberrypstackexchange.com/questions/96089/ph-4602c-ph-sensor-calbration-and-ade-tsing-mep3008-pc1859 -and-ads 1115 sosuas, 737 aM setup -PH-4502¢ pH Sensor Calivaon ané ADC using MCP2008, PCF85Q1, and ADSI"15 -Raspoeny Pi Sack Exchange
should replace the 8-bit to a 12/16 or even 24 bit ADC, if | am measuring the pH values not in
114 (OV to 5V), but say for soft drinks, in a narrow voltage range of 1 to 2 volts
Anyway, the ADC is ready to start testing. In other words,
Rpi python pH value measurement programming only starts now! :)
Update 2019apr29hkt2308
| forgot to do temperature calibration. | used a heat gun to do a rough check. | found that at
room temperature the output is a steady 4.2V. The reading goes as low as 2V when | used the
heat gun to increase the temperature of the NTC thermistor. The reading goes low very fast, and
recovers to normal only a couple of minutes after | removed the heat. So | now know it is around
4.2V at room temperature and goes low to 2.0V when very warm. The digital out is 0.8V and
the red LED is on. Anyway, I will not be using the alarm warning red light for now.
So now | really start the ADC python programming,
But | need to make sure if the meter offset has not drifted away. | found ph 7 voltage is 2.51V, not
drifted at all, but tap water measured 2.37, offset 5.2%, Perhaps the probe is contaminated,
because | have been too lazy to rinse it often,
-nps:lrespberrypstackexchange.com/questions/96059iph-4502c-pi-sensor-calbration-and-ade-tsing-mep3008-pe(869 -and-ads 1115 net3114123,737 AM. ‘setup - PH-4502C pH Sensor Calibration and ADC using MCP3008, PCFASS1, and ADS 1115 - Raspoenty Pi Stack Exchange
Offset zero = 2.51V (offset screw NOT adjusted)
Tap walor = 2.37V (last time 2.37, not sure itis warmer
today, or offset drifts away. Need to wait for
2 cooler day to verily
Update 2019may01hkt1136
| found that the PCF8591 ADC with only 8 bit resolution is not precise enough for me to
differentiate between Chinese tea and Ceylon tea, Coke from Pepsi etc.
Chinese Tea = 2.58 vs Ceylon Tea 2.64
Voltage difference = 2.58 - 2.64 = 0.06V
Percentage difference = 0.06V
0.06V / SV (input range) = 1.2% 1 / 256 (B-bit) = 0.4%
So | am thinking of using another ADC. | am considering MCP3008 and MCP3201. SP! MCP3201
seems appropriate for this pH meter project, which needs only one channel, thus the Rpi python
SPI program should be easy to write and debug.
MCP3201 SPI 8-bit ADC to convert the pH meter analog signal
Comparing MCP3201 with PCF8591 Record
MCP3201 12-bit SPI 2.7V - 5.5V 100ksps max
PCF8591 Datasheet - NXP
Alifxpress PCE8591 AD/DA Converter Module Analog To Digital Conversion temperature
illumination For Arduino - US$1.37
-nps:respberrypstackexchange.com/questons/96059iph-4502c-ph-sensor-calbration-and-ade-tsing-mep3008-pc1859 -and-ads 1115 sa3114123,737 AM ‘setup - PH-4502C pH Sensor Calibration and ADC using MCP3008, PCFASS1, and ADS1115 - Raspoery Pi Stack Exchange
Programming MCP3201 to convert pH meter output
MCP3201 seems even easier than MCP3008, because it has only one differential channel, no need
to mess around with which channel single ended, which channel differential, and should idle
channel pull up to reduce noise ete
a MCP3201
FETTISSIV Fone Sh
poate Ara aut
eats ansog ret
sera Cook
sera Ost oe
serene vate nt
CuK
ee
Dour Biter be) (eo)(e Y= Yeo Kes Keo N= Nee) {ation )eo)(ee oe
Replacing MCP3201 by MCP3208
-nps:traspberrypstackexchange.com/questions/96089iph-4602c-ph-sensor-calbration-and-ade-tsing-mep3008-pc(859 -and-ads 1115 san4123,737 AM ‘setup - PH-4502¢ pH Sensor Calibration and ADC using MCP3008, PCF8SE1, and ADS1%15 -Raspoery Pi Stack Exchange
found a problem. | forgot that | actually need to calibrate or convert two analog signals: (1) pH
value Po and (2) NTC 103 temperature sensor analog signals. | thought about using MCP3204 the
4 channel version. But MCP3204 and MCP3208 are almost identical in architecture, the only
difference is number of channels. So the python program is more or less the same. So | decided
to use MCP3208.
Dove MCP3204/3208
2.7V 4-Channel/8-Channel 12-Bit A/D Converters
‘with SPI"Serial Interface
de sb oH
ag ue eg tive
i‘ 4 ds & 12D /KGNDy
& pe Eee
de 8 ib neds § 10
dr ® top node & a
qe show” pep
enue tara”
* After completing the data transfer, if futher clocks are applied wih GS low, the A/D converter wil output LSB
fist data, followed by zeros indefinitely (see Figure 6-2 below),
**toxa: during this time, the bias current anc the comparator power down while the reference input becomes
high impedence node, leaving the CLK running to clock out the LSB-irst data or zeros.
Now it is time to start writing the python program. | am thinking of writing 3 big functions:
1. Write command to MCP3208 ADC
2. Read results from MCP3208 ADC
-nps:raspberryp.stackexchange.com/questions/96059iph-4602c-p-sensor-calbration-and-ade-tsing-mep3008-pc(859 -and-ads 1115 1421sits, 737 AM setup -PH-8802C pH Sensor Calbraon ané ADG vsing MCP3008, PCFBSS!, and ADS1"15 -Raspoorry Pi Stack Exchange
3. Convert binary data to decimal
4 Try to guess if itis soft drink, coke or pepsi, or if fruit, possbile orange or mandarin,
ete
Update 2019may03hkt1056 - MCP3208 Programming Notes
Now I have enhanced the basic SPI loop back and repeat send with the following functions to
make it easier to interface with MCP3008/MCP3201/MCP3208
1. Added loopback 1, 2, and 3 bytes. Because MCP3008/MCP3208 works by writing and reading
two bytes. Other ADC with 16/24 bits resolution work with three bytes write read. So it is
important to make sure write/reading 2/3 bytes are OK.
2. Added repeat write functions for easier scope display. This is important to make sure that the
waveforms are not noise interferenced or distorted at high frequencies. For now only 100kHz
is tested. A sample scope screen capture is show below, and looking OK.
tcPs208 Programing Texting Notes tonght 2018ma/e3
‘Setup = 10,0 100KHs, repeat send Oa6 tn milion nos
MCP3208 Program Listing
The program should go many debugging and revisions, therefore not to do too frequent
updating is this post, a Penzu programming diary is given here. The link will keep the same until
next programming milestone, Otherwise the same link will find new program versions updated int
eh PenZu diary. Now is version 09.
‘mcp3208 SPI ADT Test Program Version 09 - tlfong01 2019may03hkt1108
Update 2019may03hkt1531
I checked my urine and found its pH about 8. | googled and concluded that it is alkaline. | also
read the following article to know more.
hat is the normal pH range for urine? - Rachel Nall 2018dec11, Reviewed by Shilpa Amin MD,
AQ, FAAFP.
According to the American Association for Clinical Chemistry, the average value for urine pH is
6.0, but it can range from 4.5 to 8.0, Urine under 5.0 is acidic, and urine higher than 8.0 is alkaline,
hitpssraspberrypstackexchange.comiquestions/96063/ph-4502c-ph-sensor-calibration-and-ade~sing-mcp3008-pcf8591-and-ads 1115 19213114123,737 AM. ‘setup - PH-4502C pH Sensor Calibration and ADC using MCP3008, PCFASS1, and ADS 1115 - Raspoerty Pi Stack Exchange
or basic. Different laboratories may have different ranges for "normal" pH levels.
Anyway, I will move on to python programming,
Update 2019may04hkt2108
But one more sample for self calibrating worksheet.
Rika
Now Chinese deer herb wine voltage output = 2.95V
So pH value = 7 + (2.95 -2.5)*-5.5=45
And urine pH measurements
Urine = 2.28V = pH =8.21
Water = 2.43V
ace
Rn SER EHO) HEED BHO
nine pit
7+ (V- 2.5¥) * (5.5)
7+ (2.28 * 2.5) * (5.5)
7 + (0.22) * (5.5)
741
a2
Using DS18B20 to measure the temperature of liquid to refine calibration
-nlps:traspberrypstackexchange.com/questions/96059iph-4602c-p-sensor-calbraion-and-ade-tsing-mep3008-pc1859 -and-ads 1115 16213114123,737 AM.
-nps:traspberrypstackexchange.com/questions/96089iph-4602c-ph-sensor-calbration-and-ade-tsing-mep3008-pc(859 -and-ads 1115
‘setup - PH-4502C pH Sensor Calibration and ADC using MCP3008, PCFASS1, and ADS 1115 - Raspoerty Pi Stack Exchange
When translating the OP's pH meters manuals, | found the DS18820 is used to measure the liquid
temperature, so to adjust the calibration values. So | am now checking out how DS18B20 can be
used,
TTI
met
mmeaenamenem, — DATER
ee LL |
ead rT] Li
coer Peery 5
DS18820
DALLAS yam: solution
BDALLAS osynatncmanir
/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. :)
(BAREHE ru 4502 Liquid Pit Value Detection Detet
‘Sensor Module Manitertg Conrl For Aruna
$8.90 USD
wet34128, 7.37 AM ‘setup - PH-4502¢ pH Sensor Calibration and ADC using MCP3008, PCF85S1, and ADS1115 -Raspberty P Stack Exchange
Do you mean the AT instruction set? Or the hardware setup? | guess they are common to all the
real and fake boards. | can do the translation if that is what you need.
The basic Hello test is universal. You say "AT\"\y
commands are also universal:
and the Ph Board will return "OK". The general
Reset, Current Ph value, Temperature, Threshold, Factory default setting, Current
operation mode, ..
wove EES
= gt a
eae
If you wish to translate the names of the pins. Here is one for the J3, J4 pinouts.
-nlps:lraspberrypstackexchange.com/questions/96083iph-4602c-ph-sensor-calbration-and-ade-tsing-mep3008-pc1859 -and-ads 1115 1023114123,737 AM. ‘setup - PH-4502C pH Sensor Calibration and ADC using MCP3008, PCFASS1, and ADS 1115 - Raspoerty Pi Stack Exchange
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. | have a brief suggestion list for the newbies.
1, Test Rpi 3V3 signals is OK
2. Test Rpi 3V3 signals converted to SV logcie is OK.
3, Test Rpi 3V3/5V0 loopback hardware is OK.
4. Test Rpi sending string such as "AT/t/n” is OK
5, Test is CH340 cable is OK
One final reminder to USB CH340 newbies: Remember to disable Serial Console at the Rpi Config
Menu:
-nps:trespberrypstackexchange.com/questions/96059iph-4602c-ph-sensor-calbration-and-ade-tsing-mep3008-pc1859 -and-ads 1115 19213114123,737 AM ‘setup - PH-4502C pH Sensor Calibration and ADC using MCP3008, PCFASS1, and ADS1115 - Raspberty Pi Stack Exchange
et | come
Samm) oe tom
And the plug and play, no library required, minimal, complete, verifiable, UART self test/loopabck,
repeat send AT/r/n python program.
JART Self Test Program
# vart_teste6 tlfonget 2o19apreghkti6e3 ***
4 Computer
Linux
# Python
# Test 1
4 Function
Test 2
4 Function
4 Setup
4 Note 2
Rpi3e+
$ hostnanectl = raspberrypi Raspbian GNU/Linux 9 (stretch) Linux 4.24.34-v7+ arm
= >>> sys.version = 3.5.3 Jan 19 2017
+ repeathriteBytes() - UART port repeatedly send out bytes.
+ Repeat many tines sending bytes, pause after each bytes.
+ loopBackTest() - UART port send and receive bytes.
= Send one bytes to TX, walt some time (Note 1), then read bytes back from AX.
+ Connet Tx pin to Rx pin to form a loop.
# Bolutek BlueTooth BCe4 needs at least 1nS to respond
fron time import sleep
import serial
serialporte = serial.Serial(port = ‘/dev/serialo",
baudrate = 9600,
parity = serial.PARTTY_NONE,
stopbits = serial.STOPBTTS_ONE,
bytesize = serial.£IGHTBITS,
‘tineout= 1)
def setSerialPort8audtate(serialPort, baudrate)
serialPort.baudrate = baudrate
return
def serialPorthritebytes(serialPort, writesytes)
SerialPort .write(writesytes)
return
def serialportReadbytes(serialPort, maxytesLength):
readBytes = serialPort.read(maxBytesLength)
return
readsytes
-nps:raspberryp.stackexchange.com/questions/96059iph-4602c-p-sensor-calbration-and-ade-tsing-mep3008-pc(859 -and-ads 1115 202134128, 7.37 AM ‘setup - PH-4502¢ pH Sensor Calibration and ADC using MCP3008, PCF85S1, and ADS1115 -Raspbery Pi Stack Exchange
Good 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
(2) PCE8591 ADC/DAC Program V1.0 - tifong01 2019n019hkt1718
(3) PCE8591 ADC/DAC Programming V2.0 - tifong01 2019nov19 penzu
(4) PCE8591 ADC/DAC Programming V2.1 - tIfong01 2019nov19 penzu
(5) Ezo pH sensor Product sheet - Atlas Scientific
(6) Ezo pH sensor User Manual - Atlas Scientific
Share Improve this answer Follow ‘edited Jun 16, 2020 at 10:47 answered Apr 18, 2019 at 4:11
S_ Community/set tlfongot
r1 4827 9 28
4 How is this an answer to the question? — Steve Robillard Apr 18, 2019 at 5:34
1 Thisis an interesting answer, but does not appear to mention calibration. f you update it to include
calibration then it would be a good answer.~ Greenonline Apr 18, 2019 at 731
Well, lam just a poor hobbyist. Long time ago, | studied in a trade middle school, focusing on metal work
and mechanical drawing, hoping to become a car mechanic one day to eatn a living, Actually | have never
heard about the pH thing until some year ago when TV ads mention about it.| have never seen any pH
‘equipment in school lab. All| know is from Google. So you see at the end of my answer, | added the pH
general knowledge post. | read ita couple of times, memorized the strange names by heart, so | can
pretend to know some chemistry, and get more respect than I deserve, ...)~tfong01 Apr 18, 2019 at 7:50
@Steve Robillard Ah, sorry, | did not understand your comment until | read Greenonline's answer, Originally
| 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 | 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. | am good in
physics but hopeless in chemistry. Anyway, | will try to do some self learning in pH stuff and see if I can
improve my answer. tlfong01 Apr 19, 2019 at 9:10
1 Big thanks @tlfong01 only your formula works for me - just a bit edited ;) So when | read data via
command: gpio -x pcf8591:120:0x48 aread 120 Then | calculate phValue: 7 + ((parseFloat(data) * 3.3 / 255) -
25) *(-5.7) ~ Marek Javiirek Mar 24, 2020 at 21:53 7
-nps:traspberrypstackexchange.com/questions/96089iph-4602c-ph-sensor-calbration-and-ade-tsing-mep3008-pc(859 -and-ads 1115 2uat