Go Down

Topic: Help with Ph sensor pin abbreviations (Read 8556 times) previous topic - next topic

kwoods

Hi,

I bought a ph shield for arduino from china and i couldn't find the schematic online. The leads coming out have the following symbols. What do they stand for? I know the second G is ground and v+ is 5 volts. Not sure what the others stand for. Thanks
 
"To" - "Do" - "Po" - "G" - "G" - "V+"

marco_c

#1
Jul 15, 2015, 12:38 am Last Edit: Jul 15, 2015, 12:38 am by marco_c
If the sensor module has an IC on it, look at the datasheet for the IC and try and trace the signals from the IC to the connector. There is usually a direct link, and the IC datasheet will have a full explanation of the signals. If you are lucky they have just called them the same thing.

It also helps if you can include a picture or a part number for the thing you are asking about.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

kwoods


DrDiettrich

Please try to decipher the IC IDs yourself, they are unreadable on the photo.

I'd guess that "o" means output, T might stand for temperature, P for Ph.

kaz1366

hello kwood:

As you also buy the same ph sensor module, have spent much time searching the Internet and connect to Arduino without much luck, I managed to locate the manual for this module but the Chinese language, all you have achieved is what econtrar referred to pin:
To temperature 1
Sun: Temperature 2
Po: PH
G: ground data
G: negative or ground voltage
V +: voltage or 5V

It can be connected to analog signal card, will try to SKU #: sen0161 to see if it works I'll be posting more information to be my breakthrough.

Best Regards

sonnyyu

#5
Oct 03, 2015, 02:48 am Last Edit: Oct 03, 2015, 05:33 pm by sonnyyu


Vph-=Vzener/2

p_AOUT is output of PH. connect digital multimeter to confirm.



The diagram of board.



ayafsay

same here, i can't using that module to arduino,

ayafsay

hi, i found solution, Po is ADC output for interfacing to analog input arduino, but the problem is went PH water is low ADC output from Po is high value, and wen PH water is high ADC output from Po is low, how to reverse this in float code?

OldSteve

#8
Oct 22, 2015, 09:57 am Last Edit: Oct 22, 2015, 10:11 am by OldSteve
Do you mean this:-
Code: [Select]
// pHRead.ino

// Constants:-
const byte pHpin = A0;    // Connect the sensor's Po output to analogue pin 0.

// Variables:-
float Po;

void setup()
{
    Serial.begin(115200);
}

void loop()
{
    Po = 1023 - analogRead(pHpin);  // Read and reverse the analogue input value from the pH sensor.
    Po = map(Po, 0, 1023, 0, 14);   // Map the '0 to 1023' result to '0 to 14'.
    Serial.println(Po);             // Print the result in the serial monitor.
    delay(1000);                    // Take 1 reading per second.
}

Reverses the analog pin input reading from '1023 to 0' to '0 to 1023', maps it between 0 and 14, then prints it to the serial monitor.
An input of 511 is neutral and will return 7.

Edit: I should add that when writing this I was assuming that the range of the pH sensor is 14. I'm fairly sure that's right.
(And I made a silly mistake at first, but all fixed now. :) )
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

ayafsay

Do you mean this:-
Code: [Select]
// pHRead.ino

// Constants:-
const byte pHpin = A0;    // Connect the sensor's Po output to analogue pin 0.

// Variables:-
float Po;

void setup()
{
    Serial.begin(115200);
}

void loop()
{
    Po = 1023 - analogRead(pHpin);  // Read and reverse the analogue input value from the pH sensor.
    Po = map(Po, 0, 1023, 0, 14);   // Map the '0 to 1023' result to '0 to 14'.
    Serial.println(Po);             // Print the result in the serial monitor.
    delay(1000);                    // Take 1 reading per second.
}

Reverses the analog pin input reading from '1023 to 0' to '0 to 1023', maps it between 0 and 14, then prints it to the serial monitor.
An input of 511 is neutral and will return 7.

Edit: I should add that when writing this I was assuming that the range of the pH sensor is 14. I'm fairly sure that's right.
(And I made a silly mistake at first, but all fixed now. :) )
Thank you sir very much, i'll try now...

ayafsay

i got problem, went analog read 450-476-480, ph is just got 7.00

OldSteve

#11
Oct 23, 2015, 06:07 pm Last Edit: Oct 23, 2015, 06:14 pm by OldSteve
i got problem, went analog read 450-476-480, ph is just got 7.00
Sorry about that. I just realised that 'map()' will not generate fractions. I only tested inputs of 0, 1023 and 511, so it looked OK.

Instead, try this:-
Code: [Select]
// pHRead.ino

// Constants:-
const byte pHpin = A0;    // Connect the sensor's Po output to analogue pin 0.

// Variables:-
float Po;

void setup()
{
    Serial.begin(115200);
}

void loop()
{
    Po = (1023 - analogRead(pHpin)) / 73.07;   // Read and reverse the analogue input value from the pH sensor then scale 0-14.
    Serial.println(Po, 2);                    // Print the result in the serial monitor.
    delay(1000);                              // Take 1 reading per second.
}
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

ayafsay

Thank again @OLDStave, i'll try now...

OldSteve

Thank again @OLDStave, i'll try now...
Glad to help. Let me know how you go. This version should be much better.

And now if I ever get one of those pH modules, I'll know how to use it. :D
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

LeCyb

#14
Mar 02, 2016, 07:59 pm Last Edit: Mar 02, 2016, 09:26 pm by LeCyb Reason: Corrections, design
Hi all,

First of all, I'm only speaking about the board labelled "www.auto-crtl.com" and "Logo_PHsensor v1.1". The one with only 6 pins in front of the BNC plug (not on the side) as you can see in image Pinout1.jpg.

I also bought this little board from China and it is difficult to make it working. Most topics are related to other boards (Atlas, Sparkfun, Sparky's Widgets, etc.) and nothing is working. And when the subject is speaking about the correct card, the information is incorrect or computation are made with random numbers coming from the sky.

Some words are in italic to avoid "experts" saying it's incorrect (because it is incorrect) but for our small projects and for understanding I intentionaly use those "simple" terms.

General info about pH to know

The pH is a value between 0 (acid) and 14 (basic) with a neutral value of 7.

The curve (log10) of the pH is a mix between linear and exponential as you can see in pH_curve.png. It means that you can almost measure a linear value between 4 and 9 pH. Less than 2 and more than 12 is almost impossible to determine something (too acid or too basic).

The probe is like a (tiny) battery when placed in a liquid. Depending the pH it output a positive or negative voltage of a couple of millivolts. This value is too small and other tech stuff like impedance make it unusable directly with an Arduino that's why you need an "op amp". The op amp board just convert the millivolts of the probe into to something acceptable for Arduino (positive between 0 and 5v).

There are 3 common buffer solutions used for pH measurement: pH 4.01, pH 6.86 and pH 9.18 (7.0 and 10.0 exists). I suggest the powder instead the liquid because it's cheaper, expire after longer and the powder can't be contamined (vs bottle). You should read the product instructions but usually you have to put the content of the bag into 250ml of water and stir. You can use any water with an average pH (6-8) because the powder will saturate the water at the correct pH level. I personnaly use tap water (pH 7.4) and didn't see any difference between distilled, osmosed and demineralized water. Buffers are not stable in the time, this means that you cannot keep the solution for weeks or months.

Board description

  • BNC plug: Where you put the probe. It seems to work with any probe with a calibration difference. I tested 3 models (cheap blue, cheap black and a short black from a EC+pH kit).
  • Pin To: Should be the temperature but I can't make it works.
  • Pin Do: High/Low 3.3v adjustable limit.
  • Pin G/GND: Probe ground. It is useful when the ground is not the same as your Arduino. In some circumstances the ground voltage of the liquid to measure can be different.
  • Pin G/GND: Power ground (direct from Arduino).
  • Pin V+/VCC: Input power 5V DC (direct from Arduino).
  • Blue potentiometer close to BNC: pH offset.
  • Blue potentiometer close to pins: limit adjustment.
  • Black component with 103 printed (not the one between potentiometers): thermistor for temperature compensation.

"Calibration"

A single word for many things because in our case there are 2 different calibrations. The "offset" value and the "step" value.

  • The offset.
    The offset is the shifting of all pH values to a specific voltage range. If a pH 7 output a voltage of 2.2v and pH 8 a voltage of 2.1v, then a shift of +0.3v move the pH 7 to 2.5v and the pH 8 to 2.4v. This can be done on the board or via software but it's probably easyer on the board because it's probe independant and there are less programming to do.

    Connect GND (both) and Vcc to Arduino GND and 5v. Remove the probe and do a short circuit between the the small BNC hole and the external part of BNC. Put a voltmeter (or Arduino) to measure the voltage between GND and Po. Adjust the pot (close BNC) until the output is 2.5v. Now the pH 7 have an exact value of 2.5v (511 with analogRead function) because the probe will output 0 millivolt.
  • The steps.
    Now you need one or more buffer solutions depending the range and precision you want. Ideally you should know the range of the measure you want to do with your system. I use water between pH 5 and pH 7, then I choose the buffer 4.01 (and 6.86 to verify my stuff). If you usually measure pH between 8 and 10 choose buffer 9.18 (eventually 6.86 also).
    Connect the (clean) probe and put it in the buffer then let it stabilize for a minute. You know it's stable when it goes up and down (3.04 then 3.05 then 3.03 then 3.04) .Take note of the voltmeter (or Arduino) value, in my example it's 3.05v.

That's all, now you can use it with the code below.


The code

The PH_step calculation is quite simple. You take the difference between the two known voltage, in my example 2.5v@pH7 and 3.05v@pH4.01 which is -0.55v. It's the voltage range equivalent of the pH range from 7 to 4.01, which is 2.99 pH units. A small division of the voltage by pH units gives you a volts per pH number (0,1839... in my case).

The PH_probe is calculated by taking the known pH 7 voltage (2.5v) where we add some PH_step to match the probe voltage. This means that a pH of 8 have a voltage value of 2.5v (pH 7) + 0.1839 (1 unit/step); pH 9 then is 2.5v + 0.1839 + 0.1839 = 2.87v.

No magic number, no ridiculous stuff, just maths :).

If you need under and over pH 7, I suggest you have two PH_step variables. One for the lower part (use buffer 4.01) and another for the upper part (use buffer 9.16). The probe is almost linear but far from perfect and you can have a side more linear than the other.

Code: [Select]

int ph_pin = A7; //This is the pin number connected to Po

void setup() {
  Serial.begin(9600);
}

void loop() {
  int measure = analogRead(ph_pin);
  Serial.print("Measure: ");
  Serial.print(measure);

  double voltage = 5 / 1024.0 * measure; //classic digital to voltage conversion
  Serial.print("\tVoltage: ");
  Serial.print(voltage, 3);

  // PH_step = (voltage@PH7 - voltage@PH4) / (PH7 - PH4)
  // PH_probe = PH7 - ((voltage@PH7 - voltage@probe) / PH_step)
  float Po = 7 + ((2.5 - voltage) / 0.18);
  Serial.print("\tPH: ");
  Serial.print(Po, 3);

  Serial.println("");
  delay(2000);
}



pH limit (Do pin)
You can adjust the pot close to the pins to adapt a pH limit. If the limit is reached, a red led on the board (near the green one) switch on/off and the Do pin pass from 3.65v to 0.77v. This can be used as HIGH or LOW values with the digitalRead() function or any other interrupt.


Temperature
The To pin should do something about temperature but I'm not mastering LM358 op amp stuff. The thermistor should adjust the pH value but didn't notice any remarkable change (liquid = 20°C, thermistor = 50°C). Anyway, at normal (18-25°C) temperature there is no pH difference with temperature compensation for a hobby purpose. For a simple aquarium you need pH between 6.5 and 7.5, then a measure variation of 0.1 or 0.2 is fine.


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy