pH controller unstable in field measurements

Don't put any wire into this thing if there are animals in it. Copper is poisonous to marine life.

But it is an essential micro-nutrient also. Probably OK to use stainless steel though or gold plated electrodes.

Since the pH value should not vary quickly

Seawater pH should not vary much second to second, unless exposed to extreme pollution - it has it's own buffering capacity. Freshwater (eg river) has little buffering capacity compared to seawater and pH can vary dramatically with pollutant loads. Aquatic plants can alter pH even on a day/night cycle.

I think You are dealing with ground leakage currents, In other words there is a galvanic connection between your probe and the Mains return or neutral and the reason that I said that the PSU output cannot have any connection to earth ground, even an electrostatic one, thus the shielded transformer. Your Power Supply Must look like batteries to the instrument while following standard mains wiring isolation and safety, considering possibly reversed wiring, open Ground's and other "Unknown" catastrophes. Without that precaution the measurement must be done externally, That is not an issue however... You can always 'pump' a sample into a receiver and dump it when you are through. To test this hypothesis is simple in order to eliminate ground interaction (s)... connect a set of batteries to the device and try again, where the instrument is floating, not connected to anything else except the measurement sample. Your PSU Primary ground (Green Wire) should only connect to the transformer frame, Nowhere Else. I do need to say that you have to of course follow the applicable regulations in your country of origin. This device due to the nature of it's intended application is most very similar to a "Medical" Device in it's possible interactions with currents flowing from any other source, much like the necessary line isolation required for an EKG or EMG as whatever line leakage current flowing is also a part of your measurement current. The fluctuations might possibly be sampling artifacts of a big 60 Hz leakage current flowing between your probe and the local ground (the reservoir). IMO

Doc

Doc, I have a feeling you might have stroke the problem right on the head.

I've mentioned before that the PCB ground was connected to the transformer center tap. What I think I haven't mentioned yet, was that I also connected the center tap to the transformer frame, and thus to the green/yellow mains ground wire (I only did this because I thought it was the easier way to set the tap at 0V, because I was getting up to a 4V drift without it, thus getting the 12V and -12V I needed out of the two outputs, it's a 240V-24V transformer). So, my PCB ground (where the probe reference is also attached) is connected to center tap, which in turn is connected to the mains ground. Could this be the cause for that leakage?

I'll test tomorrow with some batteries just to test that hypothesis, and hopefully that will be the end of it. And if it does work, I have to find a way to have a stable center tap at 0V. If not, I think I'll just try to implement a way to pump a sample in a cup and cut the corners.

I'll keep you posted. Thank you.

Change your transformer to a shielded type ground the frame to earth ground for fire/litening safety through grounding. You must I think keep the PSU and earth grounds separated, sometimes it is necessary to use a transformer with a high voltage type insulation for safety reasons particularly in sensitive situations where other equipment is connected as well, data loggers, RS485 Comm, 4 - 20mA loops... all are possible sources of interaction. It thus unfortunately becomes incumbent on the designer to make sure that the equipment's design isn't a part of someone else s faulty or shortsighted design work. Much the same should be said of software as well there are many obvious issues with software engineers trying to design hardware without a good idea of how the hardware must be supported. or how to condition analog as well as digital signals. I don't think much more need to be said about good by-passing methods ass these are required parts of any design. IMO

Doc

Doc, you nailed it. It was indeed an issue with ground leakage currents. I took out the connection between the center tap/device ground and the transformer chassis/ground and it worked like a charm :). A small variation still occurs but it's in the order of 0.02-3 pH and it's negligible, it must be as you said from stratification of the water or other factors.

The only worry I have now is that my center tap will not be at 0 V and will have some drift, I've had that happen sometimes during testing stage (and hence why I connected to mains ground). What is a good practice to ensure that it, and therefore my PCB ground, will stay at 0 V? I didn't really want to have to buy another transformer.

Thank you so much! I honestly don't think I would have figured it out by myself. Living and learning :).

The transformer is perhaps not as big a deal as you might think. There are split bobbin transformers that will fill most of the bill naturally. The PSU must look like a battery to the PH measurement equipment and I think you have perhaps one too many grounds. Perhaps a small capacitor somewhere is causing an offset to the input by charging to the absolute (peak) offset between the common or return leg of the power supply and the mains. Actually what I think is that you are seeing just that, it would only take a hundred pA of equivalent bias or leakage current. If you design your tool to operate stably from batteries and design your PSU to be an totally isolated battery most of your work will be done. IMO (Addition to text) After some thought, the noise in your measurement could be a need for modifying the sampling period ( take 3 or 4 measurements every minute or so and average the result per sample interval) sampling or low-passing the probe signal as the variations could well be 60 and 120 Hz sampling artifacts, noise that periodically occurs within the sampling period that is not directly related to the sampling period will look like small time variant changes in the sampled signal... Noise If you place a low pass filter between the PH meter analog end and the digitizing element (the A/D input) with a corner frequency of 10 Hz or so... I think most of the noise will disappear. Again IMO

Doc

Awesome job nailing this Doc, and I am glad that this is resolved as I am quite sure this information will help others as well. I will definitely add in this information to my pH tutorial for those that will be mains powering these types of interfaces. Actually this is quite good information in general, as if could be overlooked quite easily. Keep us posted on this project Androxys!

Hello.

Sorry for no updates but I had other efforts to delve in and went back to this one a few days ago, only to find out that I am having problems again.

It was all working fine after fixing the ground leakage issue Doc pointed out. However, after about 3 to 4 weeks of usage, I was reported that the measurements were oscillating again. I went to the site and the situation was terribly worse than ever before.

Not only was the ph oscillating (by about 2 ph, in addition to being lower much than the expected set point, it should be around 8.20 and measurements went from 5ish to 8 ), but also the temperature sensor was reporting temperatures from 50ºC to 60ºC, when it should be 24ºC (and I had never had any trouble with the LM35 before).

First thing I checked was the power supply to see if it had a ground-neutral short. No such thing.
After some research and a few hours in the think tank, I thought I had come up with a plausible theory. My guess was that I had a ground loop in the system which hadn't been problematic before. But now maybe my LM35 had acquired some condensation in the conductor (as I had used a cat5 with a plastic cap/epoxy on the sensor), which changed the capacitance, and that was adding noise which would go into the ph line through the ground loop, explaining both sensors going bonkers. However, I ran some tests where I only used one sensor and the other value was fixed, and I still have terrible variation in the water tank. Again, on a water sample from a bottle, it works great, so the problem involves the tank again.

After a few hours of trying different things, I realized that for some reason, the hose that is adding water into the system is the one responsible for my LM35 going bananas. I don't know why suddenly it does when it didn't before, maybe there was some change in the electrical installation of the pumps, but I doubt. If the hose as much as touches the water, a lot of noise is added into the system. Also, if the hose stays in the air and the water is dropped in the tank, it also adds noise (water carries the charge).

So, this solves the temperature problem, BUT the ph values still have a variation of 0.4 (when I should be looking at a 0.01 at most, as it did last time everything was working fine). I also thought it might have to do with a dirty sensor, I still haven't managed to get a hold of another to try it, but I still doubt it.

I also thought about adding a low pass filter to the entrance, however I'm not so sure about it. After designing it and looking at the bode amplitude plot, I realised that, as I'm doing a 200 value averaging for every measurement, the speed of every one of those 200 value measurement is faster than the bode plot takes to reach it's peak value. So every measurement would be undercut by a lot. And then there's the problem with high impedance and the filter probably will degrade the signal even further before it gets to the amp-op. And I kind of gave up on it. However I might be wrong, my filter design skills haven't been used a lot lately.

I measured the DC input to the arduino (for the ph) and the value is stable, however I also have a large enough AC value in it and that's probably the noise I'm having.

Anyone has any thoughts about what could be doing it? Or a nice filter solution?

Thank you very much for any help.

Andre

Just out of curiosity, and a little desperation, I am going to try to fit a LPF in there, with a 100K resistor, 50 nF capacitor, for a T of 5 ms and a cutoff frequency of ~30 Hz. I wanted it to be lower but I don't want a large T. See what happens. I will later have you know how that went.

André

EDIT: two low pass-filters at 10 Hz before the ADC (one for each sensor), a severe cleaning of the ph probe, and a new lm35 solved my problems. Didn't manage to find the noise source though. Thanks for all the help guys.

EDIT 2: Just remembered I hadn't updated the post, for future reference to anyone who might need to know. Actually I did find the source. Some variation still shows up (despite the 10 Hz LPF) in windy conditions, even with a turbulence shield. In fact, the responsible for the noise is the water tap that inserts water in the system for recirculation (not the tap particularly, but the water in itself), because if I close the tap, the noise is gone. I guess it has to do with the waves that form in the water bay where the water is captured through a pump, on windy conditions. My mech. engineer uncle suggested that the waves could change the pressure in the pump's inlet which would variate the work, and it somehow was interfering with the system, maybe a cavitation effect or a low frequency noise.

Androxys:
... I am going to try to fit a LPF in there, with a 100K resistor, 50 nF capacitor, for a T of 5 ms and a cutoff frequency of ~30 Hz
...
low pass-filters at 10 Hz before the ADC

^
^
THIS!!! Totally worked for me. I had severe ground loop/Galvanic isolation issues trying to monitor pH in my saltwater tank. Powering the arduino (and the probe) from a laptop on battery power confirmed this was the issue because the numbers were rock solid until I plugged in the laptop AC adapter, or attached the external PSU to the arduino... at which point the numbers would deviate.

....to replicate your 10Hz low pass filter I used a 220k resistor and 70nF capacitor....BINGO!

now I'm getting the same stable numbers on mains power as I did on laptop battery power!! I've been banging my head against the wall all week trying to fix this issue, THANK YOU SO MUCH!!!!

Hello.

Anyone can update the final way can solve this problem.

I have try many ways but still can not make the PH measurement stability. It just stability when put the probe to a cup of water, when put the probe to the tank it always variant about 7.3-7.8 .

we are try to build a system for smart agriculture but we meet a lot of problem with sensor field. So i think why we don't connect together and make some sensor for everybody can use it. The commercial sensor is expensive and some time the manufacture, the don't sell the sensor only they want to sell the sensor include the controller for more expensive.

Finally, now i need some of this sensor as below that can connect to ardruino board, if you can help me please let me know:

air: temperature, humidity, light, Co2, rain

Water: PH, Conductivity, temperature

Soil: humidity, conductivity, temperature

my email: quangduc191@gmail.com

Hi quartapound,

I'm very newby in electrical topics and your solution is not exactly clear for me. Where should I connect the LPF exactly?

Thanks.

PalfiZsolt:
Hi quartapound,

I'm very newby in electrical topics and your solution is not exactly clear for me. Where should I connect the LPF exactly?

Thanks.

On the power Vcc.

if money is not too much of an issue, take a look at these fine circuits for quantifying several water quality attributes.

Lots of good stuff available.