I have a pH meter (DIY-4502C) hooked up with Raspberry Pi. However, the instruction to calibrate is in Chinese and seems outdated (https://www.diymore.cc/collections/ph-value-detect-sensor/products/diymore-liquid-ph-value-detection-detect-sensor-module-monitoring-control-for-arduino-m).
Does anybody know how to calibrate it for measuring pH4-7? Thanks.
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_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(), ...
>>>
'''
# End
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
-
1How is this an answer to the question? – Steve Robillard 1 hour ago
Categories: Uncategorized




