Arduino + PH probe in Aquarium. Ground Loop. Please help.

Hi, I'm making a project with arduino that monitor my reef aquarium. So one of the things that I have is PH monitoring.
To do that, I have the Atlas Scientific Ph Stamps:

http://atlas-scientific.com/product_pages/embedded/ph.html

My connection is like this:

When I mesure the PH inside a bottle or a glass it measures the PH very precise, but when I place the probe inside my aquarium it give me wrong values. I also noticed that when I turn off my watter pumps in the aquarium the reading is fine, but when I turn the pumps on the problem appears again.

I have read a lot about ground loops (Teksas Holdem Poker – Tüm Poker Çeşitleri Tek Platformda) and interference with pumps and noise that is inducted into the PH probe but I don't understand what I have to do/buy to solve this.

So for my understanding until now I have to buy DC-DC power converter and an optical data isolator but I don't understand what chips to buy and how to connect them im my arduino conection like I showed.
For example this other controler show this:

http://www.splatco.com/sx10507.htm

This uses a transformer isolated DC-DC power converter, and an optical data isolator, to ensure there is no metallic (ohmic) connection between the pH probe and the controller. This isolation eliminates the interference that can be caused by ground loops.

Please give me some guidance about this. If what I think it is, is correct and how can I solve this issue.
Thank you vey much.

Could you add a link to the PH-probe ?
I read that a glass-PH-probe could be 800MOhm, is that right ?

Do you use a good shielded cable, which is fully shielded at both ends ?

Some noise of the mains voltage is probably passed on to the water via inductive/capacitive coupling in the pumps. It is almost impossible to get rid of that (only if batteries are used to power the pumps).

An opticial isolation could work. A DC/DC converter with an transformer removes the ground loop, but also passes on noise. An input circuit with a battery could also do, and with a optocoupler to pass the digital signal to the Arduino.

You could do a test. Use a battery for the Arduino and sensor board. Don't connect the usb or anything else to the Arduino, and store the PH-value in EEPROM. After that, read the EEPROM and check the values. If those values are good, your circuit is good and the problem is the noise and the ground loop.

I'm sorry, but I couldn't find a good solution for a PH-sensor. You might have to buy such an isolated circuit as the SX10507. Using your Atlas Scientific Ph Stamps circuit board and making your own isolated data transfer is not easy.

Added: Now that I have thought about it, the best way to isolate it, is at the serial connection. You could use two optocouplers for the RX and TX signals. The Atlas Scientific Ph Stamp could be powered with an galvanically isolated DC-DC converter.
There are ic's for RS232 isolation, but two normal optocouplers is better. Like these: http://yusisukmalia.wordpress.com/2009/06/11/rs232-make-optocoupler/
Slimme Meter aansluiten op Arduino - Forum - Circuits Online
An isolated DC-DC converter is cheap if they have unregulated output:
DC/DC 1W isolated converter 5V IN 5V OUT MORNSUN F0505M-1W | eBay
But you have to test it, the output could be too noisy.

Hi, first of all thank you very much for the answer.

My PH probe is this one:

I think the cable and connectors are shielded so i don't think that's the problem...
So in your opinio I should power up the PH stamp with an isolated DC-DC converter like that one you showed on ebay.
Second I should isolate the RX - TX that connects the arduino with the stamp with 2 optocouplers. Can you plese show-me a model available on ebay so that I'm able to buy it or the reference to search on my local store.
I also don't know how to connect the opctocupler but that will be another stage.

Thanks again.

For someone familiar with electronics, two optocouples like the schematics I linked, is not hard.
I'm sorry but I can't find a ready-to-use board on Ebay.

Hi what about this optocoupler:

Does it will work?
And I have to buy 2 of these, on for Rx and other for TX.

I also said that there are some RS232 IC's that do this isolation. Can you point me any that i can find on ebay?

Thanks.

Edit:
Fund this:
http://www.ebay.com/itm/1x-MAX251EPD-5V-Isolated-RS-232-2-Driver-2-Receiver-MAX251-/110753204175?pt=LH_DefaultDomain_0&hash=item19c967c7cf

Read this: http://arduino.cc/forum/index.php?topic=100729.0

I think that 2 common optocouplers with 4 resistors is easier than using a special ic.

The old 4N35 could be used. This type is better for small signals than the old 4N27. There are also faster optocouplers for digital signals, like the 6N137 (or 6N138). The 6N137 is designed for this, but it is not like the old optocouplers, it has extra pins.
The 6N137 (actually the 6N138) is used here : How to Hack Toy EEGs | Frontier Nerds
And here:
http://people.ece.cornell.edu/land/courses/ece4760/FinalProjects/s2012/cwm55/cwm55_mj294/index.html
One of the links in my previous post uses also the 6N138.
I would prefer the 6N137 over the 6N138 for a serial connection.

Hi vrgomes, did this setup work for you? I have the same ph stamp as you and the same issues. I've purchased a dc/dc converter isolator and a couple of 6N137s... Hopefully this will solve the problem.

Cheers

Did you ever get this working?
I had a similar problem, but here the lights caused the error in pH. Grounding the lights did not solve the problem, but grounding the water seems to do the trick. For now, while testing, I simply put a wire on ground in the power outlet and the other end of the wire, directly into the water. I get fine readings now, and hopefully I'm not creating anything dangerous here...

Edit: I have the Pidgets 1130 not the Atlas, but maybe it works for you anyway.

Another possibility is to use a digital isolator chip that provides both signal isolation and isolated power, such as the ADUM6400 series. Although it's an SMD chip, there is an evaluation board for it, and it's quite easy to hand solder the chip onto the board.

Hi everyone,

Well since the OP hasn't responded, I have gone ahead and started building a circuit using a couple of 6N137s and a DC/DC isolator/converter.

Hopefully I'll get it finished tonight and will report back about my findings!

Cheers,
Armen

Hi, sorry for the late answer.
It was because in the mean time I contacted Atlas Scientific about this issue. So this was the result:

Ok, this is what to do.
put a NPN mosfet on the ground line going into the E.C. circuit.
You will want to stop all GND from entering the E.C. circuit.
When you take your E.C. reading open the NPN mosfet, take your readings then close the mosfet.
Your pH will still be a little off.
Recalibrate your pH with the E.C. probe in the pH calibration solution (the E.C. probe should be connected to the E.C. circuit and the GND line should be cut off with the PNP mosfet).
This has proven to be successful in fixing the pH / E.C. problem.

Put the NPN Mosfet at the ground line coming into the circuit.
You know, VCC and GND.
Cut the GND line that is powering the circuit not the ground line going to the probe.

As far as which mosfet to buy, there are 100’s.
Here is one that should work well for you: 2N7000_D26Z

Turn on the FET when you take an E.C. reading, turn it off when you are done taking readings.

Yes, place the mosfet between the Arduino and the ground line.

I am not 100% sure the 2N7000 will work .
However, I do believe it will work just fine.
It is a quality FET and that’s generally all you need.

If it were me, I would use it.

So, I'm a little lost where because I didn't understand very well ho to solve this. Anyone help?
In the mean time I bought 2N7000 mosfets:
http://www.fairchildsemi.com/ds/2N/2N7000.pdf

So my understanding I have to put this mosfet between the arduino and the Stamp in the ground line but i don't know how to connect it and use the mosfet.

Thanks for the welp!

vrgomes:
So my understanding I have to put this mosfet between the arduino and the Stamp in the ground line but i don't know how to connect it and use the mosfet.

Yes, that is what I think he is suggesting. I'm not convinced that disconnecting the ground without also disconnecting the positive supply will help, but I guess it's worth trying. Connect mosfet source to Arduino ground, drain to pH module ground, and gate to an Arduino pin configured as an output. Set the pin LOW most of the time. When you want to take a reading, set the pin HIGH, delay for a while (you will have to experiment to see how much delay you need), take the reading, then set the pin LOW again.

Hi everyone, as promised I am back reporting on what I've done with the results.

By the way, I'm not sure why you were told to get a MOSFET involved.. That's not necessary.

So, basically what I have done is take the +5VDC and GND from the arduino board to a dc to dc converter. I used a Murata NME0505SC.

Then it's quite simple, take two 6N137 optocouplers and wire one to the RX and the other to TX. You'll need to use two resistors for each one, I just used 430R and then you need to put a .01 microfarad cap between pin 5 and 8 for each one per the datasheet. Obviously each of them will be on the separate ground/potentials.

Anyway, everything works perfectly now!! Yay! I have my readings stable and accurate with the probe circuit electrically isolated.

Good to hear you have it working !

About grounding the water of the aquarium. I think that it might be a good idea. But for safety you could use a resistor of about 1M ohm between the water and the ground. Use a large (long) resistor or use two resistors of 1M in series. The will avoid a static charge to build up.

Hi now I understand how to use the mosfet. Whel I will try like dc42 said...

Hi everyone, as promised I am back reporting on what I've done with the results.

By the way, I'm not sure why you were told to get a MOSFET involved.. That's not necessary.

So, basically what I have done is take the +5VDC and GND from the arduino board to a dc to dc converter. I used a Murata NME0505SC.

Then it's quite simple, take two 6N137 optocouplers and wire one to the RX and the other to TX. You'll need to use two resistors for each one, I just used 430R and then you need to put a .01 microfarad cap between pin 5 and 8 for each one per the datasheet. Obviously each of them will be on the separate ground/potentials.

Anyway, everything works perfectly now!! Yay! I have my readings stable and accurate with the probe circuit electrically isolated.

Can you post photos and the schematics of your design?
I will be really helpful, in case the mosfet don't work I can try this way!

Thanks you guys :wink:

Hey mate,

Again, not sure why you're fiddling with the mosfet... but I guess it will be a learning experience for you.

Here's my schematic, please note that whilst it does work I do have to post the disclaimer at the end of this message. :slight_smile:

If you have any questions, please make sure you read the data sheet first:

http://www.fairchildsemi.com/ds/6N/6N137.pdf

If still not sure, then post them here and we'll help you out.

Cheers,
Armen

This schematic is distributed in the hope that it will be useful for everyone but it is distributed without any warranty. It is provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the schematic is with you. Should the schematic prove defective, you assume the cost of all necessary servicing, repair or correction.
In no event will the author of the schematic be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use of the schematic, including but not limited to loss of life, money, the loss of data or data being rendered inaccurate, or any other losses sustained by you or third parties or a failure of the schematic to operate with any other device(s), even if the author has been advised of the possibility of such possibilities.

Krodal:
About grounding the water of the aquarium. I think that it might be a good idea. But for safety you could use a resistor of about 1M ohm between the water and the ground. Use a large (long) resistor or use two resistors of 1M in series. The will avoid a static charge to build up.

Earthing the aquarium water has always been an interesting topic for me because on the one hand one might think it's better for the fish if any inducted electricity is dissipated but on the other hand, it is used to "cover up" a more serious problem where there is an actual electrical fault leaking current into the watter - made even worse by the fact that there is no RCD or it has failed altogether.

Before doing this, it's probably best to figure out why you have stray currents in your setup. To do this, use a multimeter with it set to display VAC and then earth one lead and dip the other in the water. Chances are you will see some voltage there and in reality, it's more than likely that the equipment such your pumps are causing a bit of voltage due to inductance. This is nothing to be concerned about. However, you must do a second test with your multimeter. This time set it to measure current (Amperes) and then put one lead to earth and the other to water (make sure you change the leads on the meter if needed to measure A). At this point, if you see ANY current flowing, you have a dangerous situation where there is actual current flowing from your tank to the earth. You need to then find the faulty piece of equipment by unplugging things until you see no more flow. Earthing in this situation is NOT recommended and you are only covering up a serious problem.

Cheers,
Armen

I fiddled a bit more with this and as a part of my project I built another lamp from wood (it will contain the electronics, feeders and such). The light tubes are now suspended about 25 cm over the water level (compared to about 5 cm before) and the problem seems to have disappeared, even when removing the ground from the water. I still keep the ballast grounded with an extra wire dipped in the water hooked up to a 1M resistor as suggested by Krodal. With a multimeter I can't measure anything, neither volts or amps, so I guess that it's finally working here.

Hi armeniki,
thank you very much for your schematics. Right now I'm in search for those parts to buy them.
When I receive them all I will try to implement that.

Greetings :wink:

Hi everyone, based on the design of the circuit that armeniki showed I have some doubts.
The capacitor C1 and C2 in 1 side takes 5v and on the other side takes ground and from that same side it goes to one pin of the 6N137. Is this correct? Also the RX and TX passes in the middle of those capacitor but they only have 2 points of contact, that RX and TX only crosses those capacitor psychically or is only because of space to drawing it?

Also the Arduiino RX must connect to stamp TX, and arduino TX must connect to stamp RX, but in the drawing the RX is connected to RX and TX connect to TX through 6N137 chips, is this correct?

Anyone can help for I be able to reproduce this solution?

Greetings.